Wednesday 14 December 2016

SOA Service Client : Revise / Delete Item Revision

How to revise the ItemRevision object ?
ItemRevision mdlitemrevisionobj=(ItemRevision)getModelObjectsFromUIDs(new String[]{"C0WhFIXAY95QJC"},connection)[0];

ItemRevision newItemRev = null;
//com.teamcenter.services.strong.core.DataManagementService
DataManagementService dataManagementService = DataManagementService.getService( connection );


ReviseInfo[] reviseInfos = new ReviseInfo[1];
reviseInfos[0] = new ReviseInfo();
reviseInfos[0].baseItemRevision = mdlitemrevisionobj;//ItemRevision to revise
reviseInfos[0].name = revisionName;//Name of new Revision object
reviseInfos[0].description = revisionDesc;//Description of new Revision object
reviseInfos[0].newRevId = revisionId;//Revision ID of new Revision object

ReviseResponse2 resp = dataManagementService.revise2( reviseInfos );


//Process Response to get Revised object

Set<String> mapKeySet = resp.reviseOutputMap.keySet();
for (String key : mapKeySet)
{
 ReviseOutput revOutput = (ReviseOutput) resp.reviseOutputMap.get( key );
 newItemRev = revOutput.newItemRev;// Get the
 break;
}


How to Delete the object from Teamcenter?
ModelObject[] modelObjectArr ->arry of input objects to be deleted

com.teamcenter.services.strong.core.DataManagementService dmService = com.teamcenter.services.strong.core.DataManagementService.getService(connection);
ServiceData data = dmService.deleteObjects(modelObjectArr);

No comments:

Post a Comment