01-28-2015 05:11 AM
Windows 7 x64;
TC 8.3;
RAC java development (not SOA !!!);
Hello,
I was looking at GTAC solution center but could not find an answer to my question:
How can i get "ImanRelation" (or its subclass) object and get its properties?
01-28-2015 08:29 AM - edited 01-28-2015 02:59 PM
Solved.
Even though usually you don't use SOA libraries for RAC developing, you should:
1) add two SOA plugins in your RAC plugin dependencies:
TcSoaCoreRac TcSoaCoreTypes
2) add next imports in your class:
import com.teamcenter.services.rac.core.DataManagementService; import com.teamcenter.services.rac.core._2007_06.DataManagement.RelationAndTypesFilter; import com.teamcenter.services.rac.core._2007_09.DataManagement.ExpandGRMRelationsData2; import com.teamcenter.services.rac.core._2007_09.DataManagement.ExpandGRMRelationsOutput2; import com.teamcenter.services.rac.core._2007_09.DataManagement.ExpandGRMRelationsPref2; import com.teamcenter.services.rac.core._2007_09.DataManagement.ExpandGRMRelationsResponse2; import com.teamcenter.services.rac.core._2007_09.DataManagement.ExpandGRMRelationship;
3) use next construction in code:
TCComponent item = ... ;
DataManagementService dmService = DataManagementService.getService(session);
RelationAndTypesFilter typeFilter = new RelationAndTypesFilter();
typeFilter.relationTypeName = "your_relation_class_name";
ExpandGRMRelationsPref2 relationPref = new ExpandGRMRelationsPref2();
relationPref.expItemRev = false;
relationPref.returnRelations = true;
relationPref.info = new RelationAndTypesFilter[]{ typeFilter };
ExpandGRMRelationsResponse2 relationResp = dmService.expandGRMRelationsForPrimary(new TCComponent[]{ item },relationPref);
for(ExpandGRMRelationsOutput2 relationOut : relationResp.output){
for(ExpandGRMRelationsData2 relationData : relationOut.relationshipData) {
for(ExpandGRMRelationship relation : relationData.relationshipObjects ) {
relation.relation.getProperty("your_property_name");
}
}
}
profit.
PS: sorry, posted in wrong forum