I am trying to get the list of parents up to the "Home Folder" of a given folder, getting the list of 'all' Relationships including the target folder seems overkill to me. Could anyone provide a code snippet using ITK calls (if needed).
I have also tried inspecting the properties of the original folder Model Object and getting information about the parent, but in the uid field of the parent I get the type of it instead of its real UID :/ .
ModelObject fmo = _session.getConnection().getWebServicesMgr().
List<String> result = new ArrayList<>();
String parentName = fmo.getTypeObject().getParent().getName();
String parentUID = fmo.getTypeObject().getParent().getUid();
System.out.println("Parent folder Name:"+parentName);
System.out.println("Parent folder UID:"+parentUID);
Produces the 'wrong' output:
Parent folder Name:Folder
Parent folder UID:TYPE::Folder::Folder::WorkspaceObject
Solved! Go to Solution.
"content" relation is literally written that way?
In the document 'Basic Customization Concepts' the base types of relations are:
- BOMView Revision
I was actually trying with "IMAN_reference" and "IMAN_specification" but not getting the results:
ExpandGRMRelationsPref2 pref = new ExpandGRMRelationsPref2();
pref.info = new RelationAndTypesFilter;
pref.info = new RelationAndTypesFilter();
pref.info.otherSideObjectTypes = parentTypes;
pref.info.relationTypeName = "IMAN_referenced";
ExpandGRMRelationsResponse2 orelated =
Should I try the same with pref.info.relationTypeName = "content" ?
found a much simpler way. Create a query as shown in picture and use "ExecuteSavedQuery" API to get parent folder. OR to avoid SavedQuery, use "ExecuteBusinessObjectQueries" and provide following criteria as input
I tried almost all IMAN_* shown on BMIDE for COTS objects and none of them reported any object. I would prefer to avoid using the query method as basically I would like to fix an existing code that should perform the basic task of getting all relations of a given type to a given object and hence obtain a general way for me to inspect a tree from bottom to top.
"contents" generated an error:
Error Val.: The relation type name is invalid.
I also tried IMAN_CCContents, that returned an empty array of objects, being that the general response to all tested IMAN types.
Any suggestion? Thanks a lot for your help.
Try DataManagementService.WhereReferenced() Method. You will get all objects where input folder is referenced. you can filter the output objects with "Folder" type.
Thank you xplm2005,
WhereReferenced is working like a charm, but it is reporting "" for the relation type info:
for (DataManagement.WhereReferencedOutput ref : rfr.output)
System.out.println("Referenced:" + ref.inputObject.getUid());
for (DataManagement.WhereReferencedInfo info : ref.info)
System.out.println("\t\tlevel:" + info.level);
System.out.println("\t\tuid:" + info.referencer.getUid());
System.out.println("\tType of Reference:" + info.relation);
Indicates that no info.relation name is present:
Type of Reference:
Could this be related to a policy? without that field information I cannot filter the type of the reference :/
Not sure why this is not working, but I dont think this is related to property policy.
you can try filtering output ModelObject i.e. Referencer to check if it is of type Folder. If yes, find value of property "contents" (here property policy is needed) and make sure that the value of contents is the referenced object i.e. input.