Search in sources :

Example 26 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class ParentReferenceProblem method toJSON.

@Override
public JsonObject toJSON() {
    JsonObject object = super.toJSON();
    ServerGeoObjectType type = ServerGeoObjectType.get(this.getTypeCode());
    object.addProperty("label", this.getLabel());
    object.addProperty("typeCode", this.getTypeCode());
    object.add("typeLabel", type.getLabel().toJSON());
    object.add("context", JsonParser.parseString(this.getContext()));
    if (this.getParentCode() != null && this.getParentCode().length() > 0) {
        object.addProperty("parent", this.getParentCode());
    }
    return object;
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject)

Example 27 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class GeoVertexSynonym method createSynonym.

@Transaction
public static JSONObject createSynonym(String typeCode, String code, String label) {
    ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
    VertexGeoObjectStrategy strategy = new VertexGeoObjectStrategy(type);
    VertexServerGeoObject object = strategy.getGeoObjectByCode(code);
    final String oid = object.addSynonym(label);
    JSONObject jObject = new JSONObject();
    jObject.put("synonymId", oid);
    jObject.put("label", object.getDisplayLabel().getValue());
    // jObject.put("ancestors", object.getA new
    // JSONArray(GeoEntityUtil.getAncestorsAsJSON(code)));
    JSONObject response = new JSONObject(jObject);
    response.put("vOid", oid);
    return response;
}
Also used : VertexGeoObjectStrategy(net.geoprism.registry.conversion.VertexGeoObjectStrategy) JSONObject(org.json.JSONObject) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 28 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class Transition method getVertex.

private VertexServerGeoObject getVertex(String attributeName) {
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(Transition.CLASS);
    MdAttributeDAOIF mdAttribute = mdVertex.definesAttribute(attributeName);
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT expand(" + mdAttribute.getColumnName() + ")");
    statement.append(" FROM :parent");
    GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(statement.toString());
    query.setParameter("parent", this.getRID());
    VertexObject vertex = query.getSingleResult();
    MdVertexDAOIF geoVertex = (MdVertexDAOIF) vertex.getMdClass();
    ServerGeoObjectType type = ServerGeoObjectType.get(geoVertex);
    return new VertexServerGeoObject(type, vertex);
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 29 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class ChangeRequestSortingPatch method doIt.

@Transaction
private void doIt() {
    ChangeRequestQuery crq = new ChangeRequestQuery(new QueryFactory());
    OIterator<? extends ChangeRequest> it = crq.getIterator();
    for (ChangeRequest cr : it) {
        LocalizedValue goLabel = cr.getGeoObjectDisplayLabel();
        ServerGeoObjectType type = cr.getGeoObjectType();
        cr.appLock();
        cr.getGeoObjectLabel().setLocaleMap(goLabel.getLocaleMap());
        cr.getGeoObjectTypeLabel().setLocaleMap(type.getLabel().getLocaleMap());
        cr.apply();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ChangeRequestQuery(net.geoprism.registry.action.ChangeRequestQuery) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ChangeRequest(net.geoprism.registry.action.ChangeRequest) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 30 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class PatchCodeMetadata method transaction.

@Transaction
private void transaction() {
    MdAttributeDAOIF mdAttributeGeoId = MdVertexDAO.getMdVertexDAO(GeoVertex.CLASS).definesAttribute("geoId");
    if (mdAttributeGeoId != null) {
        mdAttributeGeoId.getBusinessDAO().delete();
    }
    List<ServerGeoObjectType> types = ServiceFactory.getMetadataCache().getAllGeoObjectTypes();
    types = types.stream().filter(t -> t.getIsAbstract()).collect(Collectors.toList());
    for (ServerGeoObjectType type : types) {
        MdVertexDAOIF mdVertex = type.getMdVertex();
        if (mdVertex.definesAttribute(DefaultAttribute.CODE.getName()) != null) {
            // Remove the code attribute
            delete(type);
            create(type);
        }
    }
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)201 Request (com.runwaysdk.session.Request)69 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)57 JsonObject (com.google.gson.JsonObject)48 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)32 JsonArray (com.google.gson.JsonArray)30 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)30 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)27 LinkedList (java.util.LinkedList)27 Test (org.junit.Test)27 VertexObject (com.runwaysdk.business.graph.VertexObject)26 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)26 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)23 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)23 Date (java.util.Date)21 GraphQuery (com.runwaysdk.business.graph.GraphQuery)19 List (java.util.List)18 EdgeObject (com.runwaysdk.business.graph.EdgeObject)17 SimpleDateFormat (java.text.SimpleDateFormat)17 Locale (java.util.Locale)17