use of com.runwaysdk.dataaccess.graph.GraphDDLCommandAction 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();
}
use of com.runwaysdk.dataaccess.graph.GraphDDLCommandAction 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);
}
Aggregations