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

Renaming a persisted object

Highlighted
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

Renaming a persisted object

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
>
Announcements
LiveWorx Call For Papers Happening Now!