Search in sources :

Example 1 with AbstractUpdateAttributeView

use of net.geoprism.registry.view.action.AbstractUpdateAttributeView in project geoprism-registry by terraframe.

the class UpdateAttributeAction method execute.

@Override
public void execute() {
    ChangeRequest cr = this.getAllRequest().next();
    ServerGeoObjectType type = ServerGeoObjectType.get(cr.getGeoObjectTypeCode());
    VertexServerGeoObject go = new VertexGeoObjectStrategy(type).getGeoObjectByCode(cr.getGeoObjectCode());
    AbstractUpdateAttributeView view = UpdateAttributeViewJsonAdapters.deserialize(this.getJson(), this.getAttributeName(), type);
    view.execute(go);
    if (!this.getAttributeName().equals(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME)) {
        String attributeName = this.getAttributeName();
        if (attributeName.equals("geometry")) {
            attributeName = go.getGeometryAttributeName();
        }
        ValueOverTimeCollection votc = go.getValuesOverTime(attributeName);
        votc.reorder();
        go.apply(false);
    }
}
Also used : VertexGeoObjectStrategy(net.geoprism.registry.conversion.VertexGeoObjectStrategy) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) AbstractUpdateAttributeView(net.geoprism.registry.view.action.AbstractUpdateAttributeView) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) ChangeRequest(net.geoprism.registry.action.ChangeRequest)

Example 2 with AbstractUpdateAttributeView

use of net.geoprism.registry.view.action.AbstractUpdateAttributeView in project geoprism-registry by terraframe.

the class ServerGeoObjectService method executeActions.

public void executeActions(final ServerGeoObjectType type, final VertexServerGeoObject go, final JsonArray jaActions) {
    for (int i = 0; i < jaActions.size(); ++i) {
        JsonObject action = jaActions.get(i).getAsJsonObject();
        String attributeName = action.get("attributeName").getAsString();
        JsonObject attributeDiff = action.get("attributeDiff").getAsJsonObject();
        AbstractUpdateAttributeView view = UpdateAttributeViewJsonAdapters.deserialize(attributeDiff.toString(), attributeName, type);
        view.execute(go);
    }
    go.apply(false);
}
Also used : JsonObject(com.google.gson.JsonObject) AbstractUpdateAttributeView(net.geoprism.registry.view.action.AbstractUpdateAttributeView)

Aggregations

AbstractUpdateAttributeView (net.geoprism.registry.view.action.AbstractUpdateAttributeView)2 JsonObject (com.google.gson.JsonObject)1 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)1 ChangeRequest (net.geoprism.registry.action.ChangeRequest)1 VertexGeoObjectStrategy (net.geoprism.registry.conversion.VertexGeoObjectStrategy)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)1