@Test public void getParentForNestedPage() { DocumentReference documentReference = new DocumentReference("wiki", Arrays.asList("Path", "To"), "WebHome"); when(this.entityTreeNodeIdConverter.convert(EntityReference.class, "document:wiki:Path.To.WebHome")) .thenReturn(documentReference); when(this.entityTreeNodeIdConverter.convert(String.class, new DocumentReference("wiki", "Path", "WebHome"))) .thenReturn("document:wiki:Path.WebHome"); assertEquals("document:wiki:Path.WebHome", this.documentTreeNode.getParent("document:wiki:Path.To.WebHome")); }
@Override protected EntityReference getParent(DocumentReference documentReference) throws Exception { if (getDefaultDocumentName().equals(documentReference.getName())) { EntityReference parentReference = documentReference.getParent().getParent(); if (parentReference.getType() == EntityType.SPACE) { return new DocumentReference(getDefaultDocumentName(), new SpaceReference(parentReference)); } else { return parentReference; } } else { return new DocumentReference(getDefaultDocumentName(), documentReference.getLastSpaceReference()); } }
DocumentTreeNode extends AbstractDocumentTreeNode implements Initializable { @Override protected EntityReference getParent(DocumentReference documentReference) throws Exception { if (getDefaultDocumentName().equals(documentReference.getName())) { EntityReference parentReference = documentReference.getParent().getParent(); if (parentReference.getType() == EntityType.SPACE) { return new DocumentReference(getDefaultDocumentName(), new SpaceReference(parentReference)); } else { return parentReference; } } else { return new DocumentReference(getDefaultDocumentName(), documentReference.getLastSpaceReference()); } } }
DocumentTreeNode extends AbstractDocumentTreeNode implements Initializable { @Override protected EntityReference getParent(DocumentReference documentReference) throws Exception { if (getDefaultDocumentName().equals(documentReference.getName())) { EntityReference parentReference = documentReference.getParent().getParent(); if (parentReference.getType() == EntityType.SPACE) { return new DocumentReference(getDefaultDocumentName(), new SpaceReference(parentReference)); } else { return parentReference; } } else { return new DocumentReference(getDefaultDocumentName(), documentReference.getLastSpaceReference()); } } DocumentTreeNode(); }
DocumentTreeNode extends AbstractDocumentTreeNode implements Initializable { @Override protected EntityReference getParent(DocumentReference documentReference) throws Exception { if (getDefaultDocumentName().equals(documentReference.getName())) { EntityReference parentReference = documentReference.getParent().getParent(); if (parentReference.getType() == EntityType.SPACE) { return new DocumentReference(getDefaultDocumentName(), new SpaceReference(parentReference)); } else { return parentReference; } } else { return new DocumentReference(getDefaultDocumentName(), documentReference.getLastSpaceReference()); } } DocumentTreeNode(); @Override void initialize(); }
DocumentTreeNode extends AbstractDocumentTreeNode implements Initializable { @Override protected EntityReference getParent(DocumentReference documentReference) throws Exception { if (getDefaultDocumentName().equals(documentReference.getName())) { EntityReference parentReference = documentReference.getParent().getParent(); if (parentReference.getType() == EntityType.SPACE) { return new DocumentReference(getDefaultDocumentName(), new SpaceReference(parentReference)); } else { return parentReference; } } else { return new DocumentReference(getDefaultDocumentName(), documentReference.getLastSpaceReference()); } } DocumentTreeNode(); @Override void initialize();  }