Hi All,
Is there a way to query and get a List of DataObjectTrees which all have a given DataObject type as the root?
Thanks,
Dhruti
The DataObjectService API does not provide a way to do this directly. IDataObjectService.loadTrees takes a single root ID rather than a query. However, if you are loading from Java, you can load the DataObjects and construct the trees using DataObjectTreeUtils. For example,
DataObjectQuery query = DataObjectQueries.dataObjectQuery(DataObjectQueries.rootTypes(MetadataTypes.PERSON));
List<DataObject> dataObjects = dataObjectService.load(query, Context.makeSystemContext());
Set<DataObjectTree> trees = DataObjectTreeUtils.createTreeStructures(dataObjects);
If you are loading from the front-end, there is a similar utility. See https://api.leidos-leaf.com/leaf/javadocs/javascript/3.2.0/modules/core.dataobjecttreeutils.html#createtreestructures
1 Like