cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Renaming a persisted object

dgraham-4
1-Newbie

Renaming a persisted object


Anyone know how to rename a persisted object such as a
wt.change2.WTChangeIssue?

PTC said to try the following

wt.fc.IdentificationObject id = ci.getIdentificationObject();
id.setName(name);
wt.fc.IdentityHelper.service.changeIdentity(ci, id);

This sounds good on paper however there does not appear to be a setName()
method in the wt.fc.IdentificationObject class.

I want my class to read something like the following:

import wt.change2.*;
import wt.util.WTException;
public class WfRenameCI {

public void renameCI (WTChangeIssue ci, String name) throws WTException{
if (!(ci.getName().equals(name))){
//Rename the Change Issue
wt.fc.IdentificationObject id = ci.getIdentificationObject();
id.setName(name);
wt.fc.IdentityHelper.service.changeIdentity(ci, id);
}

}

David
1 REPLY 1

hi,

what you get is a wt.change2.WTChangeIssueMasterIdentity (which is a
wt.change2.ChangeIdentificationObject which in turn is a
wt.fc.IdentificationObject), so you need a cast:

wt.change2.WTChangeIssueMasterIdentity id =
(wt.change2.WTChangeIssueMasterIdentity) ci.getIdentificationObject();


hth, martin



David Graham wrote:
> Anyone know how to rename a persisted object such as a
> wt.change2.WTChangeIssue?
>
> PTC said to try the following
>
> wt.fc.IdentificationObject id = ci.getIdentificationObject();
> id.setName(name);
> wt.fc.IdentityHelper.service.changeIdentity(ci, id);
>
> This sounds good on paper however there does not appear to be a setName()
> method in the wt.fc.IdentificationObject class.
>
> I want my class to read something like the following:
>
> import wt.change2.*;
> import wt.util.WTException;
> public class WfRenameCI {
>
> public void renameCI (WTChangeIssue ci, String name) throws WTException{
> if (!(ci.getName().equals(name))){
> //Rename the Change Issue
> wt.fc.IdentificationObject id = ci.getIdentificationObject();
> id.setName(name);
> wt.fc.IdentityHelper.service.changeIdentity(ci, id);
> }
>
> }
>
> David
>
Top Tags