Here we will understand the apis used for removing the named references from Dataset
import com.teamcenter.services.strong.core.DataManagementService; import com.teamcenter.services.strong.core._2007_09.DataManagement.NamedReferenceInfo; import com.teamcenter.services.strong.core._2007_09.DataManagement.RemoveNamedReferenceFromDatasetInfo; import com.teamcenter.soa.client.Connection; import com.teamcenter.soa.client.model.ModelObject; import com.teamcenter.soa.client.model.ServiceData; import com.teamcenter.soa.client.model.strong.Dataset; String datasetUID = listValues.get(0); category.info("datasetUID : " + datasetUID); String strTextUID = listValues.get(1); category.info("strTextUID : " + strTextUID); String strNamedRefType = listValues.get(2); category.info("NamedReferenceType : " + strNamedRefType); TcSOAPlugin soaPlugin = (TcSOAPlugin) plugin; Connection soaConnection = soaPlugin.getTcConnection(); Dataset dataSet = (Dataset) soaPlugin.getConnection().getPinnedObject(datasetUID); category.info(" Dataset object pinned : " + dataSet); ModelObject TextFile = (ModelObject)soaPlugin.getConnection().getPinnedObject(strTextUID); category.info(" TextFile object pinned : " + TextFile); DataManagementService dataManagementService = DataManagementService.getService( soaConnection ); NamedReferenceInfo[] nrInfo = new NamedReferenceInfo[1]; nrInfo[0] = new NamedReferenceInfo(); nrInfo[0].clientId = "ClientId01"; nrInfo[0].deleteTarget = true; nrInfo[0].type = strNamedRefType; nrInfo[0].targetObject = TextFile; //Dataset RemoveNamedReferenceFromDatasetInfo datasetinfo[] = new RemoveNamedReferenceFromDatasetInfo[1]; datasetinfo[0] = new RemoveNamedReferenceFromDatasetInfo(); datasetinfo[0].clientId = "ClientId01"; datasetinfo[0].dataset = dataSet; datasetinfo[0].nrInfo = nrInfo; ServiceData serviceData = dataManagementService.removeNamedReferenceFromDataset(datasetinfo);
No comments:
Post a Comment