Search in sources :

Example 1 with CreatePermissionException

use of com.runwaysdk.session.CreatePermissionException in project geoprism-registry by terraframe.

the class VertexServerGeoObject method apply.

@Override
public void apply(boolean isImport) {
    if (!isImport && !this.vertex.isNew() && !this.getType().isGeometryEditable() && this.vertex.isModified(this.getGeometryAttributeName())) {
        throw new GeometryUpdateException();
    }
    if (this.vertex.isNew() || this.vertex.getObjectValue(GeoVertex.CREATEDATE) == null) {
        this.vertex.setValue(GeoVertex.CREATEDATE, new Date());
    }
    this.vertex.setValue(GeoVertex.LASTUPDATEDATE, new Date());
    if (this.getInvalid() == null) {
        this.setInvalid(false);
    }
    this.validate();
    try {
        this.getVertex().apply();
    } catch (CreatePermissionException ex) {
        CreateGeoObjectPermissionException goex = new CreateGeoObjectPermissionException();
        goex.setGeoObjectType(this.getType().getLabel().getValue());
        goex.setOrganization(this.getType().getOrganization().getDisplayLabel().getValue());
        throw goex;
    } catch (WritePermissionException ex) {
        WriteGeoObjectPermissionException goex = new WriteGeoObjectPermissionException();
        goex.setGeoObjectType(this.getType().getLabel().getValue());
        goex.setOrganization(this.getType().getOrganization().getDisplayLabel().getValue());
        throw goex;
    } catch (ReadPermissionException ex) {
        ReadGeoObjectPermissionException goex = new ReadGeoObjectPermissionException();
        goex.setGeoObjectType(this.getType().getLabel().getValue());
        goex.setOrganization(this.getType().getOrganization().getDisplayLabel().getValue());
        throw goex;
    }
    if (!this.getInvalid()) {
        new SearchService().insert(this);
    } else {
        new SearchService().remove(this.getCode());
    }
}
Also used : ReadGeoObjectPermissionException(net.geoprism.registry.roles.ReadGeoObjectPermissionException) GeometryUpdateException(net.geoprism.dashboard.GeometryUpdateException) WritePermissionException(com.runwaysdk.session.WritePermissionException) CreateGeoObjectPermissionException(net.geoprism.registry.roles.CreateGeoObjectPermissionException) SearchService(net.geoprism.registry.service.SearchService) ReadPermissionException(com.runwaysdk.session.ReadPermissionException) WriteGeoObjectPermissionException(net.geoprism.registry.roles.WriteGeoObjectPermissionException) Date(java.util.Date) LocalDate(java.time.LocalDate) CreatePermissionException(com.runwaysdk.session.CreatePermissionException)

Aggregations

CreatePermissionException (com.runwaysdk.session.CreatePermissionException)1 ReadPermissionException (com.runwaysdk.session.ReadPermissionException)1 WritePermissionException (com.runwaysdk.session.WritePermissionException)1 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1 GeometryUpdateException (net.geoprism.dashboard.GeometryUpdateException)1 CreateGeoObjectPermissionException (net.geoprism.registry.roles.CreateGeoObjectPermissionException)1 ReadGeoObjectPermissionException (net.geoprism.registry.roles.ReadGeoObjectPermissionException)1 WriteGeoObjectPermissionException (net.geoprism.registry.roles.WriteGeoObjectPermissionException)1 SearchService (net.geoprism.registry.service.SearchService)1