import org.simantics.db.common.request.ResourceRead;
import org.simantics.db.common.utils.ListUtils;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.exception.ServiceException;
import org.simantics.db.layer0.request.ActiveModels;
import org.simantics.db.layer0.request.ActiveRuns;
import org.simantics.db.layer0.request.Configuration;
}
}
- private static Collection<Resource> elementsOfDiagram(ReadGraph graph, Resource diagram) throws ServiceException {
+ private static Collection<Resource> elementsOfDiagram(ReadGraph graph, Resource diagram) throws DatabaseException {
+ if (graph.isInstanceOf(diagram, STR.Composite)) {
+ // Resource is a composite - get diagram
+ return elementsOfDiagram(graph, graph.getSingleObject(diagram, MOD.CompositeToDiagram));
+ }
+
Collection<Resource> elements = graph.getObjects(diagram, L0.ConsistsOf);
Collection<Resource> result = new ArrayList<>();
for (Resource r : elements)
result2.sort((t1, t2) -> smallest ? Double.compare((Double) t1.c1, (Double) t2.c1) : Double.compare((Double) t2.c1, (Double) t1.c1));
- result2 = result2.subList(0, resultCount);
+ if (resultCount < result2.size())
+ result2 = result2.subList(0, resultCount);
result = Lists.map(new FunctionImpl1<Tuple2, Resource>() {
@Override