Search in sources :

Example 1 with GraphRequest

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

the class CRAttributePatch method executeGraphDDLCommand.

public void executeGraphDDLCommand(String sql) {
    GraphDBService service = GraphDBService.getInstance();
    GraphRequest dml = service.getGraphDBRequest();
    GraphRequest ddl = service.getDDLGraphDBRequest();
    GraphDDLCommandAction action = service.ddlCommand(dml, ddl, sql, new HashMap<String, Object>());
    action.execute();
}
Also used : GraphRequest(com.runwaysdk.dataaccess.graph.GraphRequest) GraphDDLCommandAction(com.runwaysdk.dataaccess.graph.GraphDDLCommandAction) VertexObject(com.runwaysdk.business.graph.VertexObject) GraphDBService(com.runwaysdk.dataaccess.graph.GraphDBService)

Example 2 with GraphRequest

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

the class CreateEventSequencePatch method doIt.

@Request
private void doIt() {
    StringBuilder statement = new StringBuilder();
    statement.append("CREATE SEQUENCE " + TransitionEvent.EVENT_SEQUENCE + " TYPE ORDERED");
    GraphDBService service = GraphDBService.getInstance();
    GraphRequest graphRequest = service.getGraphDBRequest();
    service.command(graphRequest, statement.toString(), new HashedMap<>());
}
Also used : GraphRequest(com.runwaysdk.dataaccess.graph.GraphRequest) GraphDBService(com.runwaysdk.dataaccess.graph.GraphDBService) GraphRequest(com.runwaysdk.dataaccess.graph.GraphRequest) Request(com.runwaysdk.session.Request)

Example 3 with GraphRequest

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

the class SearchService method clear.

@Transaction
public void clear() {
    String suffix = this.getSuffix();
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(PACKAGE + "." + VERTEX_PREFIX + suffix);
    StringBuilder statement = new StringBuilder();
    statement.append("DELETE VERTEX " + mdVertex.getDBClassName());
    GraphDBService service = GraphDBService.getInstance();
    GraphRequest request = service.getGraphDBRequest();
    service.command(request, statement.toString(), new HashMap<>());
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) GraphRequest(com.runwaysdk.dataaccess.graph.GraphRequest) GraphDBService(com.runwaysdk.dataaccess.graph.GraphDBService) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 4 with GraphRequest

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

the class SearchService method clear.

// @Transaction
public void clear(String vertexType) {
    String suffix = this.getSuffix();
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(PACKAGE + "." + VERTEX_PREFIX + suffix);
    MdAttributeDAOIF mdVertexType = mdVertex.definesAttribute(VERTEX_TYPE);
    StringBuilder statement = new StringBuilder();
    statement.append("DELETE VERTEX " + mdVertex.getDBClassName());
    statement.append(" WHERE " + mdVertexType.getColumnName() + " = :vertexType");
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("vertexType", vertexType);
    GraphDBService service = GraphDBService.getInstance();
    GraphRequest request = service.getGraphDBRequest();
    GraphRequest ddlRequest = service.getDDLGraphDBRequest();
    service.ddlCommand(request, ddlRequest, statement.toString(), parameters);
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) GraphRequest(com.runwaysdk.dataaccess.graph.GraphRequest) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) HashMap(java.util.HashMap) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GraphDBService(com.runwaysdk.dataaccess.graph.GraphDBService)

Example 5 with GraphRequest

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

the class SearchService method createSearchTable.

