@Test public void getChildren() { List<BaseObject> objects = new ArrayList<>(); for (int i = 0; i < 2; i++) { BaseObject object = mock(BaseObject.class, String.valueOf(i)); BaseObjectReference reference = mock(BaseObjectReference.class, String.valueOf(i)); when(this.defaultEntityReferenceSerializer.serialize(reference)).thenReturn(String.valueOf(i)); when(object.getReference()).thenReturn(reference); objects.add(object); } when(this.document.getXObjects(CLASS_REFERENCE)).thenReturn(objects); assertEquals(Arrays.asList("object:1"), this.objectsOfTypeTreeNode.getChildren(NODE_ID, 1, 3)); }
@Override public List<String> getChildren(String nodeId, int offset, int limit) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { List<String> children = new ArrayList<String>(); for (ObjectReference objectReference : subList(getXObjectReferences(parts[0], parts[1]), offset, limit)) { children.add("object:" + this.defaultEntityReferenceSerializer.serialize(objectReference)); } return children; } catch (Exception e) { this.logger.warn("Failed to retrieve the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return Collections.emptyList(); }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public List<String> getChildren(String nodeId, int offset, int limit) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { List<String> children = new ArrayList<String>(); for (ObjectReference objectReference : subList(getXObjectReferences(parts[0], parts[1]), offset, limit)) { children.add("object:" + this.defaultEntityReferenceSerializer.serialize(objectReference)); } return children; } catch (Exception e) { this.logger.warn("Failed to retrieve the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return Collections.emptyList(); } }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public List<String> getChildren(String nodeId, int offset, int limit) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { List<String> children = new ArrayList<String>(); for (ObjectReference objectReference : subList(getXObjectReferences(parts[0], parts[1]), offset, limit)) { children.add("object:" + this.defaultEntityReferenceSerializer.serialize(objectReference)); } return children; } catch (Exception e) { this.logger.warn("Failed to retrieve the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return Collections.emptyList(); }  }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public List<String> getChildren(String nodeId, int offset, int limit) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { List<String> children = new ArrayList<String>(); for (ObjectReference objectReference : subList(getXObjectReferences(parts[0], parts[1]), offset, limit)) { children.add("object:" + this.defaultEntityReferenceSerializer.serialize(objectReference)); } return children; } catch (Exception e) { this.logger.warn("Failed to retrieve the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return Collections.emptyList(); }  @Override List<String> getChildren(String nodeId, int offset, int limit); @Override int getChildCount(String nodeId); @Override String getParent(String nodeId); }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public List<String> getChildren(String nodeId, int offset, int limit) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { List<String> children = new ArrayList<String>(); for (ObjectReference objectReference : subList(getXObjectReferences(parts[0], parts[1]), offset, limit)) { children.add("object:" + this.defaultEntityReferenceSerializer.serialize(objectReference)); } return children; } catch (Exception e) { this.logger.warn("Failed to retrieve the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return Collections.emptyList(); }  @Override List<String> getChildren(String nodeId, int offset, int limit); @Override int getChildCount(String nodeId); @Override String getParent(String nodeId);  }