@Test public void shouldReturnTrueIfParentIsCorrectInHierarchy() throws Exception { GeographicLevel parentLevel = new GeographicLevel(1234L, "some level", "some level", 1); GeographicLevel childLevel = new GeographicLevel(1234L, "some level", "some level", 2); GeographicZone parentZone = new GeographicZone(); parentZone.setLevel(parentLevel); GeographicZone childZone = new GeographicZone(); childZone.setLevel(childLevel); childZone.setParent(parentZone); assertTrue(childZone.isParentHigherInHierarchy()); }
@JsonIgnore public boolean isParentHigherInHierarchy() { return level.isLowerInHierarchyThan(parent.getLevel()); }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public boolean isParentHigherInHierarchy() { return level.isLowerInHierarchyThan(parent.getLevel()); } }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public boolean isParentHigherInHierarchy() { return level.isLowerInHierarchyThan(parent.getLevel()); } GeographicZone(Long id, String code, String name, GeographicLevel level, GeographicZone parent); }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public boolean isParentHigherInHierarchy() { return level.isLowerInHierarchyThan(parent.getLevel()); } GeographicZone(Long id, String code, String name, GeographicLevel level, GeographicZone parent); @JsonIgnore boolean isParentHigherInHierarchy(); @JsonIgnore boolean isRootLevel(); @JsonIgnore void validateLevel(); @JsonIgnore void validateParentIsHigherInHierarchy(); @JsonIgnore void validateParentExists(); void validateMandatoryFields(); }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public boolean isParentHigherInHierarchy() { return level.isLowerInHierarchyThan(parent.getLevel()); } GeographicZone(Long id, String code, String name, GeographicLevel level, GeographicZone parent); @JsonIgnore boolean isParentHigherInHierarchy(); @JsonIgnore boolean isRootLevel(); @JsonIgnore void validateLevel(); @JsonIgnore void validateParentIsHigherInHierarchy(); @JsonIgnore void validateParentExists(); void validateMandatoryFields();  }