@Test public void removeParent() { Map<String, Serializable> map1 = getParamMap(3); Map<String, Serializable> map2 = getParamMap(2); EntityReference wiki = new EntityReference("wiki", EntityType.WIKI); EntityReference space = new EntityReference("space", EntityType.SPACE, wiki, map2); EntityReference reference = new EntityReference("page", EntityType.DOCUMENT, space, map1); EntityReference referenceSpace = reference.removeParent(space); EntityReference referenceWiki = reference.removeParent(wiki); assertEquals(reference.getName(), referenceSpace.getName()); assertTrue(checkParamMap(referenceSpace, map1)); assertNull(referenceSpace.getParent()); assertEquals(reference.getName(), referenceWiki.getName()); assertTrue(checkParamMap(referenceWiki, map1)); assertEquals(reference.getParent().getName(), referenceWiki.getParent().getName()); assertTrue(checkParamMap(referenceWiki.getParent(), map2)); assertNull(referenceWiki.getParent().getParent()); }
public EntityReference removeParent(EntityReference oldParent) { if (oldParent == null) { return this; } return new EntityReference(this, oldParent, null); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference removeParent(EntityReference oldParent) { if (oldParent == null) { return this; } return new EntityReference(this, oldParent, null); } }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference removeParent(EntityReference oldParent) { if (oldParent == null) { return this; } return new EntityReference(this, oldParent, null); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference removeParent(EntityReference oldParent) { if (oldParent == null) { return this; } return new EntityReference(this, oldParent, null); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); final String getName(); final EntityReference getParent(); final EntityType getType(); final Map<String, Serializable> getParameters(); @Transient EntityReference getRoot(); @Transient List<EntityReference> getReversedReferenceChain(); int size(); EntityReference extractReference(EntityType type); EntityReference extractFirstReference(EntityType type); EntityReference replaceParent(EntityReference oldParent, EntityReference newParent); EntityReference replaceParent(EntityReference newParent); EntityReference appendParent(EntityReference newParent); EntityReference removeParent(EntityReference oldParent); boolean hasParent(EntityReference expectedParent); @Override String toString(); @Override boolean equals(Object obj); boolean equals(EntityReference otherReference, EntityType to); boolean equals(EntityReference otherReference, EntityType from, EntityType to); boolean equalsNonRecursive(EntityReference otherReference); @Override int hashCode(); @Override int compareTo(EntityReference reference); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference removeParent(EntityReference oldParent) { if (oldParent == null) { return this; } return new EntityReference(this, oldParent, null); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); final String getName(); final EntityReference getParent(); final EntityType getType(); final Map<String, Serializable> getParameters(); @Transient EntityReference getRoot(); @Transient List<EntityReference> getReversedReferenceChain(); int size(); EntityReference extractReference(EntityType type); EntityReference extractFirstReference(EntityType type); EntityReference replaceParent(EntityReference oldParent, EntityReference newParent); EntityReference replaceParent(EntityReference newParent); EntityReference appendParent(EntityReference newParent); EntityReference removeParent(EntityReference oldParent); boolean hasParent(EntityReference expectedParent); @Override String toString(); @Override boolean equals(Object obj); boolean equals(EntityReference otherReference, EntityType to); boolean equals(EntityReference otherReference, EntityType from, EntityType to); boolean equalsNonRecursive(EntityReference otherReference); @Override int hashCode(); @Override int compareTo(EntityReference reference);  }