Search in sources :

Example 16 with Business

use of com.runwaysdk.business.Business in project geoprism-registry by terraframe.

the class ListTypeShapefileExporter method features.

public FeatureCollection<SimpleFeatureType, SimpleFeature> features(SimpleFeatureType featureType) {
    List<SimpleFeature> features = new ArrayList<SimpleFeature>();
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
    BusinessQuery query = this.version.buildQuery(this.criteria);
    query.ORDER_BY_DESC(query.aCharacter(DefaultAttribute.CODE.getName()));
    OIterator<Business> objects = query.getIterator();
    try {
        while (objects.hasNext()) {
            Business row = objects.next();
            builder.set(GEOM, row.getObjectValue(RegistryConstants.GEOMETRY_ATTRIBUTE_NAME));
            for (MdAttributeConcreteDAOIF mdAttribute : mdAttributes) {
                String attributeName = mdAttribute.definesAttribute();
                Object value = row.getObjectValue(attributeName);
                if (value != null) {
                    builder.set(this.getColumnName(attributeName), value);
                }
            }
            SimpleFeature feature = builder.buildFeature(row.getValue(DefaultAttribute.CODE.getName()));
            features.add(feature);
        }
    } finally {
        objects.close();
    }
    return new ListFeatureCollection(featureType, features);
}
Also used : BusinessQuery(com.runwaysdk.business.BusinessQuery) ArrayList(java.util.ArrayList) ListFeatureCollection(org.geotools.data.collection.ListFeatureCollection) JsonObject(com.google.gson.JsonObject) GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) SimpleFeature(org.opengis.feature.simple.SimpleFeature) SimpleFeatureBuilder(org.geotools.feature.simple.SimpleFeatureBuilder) Business(com.runwaysdk.business.Business) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Example 17 with Business

use of com.runwaysdk.business.Business in project geoprism-registry by terraframe.

the class TestGeoObjectInfo method deleteInTrans.

// @Transaction
// private void deleteInTrans()
// {
// if (this.testDataSet.debugMode >= 1)
// {
// System.out.println("Deleting TestGeoObjectInfo [" + this.getCode() + "].");
// }
// 
// ServerGeoObjectIF serverGO = this.getServerObject();
// 
// if (serverGO != null)
// {
// serverGO.delete();
// }
// 
// this.children.clear();
// 
// this.business = null;
// this.geoEntity = null;
// }
// 
// private ServerGeoObjectIF getServerObject()
// {
// 
// }
@Transaction
private void deleteInTrans() {
    // geoEntity it nulls out the reference in the table.
    if (this.getGeoObjectType() != null && this.getGeoObjectType().getUniversal() != null) {
        QueryFactory qf = new QueryFactory();
        BusinessQuery bq = qf.businessQuery(this.getGeoObjectType().getUniversal().getMdBusiness().definesType());
        bq.WHERE(bq.aCharacter(DefaultAttribute.CODE.getName()).EQ(this.getCode()));
        OIterator<? extends Business> bit = bq.getIterator();
        try {
            while (bit.hasNext()) {
                Business biz = bit.next();
                biz.delete();
            }
        } finally {
            bit.close();
        }
    }
    TestDataSet.deleteGeoEntity(this.getCode());
    // if (this.serverGO instanceof CompositeServerGeoObject)
    // {
    // ((CompositeServerGeoObject)this.serverGO).getVertex().getVertex().delete();
    // }
    // else if (this.serverGO instanceof VertexServerGeoObject)
    // {
    // ((VertexServerGeoObject)this.serverGO).getVertex().delete();
    // }
    ServerGeoObjectType serverGOTT = this.geoObjectType.getServerObject();
    if (serverGOTT != null) {
        VertexObject vertex = VertexServerGeoObject.getVertexByCode(serverGOTT, this.getCode());
        if (vertex != null) {
            vertex.delete();
        }
    }
    this.children.clear();
    this.isNew = true;
}
Also used : BusinessQuery(com.runwaysdk.business.BusinessQuery) QueryFactory(com.runwaysdk.query.QueryFactory) VertexObject(com.runwaysdk.business.graph.VertexObject) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) Business(com.runwaysdk.business.Business) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

Business (com.runwaysdk.business.Business)17 BusinessQuery (com.runwaysdk.business.BusinessQuery)12 MdBusiness (com.runwaysdk.system.metadata.MdBusiness)8 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)8 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)7 LinkedList (java.util.LinkedList)7 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)6 List (java.util.List)6 Locale (java.util.Locale)6 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)6 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)6 JsonObject (com.google.gson.JsonObject)5 QueryFactory (com.runwaysdk.query.QueryFactory)5 MdAttributeConcreteDAOIF (com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)4 Date (java.util.Date)4 Point (com.vividsolutions.jts.geom.Point)3 ArrayList (java.util.ArrayList)3 JsonArray (com.google.gson.JsonArray)2 VertexObject (com.runwaysdk.business.graph.VertexObject)2 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)2