@Transaction
public void createSearchTable() {
    String suffix = this.getSuffix();
    String typeName = VERTEX_PREFIX + suffix;
    MdVertexDAO mdVertex = MdVertexDAO.newInstance();
    mdVertex.setValue(MdVertexInfo.PACKAGE, PACKAGE);
    mdVertex.setValue(MdVertexInfo.NAME, typeName);
    mdVertex.setValue(MdVertexInfo.GENERATE_SOURCE, MdAttributeBooleanInfo.FALSE);
    mdVertex.apply();
    MdAttributeTextDAO label = MdAttributeTextDAO.newInstance();
    label.setValue(MdAttributeTextInfo.NAME, LABEL);
    label.setValue(MdAttributeTextInfo.DEFINING_MD_CLASS, mdVertex.getOid());
    label.apply();
    MdAttributeTextDAO code = MdAttributeTextDAO.newInstance();
    code.setValue(MdAttributeTextInfo.NAME, CODE);
    code.setValue(MdAttributeTextInfo.DEFINING_MD_CLASS, mdVertex.getOid());
    code.setValue(MdAttributeTextInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
    code.apply();
    MdAttributeTextDAO vertexType = MdAttributeTextDAO.newInstance();
    vertexType.setValue(MdAttributeTextInfo.NAME, VERTEX_TYPE);
    vertexType.setValue(MdAttributeTextInfo.DEFINING_MD_CLASS, mdVertex.getOid());
    vertexType.setValue(MdAttributeTextInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
    vertexType.apply();
    MdAttributeDateDAO startDate = MdAttributeDateDAO.newInstance();
    startDate.setValue(MdAttributeTextInfo.NAME, START_DATE);
    startDate.setValue(MdAttributeTextInfo.DEFINING_MD_CLASS, mdVertex.getOid());
    startDate.setValue(MdAttributeTextInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
    startDate.apply();
    MdAttributeDateDAO endDate = MdAttributeDateDAO.newInstance();
    endDate.setValue(MdAttributeTextInfo.NAME, END_DATE);
    endDate.setValue(MdAttributeTextInfo.DEFINING_MD_CLASS, mdVertex.getOid());
    endDate.setValue(MdAttributeTextInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
    endDate.apply();
    MdEdgeDAO mdEdge = MdEdgeDAO.newInstance();
    mdEdge.setValue(MdVertexInfo.PACKAGE, PACKAGE);
    mdEdge.setValue(MdVertexInfo.NAME, EDGE_PREFIX + suffix);
    mdEdge.setValue(MdEdgeInfo.PARENT_MD_VERTEX, mdVertex.getOid());
    mdEdge.setValue(MdEdgeInfo.CHILD_MD_VERTEX, MdVertexDAO.getMdVertexDAO(GeoVertex.CLASS).getOid());
    mdEdge.apply();
    GraphDBService service = GraphDBService.getInstance();
    GraphRequest dml = service.getGraphDBRequest();
    GraphRequest ddl = service.getDDLGraphDBRequest();
    String attributeName = label.getValue(MdAttributeTextInfo.NAME);
    String className = mdVertex.getDBClassName();
    String indexName = className + "." + attributeName;
    String statement = "CREATE INDEX " + indexName + " ON " + className + "(" + attributeName + ") FULLTEXT ENGINE LUCENE";
    GraphDDLCommandAction action = service.ddlCommand(dml, ddl, statement, new HashMap<String, Object>());
    action.execute();
    this.assignAllPermissions(Roles.findRoleByName(RegistryConstants.REGISTRY_SUPER_ADMIN_ROLE), mdVertex, mdEdge);
    this.assignAllPermissions(Roles.findRoleByName(RegistryConstants.REGISTRY_ADMIN_ROLE), mdVertex, mdEdge);
    this.assignAllPermissions(Roles.findRoleByName(RegistryConstants.REGISTRY_MAINTAINER_ROLE), mdVertex, mdEdge);
}
Also used : MdAttributeTextDAO(com.runwaysdk.dataaccess.metadata.MdAttributeTextDAO) GraphRequest(com.runwaysdk.dataaccess.graph.GraphRequest) MdAttributeDateDAO(com.runwaysdk.dataaccess.metadata.MdAttributeDateDAO) MdEdgeDAO(com.runwaysdk.dataaccess.metadata.graph.MdEdgeDAO) GraphDDLCommandAction(com.runwaysdk.dataaccess.graph.GraphDDLCommandAction) MdVertexDAO(com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GraphDBService(com.runwaysdk.dataaccess.graph.GraphDBService) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

GraphDBService (com.runwaysdk.dataaccess.graph.GraphDBService)5 GraphRequest (com.runwaysdk.dataaccess.graph.GraphRequest)5 VertexObject (com.runwaysdk.business.graph.VertexObject)3 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)2 GraphDDLCommandAction (com.runwaysdk.dataaccess.graph.GraphDDLCommandAction)2 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)2 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)2 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)1 MdAttributeDateDAO (com.runwaysdk.dataaccess.metadata.MdAttributeDateDAO)1 MdAttributeTextDAO (com.runwaysdk.dataaccess.metadata.MdAttributeTextDAO)1 MdEdgeDAO (com.runwaysdk.dataaccess.metadata.graph.MdEdgeDAO)1 MdVertexDAO (com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO)1 Request (com.runwaysdk.session.Request)1 HashMap (java.util.HashMap)1