Search in sources :

Example 1 with InvalidGeoEntityUniversalException

use of com.runwaysdk.system.gis.geo.InvalidGeoEntityUniversalException in project geoprism-registry by terraframe.

the class ServerHierarchyType method validateUniversalRelationship.

public void validateUniversalRelationship(ServerGeoObjectType childType, ServerGeoObjectType parentType) {
    // Total hack for super types
    Universal childUniversal = childType.getUniversal();
    Universal parentUniversal = parentType.getUniversal();
    List<Term> ancestors = childUniversal.getAllAncestors(this.getUniversalType()).getAll();
    if (!ancestors.contains(parentUniversal)) {
        ServerGeoObjectType superType = childType.getSuperType();
        if (superType != null) {
            ancestors = superType.getUniversal().getAllAncestors(this.getUniversalType()).getAll();
        }
    }
    if (!ancestors.contains(parentUniversal)) {
        InvalidGeoEntityUniversalException exception = new InvalidGeoEntityUniversalException();
        exception.setChildUniversal(childUniversal.getDisplayLabel().getValue());
        exception.setParentUniversal(parentUniversal.getDisplayLabel().getValue());
        exception.apply();
        throw exception;
    }
}
Also used : InvalidGeoEntityUniversalException(com.runwaysdk.system.gis.geo.InvalidGeoEntityUniversalException) Universal(com.runwaysdk.system.gis.geo.Universal) Term(com.runwaysdk.business.ontology.Term)

Aggregations

Term (com.runwaysdk.business.ontology.Term)1 InvalidGeoEntityUniversalException (com.runwaysdk.system.gis.geo.InvalidGeoEntityUniversalException)1 Universal (com.runwaysdk.system.gis.geo.Universal)1