Search in sources :

Example 36 with MdVertexDAOIF

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

the class ExternalSystem method getByExternalSystemId.

public static ExternalSystem getByExternalSystemId(String id) {
    final MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(ExternalSystem.CLASS);
    MdAttributeDAOIF attribute = mdVertex.definesAttribute(ExternalSystem.ID);
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT FROM " + mdVertex.getDBClassName());
    builder.append(" WHERE " + attribute.getColumnName() + " = :id");
    final GraphQuery<ExternalSystem> query = new GraphQuery<ExternalSystem>(builder.toString());
    query.setParameter("id", id);
    ExternalSystem es = query.getSingleResult();
    if (es == null) {
        net.geoprism.registry.DataNotFoundException ex = new net.geoprism.registry.DataNotFoundException();
        ex.setDataIdentifier(id);
        ex.setTypeLabel(mdVertex.getDisplayLabel(Session.getCurrentLocale()));
        ex.setAttributeLabel(attribute.getDisplayLabel(Session.getCurrentLocale()));
        throw ex;
    }
    return es;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 37 with MdVertexDAOIF

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

the class ExternalSystem method getForOrganization.

public static List<ExternalSystem> getForOrganization(Organization organization) {
    final MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(ExternalSystem.CLASS);
    MdAttributeDAOIF oAttribute = mdVertex.definesAttribute(ExternalSystem.ORGANIZATION);
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT FROM " + mdVertex.getDBClassName());
    builder.append(" WHERE " + oAttribute.getColumnName() + " = :org");
    builder.append(" ORDER BY id");
    final GraphQuery<ExternalSystem> query = new GraphQuery<ExternalSystem>(builder.toString());
    query.setParameter("org", organization.getOid());
    return query.getResults();
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 38 with MdVertexDAOIF

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

the class ExternalSystem method getCount.

public static long getCount() {
    List<Organization> organizations = Organization.getUserAdminOrganizations();
    if (organizations.size() > 0) {
        final MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(ExternalSystem.CLASS);
        MdAttributeDAOIF oAttribute = mdVertex.definesAttribute(ExternalSystem.ORGANIZATION);
        StringBuilder builder = new StringBuilder();
        builder.append("SELECT COUNT(*) FROM " + mdVertex.getDBClassName());
        for (int i = 0; i < organizations.size(); i++) {
            if (i == 0) {
                builder.append(" WHERE " + oAttribute.getColumnName() + " = :org" + i);
            } else {
                builder.append(" OR " + oAttribute.getColumnName() + " = :org" + i);
            }
        }
        final GraphQuery<Long> query = new GraphQuery<Long>(builder.toString());
        for (int i = 0; i < organizations.size(); i++) {
            Organization organization = organizations.get(i);
            query.setParameter("org" + i, organization.getOid());
        }
        return query.getSingleResult();
    }
    return 0L;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) Organization(net.geoprism.registry.Organization) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 39 with MdVertexDAOIF

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

the class FhirExternalSystem method getAll.

public static List<FhirExternalSystem> getAll() {
    final MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(FhirExternalSystem.CLASS);
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT FROM " + mdVertex.getDBClassName());
    final GraphQuery<FhirExternalSystem> query = new GraphQuery<FhirExternalSystem>(builder.toString());
    return query.getResults();
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 40 with MdVertexDAOIF

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

the class GeoVertexType method create.

/**
 * @param code
 * @param ownerActorId
 *          = the ID of the {@link ActorDAOIF} that is the owner of the
 *          {@link MdGeoVertexDAOIF}.
 * @param isAbstract
 *          TODO
 * @param parentType
 *          TODO
 * @return
 */
public static MdGeoVertexDAO create(String code, String ownerActorId, Boolean isAbstract, ServerGeoObjectType parentType) {
    MdVertexDAOIF parentVertexDAO = null;
    if (parentType == null) {
        parentVertexDAO = MdGeoVertexDAO.getMdGeoVertexDAO(GeoVertex.CLASS);
    } else {
        parentVertexDAO = parentType.getMdVertex();
    }
    MdGeoVertexDAO child = MdGeoVertexDAO.newInstance();
    child.setValue(MdGeoVertexInfo.PACKAGE, RegistryConstants.UNIVERSAL_GRAPH_PACKAGE);
    child.setValue(MdGeoVertexInfo.NAME, code);
    child.setValue(MdGeoVertexInfo.SUPER_MD_VERTEX, parentVertexDAO.getOid());
    child.setValue(MdGeoVertexInfo.ENABLE_CHANGE_OVER_TIME, MdAttributeBooleanInfo.TRUE);
    child.setValue(MdGeoVertexInfo.GENERATE_SOURCE, MdAttributeBooleanInfo.FALSE);
    child.setValue(MdGeoVertexInfo.OWNER, ownerActorId);
    child.setValue(MdGeoVertexInfo.ABSTRACT, isAbstract.toString());
    child.apply();
    return child;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdGeoVertexDAO(com.runwaysdk.gis.dataaccess.metadata.graph.MdGeoVertexDAO)

Aggregations

MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)62 GraphQuery (com.runwaysdk.business.graph.GraphQuery)34 VertexObject (com.runwaysdk.business.graph.VertexObject)30 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)26 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)24 EdgeObject (com.runwaysdk.business.graph.EdgeObject)16 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)12 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)11 Date (java.util.Date)10 LinkedList (java.util.LinkedList)9 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)8 JsonObject (com.google.gson.JsonObject)7 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)7 HashedMap (org.apache.commons.collections4.map.HashedMap)7 HashMap (java.util.HashMap)5 TreeSet (java.util.TreeSet)5 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)5 GraphObject (com.runwaysdk.business.graph.GraphObject)4 MdVertexDAO (com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO)4 LineString (com.vividsolutions.jts.geom.LineString)4