Search in sources :

Example 6 with ServerGeoObjectTypeConverter

use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter 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)

Example 7 with ServerGeoObjectTypeConverter

use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.

the class TestGeoObjectTypeInfo method getServerObject.

public ServerGeoObjectType getServerObject(boolean forceFetch) {
    if (this.serverObject != null && !forceFetch) {
        return this.serverObject;
    } else {
        Optional<ServerGeoObjectType> got = ServiceFactory.getMetadataCache().getGeoObjectType(code);
        if (got.isPresent()) {
            this.serverObject = got.get();
            return this.serverObject;
        } else {
            Universal uni = TestDataSet.getUniversalIfExist(getCode());
            if (uni == null) {
                return null;
            }
            this.serverObject = new ServerGeoObjectTypeConverter().build(uni);
            return this.serverObject;
        }
    }
}
Also used : Universal(com.runwaysdk.system.gis.geo.Universal) ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType)

Example 8 with ServerGeoObjectTypeConverter

use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.

the class ServerGeoObjectType method update.

public void update(GeoObjectType geoObjectTypeNew) {
    GeoObjectType geoObjectTypeModified = this.type.copy(geoObjectTypeNew);
    Universal universal = updateGeoObjectType(geoObjectTypeModified);
    ServerGeoObjectType geoObjectTypeModifiedApplied = new ServerGeoObjectTypeConverter().build(universal);
    // If this did not error out then add to the cache
    ServiceFactory.getMetadataCache().refreshGeoObjectType(geoObjectTypeModifiedApplied);
    // isPrivate). We should refresh them as well.
    if (geoObjectTypeModifiedApplied.getIsAbstract()) {
        List<ServerGeoObjectType> subtypes = geoObjectTypeModifiedApplied.getSubtypes();
        for (ServerGeoObjectType subtype : subtypes) {
            ServerGeoObjectType refreshedSubtype = new ServerGeoObjectTypeConverter().build(subtype.getUniversal());
            ServiceFactory.getMetadataCache().refreshGeoObjectType(refreshedSubtype);
        }
    }
    this.type = geoObjectTypeModifiedApplied.getType();
    this.universal = geoObjectTypeModifiedApplied.getUniversal();
    this.mdBusiness = geoObjectTypeModifiedApplied.getMdBusiness();
}
Also used : Universal(com.runwaysdk.system.gis.geo.Universal) ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType)

Example 9 with ServerGeoObjectTypeConverter

use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.

the class ServerGeoObjectType method refreshCache.

private void refreshCache() {
    ServiceFactory.getMetadataCache().addGeoObjectType(this);
    // Refresh all of the subtypes
    List<ServerGeoObjectType> subtypes = this.getSubtypes();
    for (ServerGeoObjectType subtype : subtypes) {
        ServerGeoObjectType type = new ServerGeoObjectTypeConverter().build(subtype.getUniversal());
        ServiceFactory.getMetadataCache().addGeoObjectType(type);
    }
}
Also used : ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter)

Example 10 with ServerGeoObjectTypeConverter

use of net.geoprism.registry.conversion.ServerGeoObjectTypeConverter in project geoprism-registry by terraframe.

the class XMLImporter method addGroupItems.

private List<ServerElement> addGroupItems(Element root, ServerGeoObjectType superType) {
    List<ServerElement> list = new LinkedList<ServerElement>();
    NodeList nList = root.getElementsByTagName("group-item");
    for (int i = 0; i < nList.getLength(); i++) {
        Node nNode = nList.item(i);
        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
            Element elem = (Element) nNode;
            String code = elem.getAttribute("code");
            LocalizedValue label = this.getLabel(elem);
            LocalizedValue description = this.getDescription(elem);
            GeoObjectType type = new GeoObjectType(code, superType.getGeometryType(), label, description, superType.isGeometryEditable(), superType.getOrganization().getCode(), adapter);
            type.setSuperTypeCode(superType.getCode());
            type.setIsPrivate(superType.getIsPrivate());
            ServerGeoObjectType result = new ServerGeoObjectTypeConverter().create(type);
            list.add(result);
            this.cache.put(code, result);
        }
    }
    return list;
}
Also used : 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) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) ServerElement(net.geoprism.registry.model.ServerElement) Element(org.w3c.dom.Element) ServerElement(net.geoprism.registry.model.ServerElement) LinkedList(java.util.LinkedList)

Aggregations

ServerGeoObjectTypeConverter (net.geoprism.registry.conversion.ServerGeoObjectTypeConverter)11 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)9 Universal (com.runwaysdk.system.gis.geo.Universal)6 GeoObjectType (org.commongeoregistry.adapter.metadata.GeoObjectType)4 MdGraphClassDAOIF (com.runwaysdk.dataaccess.MdGraphClassDAOIF)3 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)2 RootGeoObjectType (net.geoprism.registry.model.RootGeoObjectType)2 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)2 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)1 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)1 MdAttributeBooleanDAO (com.runwaysdk.dataaccess.metadata.MdAttributeBooleanDAO)1 MdAttributeConcreteDAO (com.runwaysdk.dataaccess.metadata.MdAttributeConcreteDAO)1 MdAttributeDAO (com.runwaysdk.dataaccess.metadata.MdAttributeDAO)1 MdAttributeEnumerationDAO (com.runwaysdk.dataaccess.metadata.MdAttributeEnumerationDAO)1 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)1 MdGeoVertexDAO (com.runwaysdk.gis.dataaccess.metadata.graph.MdGeoVertexDAO)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 Request (com.runwaysdk.session.Request)1 Session (com.runwaysdk.session.Session)1 UniversalQuery (com.runwaysdk.system.gis.geo.UniversalQuery)1