Search in sources :

Example 1 with MdGeoVertexDAOIF

use of com.runwaysdk.gis.dataaccess.MdGeoVertexDAOIF in project geoprism-registry by terraframe.

the class PatchExistsAndInvalid method getUniversals.

// private void patchMasterlistVersions()
// {
// final Collection<Locale> locales = LocalizationFacade.getInstalledLocales();
// 
// MasterListVersionQuery query = new MasterListVersionQuery(new QueryFactory());
// 
// try (OIterator<? extends MasterListVersion> it = query.getIterator())
// {
// for (MasterListVersion version : it)
// {
// ServerGeoObjectType type = version.getMasterlist().getGeoObjectType();
// 
// // Patch metadata
// AttributeType existsAttr = type.getAttribute(DefaultAttribute.EXISTS.getName()).get();
// MdAttribute existsMdAttr = MasterListVersion.createMdAttributeFromAttributeType(version, type, existsAttr, locales).getPairs().keySet().iterator().next();
// 
// AttributeType invalidAttr = type.getAttribute(DefaultAttribute.INVALID.getName()).get();
// MdAttribute invalidMdAttr = MasterListVersion.createMdAttributeFromAttributeType(version, type, invalidAttr, locales).getPairs().keySet().iterator().next();
// 
// 
// 
// // Patch instance data
// MdBusiness table = version.getMdBusiness();
// 
// String statement = "UPDATE " + table.getTableName() + " SET " + existsMdAttr.getColumnName() + " = " +
// 
// Database.executeStatement(statement);
// }
// }
// }
// private void patchMasterlistVersions(ServerGeoObjectType type)
// {
// AttributeType existsAttr = type.getAttribute(DefaultAttribute.EXISTS.getName()).get();
// MasterList.createMdAttribute(type, existsAttr);
// 
// AttributeType invalidAttr = type.getAttribute(DefaultAttribute.INVALID.getName()).get();
// MasterList.createMdAttribute(type, invalidAttr);
// }
public static List<Universal> getUniversals() {
    QueryFactory qf = new QueryFactory();
    UniversalQuery uq = new UniversalQuery(qf);
    @SuppressWarnings("unchecked") List<Universal> unis = (List<Universal>) uq.getIterator().getAll();
    Iterator<Universal> it = unis.iterator();
    while (it.hasNext()) {
        Universal uni = it.next();
        if (uni.getKey().equals(Universal.ROOT_KEY)) {
            it.remove();
            continue;
        }
        MdGeoVertexDAOIF superType = GeoVertexType.getMdGeoVertex(uni.getUniversalId()).getSuperClass();
        if (superType != null && !superType.definesType().equals(GeoVertex.CLASS)) {
            it.remove();
            continue;
        }
    }
    return unis;
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) Universal(com.runwaysdk.system.gis.geo.Universal) MdGeoVertexDAOIF(com.runwaysdk.gis.dataaccess.MdGeoVertexDAOIF) LinkedList(java.util.LinkedList) MasterList(net.geoprism.registry.MasterList) List(java.util.List) UniversalQuery(com.runwaysdk.system.gis.geo.UniversalQuery)

Example 2 with MdGeoVertexDAOIF

use of com.runwaysdk.gis.dataaccess.MdGeoVertexDAOIF in project geoprism-registry by terraframe.

the class ServerGeoObjectTypeConverter method build.

public ServerGeoObjectType build(Universal universal) {
    MdBusiness mdBusiness = universal.getMdBusiness();
    MdGeoVertexDAO mdVertex = GeoVertexType.getMdGeoVertex(universal.getUniversalId());
    com.runwaysdk.system.gis.geo.GeometryType geoPrismgeometryType = universal.getGeometryType().get(0);
    org.commongeoregistry.adapter.constants.GeometryType cgrGeometryType = GeometryTypeFactory.get(geoPrismgeometryType);
    LocalizedValue label = convert(universal.getDisplayLabel());
    LocalizedValue description = convert(universal.getDescription());
    String ownerActerOid = universal.getOwnerOid();
    String organizationCode = Organization.getRootOrganizationCode(ownerActerOid);
    MdGeoVertexDAOIF superType = mdVertex.getSuperClass();
    GeoObjectType geoObjType = new GeoObjectType(universal.getUniversalId(), cgrGeometryType, label, description, universal.getIsGeometryEditable(), organizationCode, ServiceFactory.getAdapter());
    geoObjType.setIsAbstract(mdBusiness.getIsAbstract());
    try {
        GeoObjectTypeMetadata metadata = GeoObjectTypeMetadata.getByKey(universal.getKey());
        geoObjType.setIsPrivate(metadata.getIsPrivate());
    } catch (DataNotFoundException | AttributeDoesNotExistException e) {
        geoObjType.setIsPrivate(false);
    }
    if (superType != null && !superType.definesType().equals(GeoVertex.CLASS)) {
        String parentCode = superType.getTypeName();
        geoObjType.setSuperTypeCode(parentCode);
    }
    geoObjType = this.convertAttributeTypes(universal, geoObjType, mdBusiness);
    return new ServerGeoObjectType(geoObjType, universal, mdBusiness, mdVertex);
}
Also used : GeoObjectTypeMetadata(net.geoprism.registry.model.GeoObjectTypeMetadata) DataNotFoundException(com.runwaysdk.dataaccess.cache.DataNotFoundException) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) MdGeoVertexDAOIF(com.runwaysdk.gis.dataaccess.MdGeoVertexDAOIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeDoesNotExistException(com.runwaysdk.dataaccess.AttributeDoesNotExistException) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) MdGeoVertexDAO(com.runwaysdk.gis.dataaccess.metadata.graph.MdGeoVertexDAO)

Aggregations

MdGeoVertexDAOIF (com.runwaysdk.gis.dataaccess.MdGeoVertexDAOIF)2 AttributeDoesNotExistException (com.runwaysdk.dataaccess.AttributeDoesNotExistException)1 DataNotFoundException (com.runwaysdk.dataaccess.cache.DataNotFoundException)1 MdGeoVertexDAO (com.runwaysdk.gis.dataaccess.metadata.graph.MdGeoVertexDAO)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 Universal (com.runwaysdk.system.gis.geo.Universal)1 UniversalQuery (com.runwaysdk.system.gis.geo.UniversalQuery)1 MdBusiness (com.runwaysdk.system.metadata.MdBusiness)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 MasterList (net.geoprism.registry.MasterList)1 GeoObjectTypeMetadata (net.geoprism.registry.model.GeoObjectTypeMetadata)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)1 GeoObjectType (org.commongeoregistry.adapter.metadata.GeoObjectType)1