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;
}
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;
}
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);
}
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();
}
}
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);
}
}
}
Aggregations