Search in sources :

Example 1 with InvalidRegistryIdException

use of net.geoprism.registry.InvalidRegistryIdException in project geoprism-registry by terraframe.

the class VertexGeoObjectStrategy method constructFromGeoObjectOverTime.

@Override
public VertexServerGeoObject constructFromGeoObjectOverTime(GeoObjectOverTime goTime, boolean isNew) {
    if (!isNew) {
        VertexObject vertex = VertexServerGeoObject.getVertex(type, goTime.getUid());
        if (vertex == null) {
            InvalidRegistryIdException ex = new InvalidRegistryIdException();
            ex.setRegistryId(goTime.getUid());
            throw ex;
        }
        return new VertexServerGeoObject(type, vertex);
    } else {
        if (!RegistryIdService.getInstance().isIssuedId(goTime.getUid())) {
            InvalidRegistryIdException ex = new InvalidRegistryIdException();
            ex.setRegistryId(goTime.getUid());
            throw ex;
        }
        VertexObject vertex = VertexServerGeoObject.newInstance(type);
        return new VertexServerGeoObject(type, vertex);
    }
}
Also used : InvalidRegistryIdException(net.geoprism.registry.InvalidRegistryIdException) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Example 2 with InvalidRegistryIdException

use of net.geoprism.registry.InvalidRegistryIdException in project geoprism-registry by terraframe.

the class ServerGeoObjectService method getGeoObject.

public ServerGeoObjectIF getGeoObject(String uid, String typeCode) {
    ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
    this.permissionService.enforceCanRead(type.getOrganization().getCode(), type);
    ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
    ServerGeoObjectIF object = strategy.getGeoObjectByUid(uid);
    if (object == null) {
        InvalidRegistryIdException ex = new InvalidRegistryIdException();
        ex.setRegistryId(uid);
        throw ex;
    }
    return object;
}
Also used : InvalidRegistryIdException(net.geoprism.registry.InvalidRegistryIdException) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ServerGeoObjectStrategyIF(net.geoprism.registry.conversion.ServerGeoObjectStrategyIF)

Example 3 with InvalidRegistryIdException

use of net.geoprism.registry.InvalidRegistryIdException in project geoprism-registry by terraframe.

the class VertexGeoObjectStrategy method constructFromGeoObject.

@Override
public VertexServerGeoObject constructFromGeoObject(GeoObject geoObject, boolean isNew) {
    if (!isNew) {
        VertexObject vertex = VertexServerGeoObject.getVertex(type, geoObject.getUid());
        if (vertex == null) {
            InvalidRegistryIdException ex = new InvalidRegistryIdException();
            ex.setRegistryId(geoObject.getUid());
            throw ex;
        }
        return new VertexServerGeoObject(type, vertex);
    } else {
        if (!RegistryIdService.getInstance().isIssuedId(geoObject.getUid())) {
            InvalidRegistryIdException ex = new InvalidRegistryIdException();
            ex.setRegistryId(geoObject.getUid());
            throw ex;
        }
        VertexObject vertex = VertexServerGeoObject.newInstance(type);
        return new VertexServerGeoObject(type, vertex);
    }
}
Also used : InvalidRegistryIdException(net.geoprism.registry.InvalidRegistryIdException) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Aggregations

InvalidRegistryIdException (net.geoprism.registry.InvalidRegistryIdException)3 VertexObject (com.runwaysdk.business.graph.VertexObject)2 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)2 ServerGeoObjectStrategyIF (net.geoprism.registry.conversion.ServerGeoObjectStrategyIF)1 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1