Search in sources :

Example 1 with GeometryType

use of org.commongeoregistry.adapter.constants.GeometryType in project geoprism-registry by terraframe.

the class ListType method listForType.

public static JsonObject listForType(String typeCode) {
    ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
    Organization org = type.getOrganization();
    final boolean isMember = Organization.isMember(org);
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    query.WHERE(query.getUniversal().EQ(type.getUniversal()));
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    final JsonArray lists = new JsonArray();
    try (OIterator<? extends ListType> it = query.getIterator()) {
        it.getAll().stream().sorted((a, b) -> {
            return a.getDisplayLabel().getValue().compareTo(b.getDisplayLabel().getValue());
        }).filter(f -> {
            return true;
        }).forEach(list -> {
            // JsonObject object = new JsonObject();
            // object.addProperty("label", list.getDisplayLabel().getValue());
            // object.addProperty("oid", list.getOid());
            // object.addProperty("createDate",
            // format.format(list.getCreateDate()));
            // object.addProperty("lasteUpdateDate",
            // format.format(list.getLastUpdateDate()));
            // object.addProperty("write", list.doesActorHaveWritePermission());
            // object.addProperty("read", list.doesActorHaveReadPermission());
            // 
            lists.add(list.toJSON());
        });
    }
    JsonObject object = new JsonObject();
    object.addProperty("orgCode", org.getCode());
    object.addProperty("orgLabel", org.getDisplayLabel().getValue());
    object.addProperty("typeCode", type.getCode());
    object.addProperty("typeLabel", type.getLabel().getValue());
    object.addProperty("geometryType", type.getGeometryType().name());
    object.addProperty("write", doesActorHaveWritePermissions(type));
    object.add("lists", lists);
    return object;
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) Operation(com.runwaysdk.business.rbac.Operation) Date(java.util.Date) Authenticate(com.runwaysdk.business.rbac.Authenticate) MdEdgeDAOIF(com.runwaysdk.dataaccess.MdEdgeDAOIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CreateListPermissionException(net.geoprism.registry.roles.CreateListPermissionException) MdAttributeDateTimeUtil(com.runwaysdk.constants.MdAttributeDateTimeUtil) ClassificationType(net.geoprism.registry.model.ClassificationType) Locale(java.util.Locale) Map(java.util.Map) AttributeBooleanType(org.commongeoregistry.adapter.metadata.AttributeBooleanType) TermConverter(net.geoprism.registry.conversion.TermConverter) UpdateListPermissionException(net.geoprism.registry.roles.UpdateListPermissionException) Optional(org.commongeoregistry.adapter.Optional) Collection(java.util.Collection) MdAttributeClassificationDAOIF(com.runwaysdk.dataaccess.MdAttributeClassificationDAOIF) List(java.util.List) JsonArray(com.google.gson.JsonArray) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GeometryType(org.commongeoregistry.adapter.constants.GeometryType) CompositeRestriction(net.geoprism.registry.query.graph.CompositeRestriction) Universal(com.runwaysdk.system.gis.geo.Universal) ListTypeJob(net.geoprism.registry.etl.ListTypeJob) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) GeoprismProperties(net.geoprism.GeoprismProperties) AttributeClassificationType(org.commongeoregistry.adapter.metadata.AttributeClassificationType) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) JsonParser(com.google.gson.JsonParser) Constants(com.runwaysdk.constants.Constants) ServiceFactory(net.geoprism.registry.service.ServiceFactory) Classifier(net.geoprism.ontology.Classifier) LocalizationFacade(com.runwaysdk.localization.LocalizationFacade) ListTypeJobQuery(net.geoprism.registry.etl.ListTypeJobQuery) Classification(net.geoprism.registry.model.Classification) AttributeValueRestriction(net.geoprism.registry.query.graph.AttributeValueRestriction) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList) LocalStruct(com.runwaysdk.business.LocalStruct) MdClassificationDAOIF(com.runwaysdk.dataaccess.MdClassificationDAOIF) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) Term(org.commongeoregistry.adapter.Term) AttributeTermType(org.commongeoregistry.adapter.metadata.AttributeTermType) AttributeDateType(org.commongeoregistry.adapter.metadata.AttributeDateType) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) OR(com.runwaysdk.query.OR) File(java.io.File) OIterator(com.runwaysdk.query.OIterator) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) BasicVertexRestriction(net.geoprism.registry.query.graph.BasicVertexRestriction) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) Session(com.runwaysdk.session.Session) RolePermissionService(net.geoprism.registry.permission.RolePermissionService) LocaleSerializer(net.geoprism.registry.service.LocaleSerializer) QueryFactory(com.runwaysdk.query.QueryFactory) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with GeometryType

use of org.commongeoregistry.adapter.constants.GeometryType in project geoprism-registry by terraframe.

the class XMLImporter method createServerGeoObjectType.

private ServerGeoObjectType createServerGeoObjectType(Organization organization, Element elem) {
    String code = elem.getAttribute("code");
    LocalizedValue label = this.getLabel(elem);
    LocalizedValue description = this.getDescription(elem);
    String visibility = elem.getAttribute("visibility");
    GeometryType geometryType = this.getGeometryType(elem);
    boolean isGeometryEditable = this.getIsGeometryEditable(elem);
    boolean isAbstract = this.getIsGroup(elem) || (elem.getElementsByTagName("group-item").getLength() > 0);
    GeoObjectType type = new GeoObjectType(code, geometryType, label, description, isGeometryEditable, organization.getCode(), adapter);
    type.setIsPrivate(this.getIsPrivate(visibility));
    type.setIsAbstract(isAbstract);
    ServiceFactory.getGeoObjectTypePermissionService().enforceCanCreate(organization.getCode(), type.getIsPrivate());
    return new ServerGeoObjectTypeConverter().create(type);
}
Also used : GeometryType(org.commongeoregistry.adapter.constants.GeometryType) ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) RootGeoObjectType(net.geoprism.registry.model.RootGeoObjectType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType)

Aggregations

ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)2 GeometryType (org.commongeoregistry.adapter.constants.GeometryType)2 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)2 GeoObjectType (org.commongeoregistry.adapter.metadata.GeoObjectType)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 LocalStruct (com.runwaysdk.business.LocalStruct)1 Authenticate (com.runwaysdk.business.rbac.Authenticate)1 Operation (com.runwaysdk.business.rbac.Operation)1 Constants (com.runwaysdk.constants.Constants)1 MdAttributeDateTimeUtil (com.runwaysdk.constants.MdAttributeDateTimeUtil)1 MdAttributeClassificationDAOIF (com.runwaysdk.dataaccess.MdAttributeClassificationDAOIF)1 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)1 MdClassificationDAOIF (com.runwaysdk.dataaccess.MdClassificationDAOIF)1 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)1 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)1 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)1 LocalizationFacade (com.runwaysdk.localization.LocalizationFacade)1 OIterator (com.runwaysdk.query.OIterator)1