com.orientechnologies.orient.core.sql.OCommandSQL Java Examples

The following examples show how to use com.orientechnologies.orient.core.sql.OCommandSQL. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OTaskSession.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
public void atomicChange(final String field, final Object value,final String changeCommand){
	new DBClosure<Boolean>() {
		@Override
		protected Boolean execute(ODatabaseDocument db) {
			int maxRetries = 50;
			OCommandSQL command = new OCommandSQL("update "+document.getIdentity()+" "+changeCommand);
			int retry = 0;					
			while(true){
				try {
					command.execute(value);
					break;
				} catch (OConcurrentModificationException  e) {
					retry++;
					try { Thread.sleep((long) (Math.random()*150));} catch (InterruptedException e1) {}
					if (retry>=maxRetries){
						throw e;//if all retries failed
					}
				}
			}
			document.reload();
			return true;
		}
	}.execute();
}
 
Example #2
Source File: AbstractRuleRule.java    From light with Apache License 2.0 6 votes vote down vote up
public static void loadCompileCache() {
    String sql = "SELECT FROM Rule";
    Map<String, Object> compileMap = ServiceLocator.getInstance().getMemoryImage("compileMap");
    ConcurrentMap<String, String> cache = (ConcurrentMap<String, String>)compileMap.get("cache");
    if(cache == null) {
        cache = new ConcurrentLinkedHashMap.Builder<String, String>()
                .maximumWeightedCapacity(10000)
                .build();
        compileMap.put("cache", cache);
    }
    OrientGraph graph = ServiceLocator.getInstance().getGraph();
    try {
        for (Vertex rule : (Iterable<Vertex>) graph.command(new OCommandSQL(sql)).execute()) {
            cache.put((String) rule.getProperty("ruleClass"), (String) rule.getProperty("sourceCode"));
        }
    } catch (Exception e) {
        logger.error("Exception:", e);
        throw e;
    } finally {
        graph.shutdown();
    }
}
 
Example #3
Source File: MetadataNodeEntityAdapter.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
long countGroupByQuery(final ODatabaseDocumentTx db,
                       @Nullable final String whereClause,
                       @Nullable final Map<String, Object> parameters,
                       @Nullable final Iterable<Bucket> buckets,
                       final String querySuffix)
{
  checkNotNull(querySuffix);
  checkState(containsIgnoreCase(querySuffix, "group by"));

  String query = buildQuery(true, whereClause, buckets, querySuffix);

  if (isBlank(query)) {
    log.debug("Skipped counting {}s as query is empty, parameters: {}", getTypeName(), parameters);
    return 0;
  }

  query = "select count(*) from (" + buildQuery(true, whereClause, buckets, querySuffix) + ")";

  log.debug("Counting {}s with grouped by query: {}, parameters: {}", getTypeName(), query, parameters);
  List<ODocument> results = db.command(new OCommandSQL(query)).execute(parameters);
  return results.get(0).field("count");
}
 
Example #4
Source File: ComponentDatabaseUpgrade_1_9.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
private void markNpmRepositoriesWithoutV1SearchIndexing() {
  List<String> npmRepositoryNames;
  try (ODatabaseDocumentTx db = configDatabaseInstance.get().connect()) {
    npmRepositoryNames = db.<List<ODocument>>query(new OSQLSynchQuery<ODocument>(SELECT_NPM_REPOSITORIES)).stream()
        .map(d -> (String) d.field(P_REPOSITORY_NAME))
        .collect(toList());
  }
  if (!npmRepositoryNames.isEmpty()) {
    log.info("Marking existing npm repositories as not supporting v1 search ({}).", npmRepositoryNames);
    OCommandSQL updateBucketsCommand = new OCommandSQL(UPDATE_BUCKET_ATTRIBUTES);
    int updates;
    try (ODatabaseDocumentTx db = componentDatabaseInstance.get().connect()) {
      updates = db.command(updateBucketsCommand).execute(npmRepositoryNames);
    }
    log.info("Marked {} existing npm repositories as not supporting v1 search.", updates);
  }
}
 
Example #5
Source File: BrowseNodeEntityAdapter.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Removes the {@link BrowseNode} associated with the given asset id.
 */
public void deleteAssetNode(final ODatabaseDocumentTx db, final EntityId assetId) {
  // a given asset will only appear once in the tree
  ODocument document = getFirst(
      db.command(new OCommandSQL(FIND_BY_ASSET)).execute(
          ImmutableMap.of(P_ASSET_ID, recordIdentity(assetId))), null);

  if (document != null) {
    if (document.containsField(P_COMPONENT_ID)) {
      // component still exists, just remove asset details
      document.removeField(P_ASSET_ID);
      document.save();
    }
    else {
      maybeDeleteParents(db, document.field(P_REPOSITORY_NAME), document.field(P_PARENT_PATH));
      document.delete();
    }
  }
}
 
Example #6
Source File: AssetEntityAdapter.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
Asset findByProperty(final ODatabaseDocumentTx db,
                     final String propName,
                     final Object propValue,
                     final Component component)
{
  checkNotNull(propName);
  checkNotNull(propValue);
  checkNotNull(component);

  Map<String, Object> parameters = ImmutableMap.of(
      "bucket", bucketEntityAdapter.recordIdentity(component.bucketId()),
      "component", componentEntityAdapter.recordIdentity(component),
      "propValue", propValue
  );
  String query = String.format(
      "select from %s where %s = :bucket and %s = :component and %s = :propValue",
      DB_CLASS, P_BUCKET, P_COMPONENT, propName
  );
  Iterable<ODocument> docs = db.command(new OCommandSQL(query)).execute(parameters);
  ODocument first = Iterables.getFirst(docs, null);
  return first != null ? readEntity(first) : null;
}
 
Example #7
Source File: AbstractRuleRule.java    From light with Apache License 2.0 6 votes vote down vote up
protected String getRuleMap(OrientGraph graph, String host) throws Exception {
    String sql = "SELECT FROM Rule";
    if(host != null) {
        sql = sql + " WHERE host = '" + host;
    }
    String json = null;
    try {
        Map<String, String> ruleMap = new HashMap<String, String> ();
        for (Vertex rule : (Iterable<Vertex>) graph.command(new OCommandSQL(sql)).execute()) {
            ruleMap.put((String) rule.getProperty("ruleClass"), (String) rule.getProperty("sourceCode"));
        }
        json = mapper.writeValueAsString(ruleMap);
    } catch (Exception e) {
        logger.error("Exception:", e);
        throw e;
    } finally {
        graph.shutdown();
    }
    return json;
}
 
Example #8
Source File: MetadataNodeEntityAdapter.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
private Iterable<T> browseByQuery(final ODatabaseDocumentTx db,
                                  @Nullable final String whereClause,
                                  @Nullable final Map<String, Object> parameters,
                                  @Nullable final Iterable<Bucket> buckets,
                                  @Nullable final String querySuffix,
                                  final boolean async)
{
  String query = buildQuery(false, whereClause, buckets, querySuffix);

  if (isBlank(query)) {
    log.debug("Skipped finding {}s as query is empty, parameters: {}", getTypeName(), parameters);
    return Collections.emptyList();
  }

  log.debug("Finding {}s with query: {}, parameters: {}", getTypeName(), query, parameters);

  if (async) {
    return transform(OrientAsyncHelper.asyncIterable(db, query, parameters));
  }
  else {
    Iterable<ODocument> docs = db.command(new OCommandSQL(query)).execute(parameters);
    return transform(docs);
  }
}
 
Example #9
Source File: MetadataNodeEntityAdapter.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
long countByQuery(final ODatabaseDocumentTx db,
                  @Nullable final String whereClause,
                  @Nullable final Map<String, Object> parameters,
                  @Nullable final Iterable<Bucket> buckets,
                  @Nullable final String querySuffix)
{
  String query = buildQuery(true, whereClause, buckets, querySuffix);

  if (isBlank(query)) {
    log.debug("Skipped counting {}s as query is empty, parameters: {}", getTypeName(), parameters);
    return 0;
  }

  log.debug("Counting {}s with query: {}, parameters: {}", getTypeName(), query, parameters);
  List<ODocument> results = db.command(new OCommandSQL(query)).execute(parameters);
  return results.get(0).field("count");
}
 
Example #10
Source File: SecurityDatabaseUpgrade_1_3.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void apply() {
  withDatabaseAndClass(securityDatabaseInstance, DB_CLASS, (db, type) -> {
    List<ODocument> results = db.command(new OCommandSQL(QUERY)).execute();
    results.forEach(result -> {
      Map<String, String> properties = result.field(P_PROPERTIES, OType.EMBEDDEDMAP);
      if (properties != null) {
        String actionString = properties.get(P_ACTIONS);
        if (actionString != null) {
          List<String> actions = new ArrayList(Arrays.asList(actionString.split(",")));
          if (actions.contains("add") || actions.contains("mark")) {
            actions.remove("add");
            actions.remove("mark");
            if (!actions.contains("create")) {
              actions.add("create");
            }
            properties.put(P_ACTIONS, String.join(",", actions));
            result.field(P_PROPERTIES, properties);
            log.info("Updated application privilege {} to align with CRUD actions", (String) result.field(P_NAME));
            result.save();
          }
        }
      }
    });
  });
}
 
Example #11
Source File: SecurityDatabaseUpgrade_1_3Test.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testApply() {
  try (ODatabaseDocumentTx securityDb = securityDatabase.getInstance().connect()) {
    createPrivilege("a_test_priv", "read,edit,delete,add");
    createPrivilege("b_test_priv", "mark,read,edit,delete");
    createPrivilege("c_test_priv", "create,read,edit,delete,add");
    createPrivilege("d_test_priv", "mark,read,edit,delete,create");
  }

  underTest.apply();

  try (ODatabaseDocumentTx securityDb = securityDatabase.getInstance().connect()) {
    List<ODocument> result = securityDb.command(new OCommandSQL("select from privilege")).execute();
    assertThat(result.size(), is(4));
    assertThat(result.get(0).field(P_NAME), is("a_test_priv"));
    assertThat(result.get(0).field(P_PROPERTIES), hasEntry(is("actions"), is("read,edit,delete,create")));
    assertThat(result.get(1).field(P_NAME), is("b_test_priv"));
    assertThat(result.get(1).field(P_PROPERTIES), hasEntry(is("actions"), is("read,edit,delete,create")));
    assertThat(result.get(2).field(P_NAME), is("c_test_priv"));
    assertThat(result.get(2).field(P_PROPERTIES), hasEntry(is("actions"), is("create,read,edit,delete")));
    assertThat(result.get(3).field(P_NAME), is("d_test_priv"));
    assertThat(result.get(3).field(P_PROPERTIES), hasEntry(is("actions"), is("read,edit,delete,create")));
  }
}
 
Example #12
Source File: LuceneMixIndexTest.java    From orientdb-lucene with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public void init() {

  initDB();
  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass v = schema.getClass("V");
  OClass song = schema.createClass("Song");
  song.setSuperClass(v);
  song.createProperty("title", OType.STRING);
  song.createProperty("author", OType.STRING);
  song.createProperty("lyrics", OType.STRING);

  databaseDocumentTx.command(new OCommandSQL("create index Song.author on Song (author) NOTUNIQUE")).execute();

  databaseDocumentTx.command(new OCommandSQL("create index Song.composite on Song (title,lyrics) FULLTEXT ENGINE LUCENE"))
      .execute();

  InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");

  databaseDocumentTx.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();

}
 
Example #13
Source File: LuceneFacetTest.java    From orientdb-lucene with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public void init() {
  initDB();
  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass oClass = schema.createClass("Item");

  oClass.createProperty("name", OType.STRING);
  oClass.createProperty("category", OType.STRING);

  databaseDocumentTx
      .command(
          new OCommandSQL(
              "create index Item.name_category on Item (name,category) FULLTEXT ENGINE LUCENE METADATA { 'facetFields' : ['category']}"))
      .execute();

}
 
Example #14
Source File: LuceneListIndexing.java    From orientdb-lucene with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public void init() {
  initDB();

  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass oClass = schema.createClass("City");

  OClass person = schema.createClass("Person");

  person.createProperty("name", OType.STRING);
  person.createProperty("tags", OType.EMBEDDEDLIST, OType.STRING);

  oClass.createProperty("name", OType.STRING);
  oClass.createProperty("tags", OType.EMBEDDEDLIST, OType.STRING);

  databaseDocumentTx.command(new OCommandSQL("create index City.tags on City (tags) FULLTEXT ENGINE LUCENE")).execute();

  databaseDocumentTx.command(new OCommandSQL("create index Person.name_tags on Person (name,tags) FULLTEXT ENGINE LUCENE"))
      .execute();
}
 
Example #15
Source File: LuceneSkipLimitTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
    initDB();
    OSchema schema = databaseDocumentTx.getMetadata().getSchema();
    OClass v = schema.getClass("V");
    OClass song = schema.createClass("Song");
    song.setSuperClass(v);
    song.createProperty("title", OType.STRING);
    song.createProperty("author", OType.STRING);

    databaseDocumentTx.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
    databaseDocumentTx.command(new OCommandSQL("create index Song.author on Song (author) FULLTEXT ENGINE LUCENE")).execute();

}
 
Example #16
Source File: GraphEmbeddedTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();
  graph = new OrientGraph((ODatabaseDocumentTx) databaseDocumentTx, false);
  OrientVertexType type = graph.createVertexType("City");
  type.createProperty("latitude", OType.DOUBLE);
  type.createProperty("longitude", OType.DOUBLE);
  type.createProperty("name", OType.STRING);

  databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
}
 
Example #17
Source File: LuceneManualIndex.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
public void testManualIndex() {

    databaseDocumentTx.command(new OCommandSQL("insert into index:manual (key,rid) values(['Enrico','Rome'],#5:0) ")).execute();
    databaseDocumentTx.command(new OCommandSQL("insert into index:manual (key,rid) values(['Luca','Rome'],#5:0) ")).execute();
    databaseDocumentTx.command(new OCommandSQL("insert into index:manual (key,rid) values(['Luigi','Rome'],#5:0) ")).execute();

    OIndex<?> manual = databaseDocumentTx.getMetadata().getIndexManager().getIndex("manual");

    Assert.assertEquals(manual.getSize(), 3);

    List<ODocument> docs = databaseDocumentTx.command(new OSQLSynchQuery("select from index:manual where key LUCENE 'Enrico'"))
        .execute();
    Assert.assertEquals(docs.size(), 1);
  }
 
Example #18
Source File: LuceneInsertUpdateSingleDocumentTransactionTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();
  OSchema schema = databaseDocumentTx.getMetadata().getSchema();

  if (schema.getClass("City") == null) {
    OClass oClass = schema.createClass("City");
    oClass.createProperty("name", OType.STRING);
  }
  databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();

}
 
Example #19
Source File: LuceneInsertUpdateSingleDocumentNoTxTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();
  OSchema schema = databaseDocumentTx.getMetadata().getSchema();

  if (schema.getClass("City") == null) {
    OClass oClass = schema.createClass("City");
    oClass.createProperty("name", OType.STRING);
  }
  databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();

}
 
Example #20
Source File: LuceneExportImportTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();

  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass oClass = schema.createClass("City");

  oClass.createProperty("name", OType.STRING);
  databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();

  ODocument doc = new ODocument("City");
  doc.field("name", "Rome");
  databaseDocumentTx.save(doc);
}
 
Example #21
Source File: ModuledDataInstallator.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
protected void updateOModuleSchema(ODatabaseDocument db) {
	OSchemaHelper helper = OSchemaHelper.bind(db);
	helper.oClass(IOrienteerModule.OMODULE_CLASS)
			.oProperty(IOrienteerModule.OMODULE_NAME, OType.STRING, 0).markDisplayable().markAsDocumentName()
			.oProperty(IOrienteerModule.OMODULE_VERSION, OType.INTEGER, 10).markDisplayable()
			.oProperty(IOrienteerModule.OMODULE_ACTIVATE, OType.BOOLEAN, 20).markDisplayable().defaultValue("true");
	db.command(new OCommandSQL("update "+IOrienteerModule.OMODULE_CLASS+" set "+IOrienteerModule.OMODULE_ACTIVATE+" = true where "+
									IOrienteerModule.OMODULE_ACTIVATE +" is null")).execute();
}
 
Example #22
Source File: LuceneMassiveInsertDeleteTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@Test
public void loadCloseDelete() {

  ODocument city = new ODocument("City");
  int size = 1000;
  for (int i = 0; i < size; i++) {
    city.field("name", "Rome " + i);
    databaseDocumentTx.save(city);
    city.reset();
    city.setClassName("City");
  }
  String query = "select * from City where [name] LUCENE \"(name:Rome)\"";
  List<ODocument> docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(query));
  Assert.assertEquals(docs.size(), size);

  databaseDocumentTx.close();
  databaseDocumentTx.open("admin", "admin");
  docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(query));
  Assert.assertEquals(docs.size(), size);

  databaseDocumentTx.command(new OCommandSQL("delete vertex City")).execute();

  docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(query));
  Assert.assertEquals(docs.size(), 0);

  databaseDocumentTx.close();
  databaseDocumentTx.open("admin", "admin");
  docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(query));
  Assert.assertEquals(docs.size(), 0);

  databaseDocumentTx.getMetadata().reload();
  OIndex idx = databaseDocumentTx.getMetadata().getSchema().getClass("City").getClassIndex("City.name");
  idx.flush();
  Assert.assertEquals(idx.getSize(), 0);
}
 
Example #23
Source File: LuceneInsertUpdateTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();

  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass oClass = schema.createClass("City");

  oClass.createProperty("name", OType.STRING);
  databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
}
 
Example #24
Source File: LuceneInsertDeleteTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();

  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass oClass = schema.createClass("City");

  oClass.createProperty("name", OType.STRING);
  databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
}
 
Example #25
Source File: LuceneQueryErrorTest.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() {
  initDB();
  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass v = schema.getClass("V");
  OClass song = schema.createClass("Song");
  song.setSuperClass(v);
  song.createProperty("title", OType.STRING);
  song.createProperty("author", OType.STRING);

  databaseDocumentTx.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();

}
 
Example #26
Source File: WicketOrientDbFilterTesterScope.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
private void deleteClassesAndDocuments(final List<OClass> classes) {
     new DBClosure<Void>() {

private static final long serialVersionUID = 1L;

@Override
         protected Void execute(ODatabaseDocument db) {
             for (OClass oClass : classes) {
                 db.command(new OCommandSQL("DELETE FROM " + oClass.getName())).execute();
                 db.getMetadata().getSchema().dropClass(oClass.getName());
             }
             return null;
         }
     }.execute();
 }
 
Example #27
Source File: OrientComponentAssetTestHelper.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public List<String> findAssetPaths(final String repositoryName) {
  String sql = "SELECT * FROM asset WHERE bucket.repository_name = ?";
  try (ODatabaseDocumentTx tx = databaseInstanceProvider.get().acquire()) {
    tx.begin();
    List<ODocument> results = tx.command(new OCommandSQL(sql)).execute(repositoryName);
    return results.stream().map(doc -> doc.field("name", String.class).toString()).collect(toList());
  }
}
 
Example #28
Source File: SecurityDatabaseUpgrade_1_2.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void apply() {
  withDatabaseAndClass(securityDatabaseInstance, DB_CLASS, (db, type) -> {
    int updates = db.command(new OCommandSQL(QUERY)).execute(ADMIN_PASS);
    if (updates > 0) {
      log.info("Updated admin user status to 'changepassword'.");
    }
  });
}
 
Example #29
Source File: OrientBlobstoreRestoreTestHelper.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void executeSqlStatements(final String... sqlStatements) {
  try (ODatabaseDocumentTx db = componentDb.get().connect()) {
    for (String sqlStatement : sqlStatements) {
      db.command(new OCommandSQL(sqlStatement)).execute();
    }
  }
}
 
Example #30
Source File: AbstractFormRule.java    From light with Apache License 2.0 5 votes vote down vote up
protected String getFormMap(String host) throws Exception {
    String sql = "SELECT FROM Form";
    if(host != null) {
        sql = sql + " WHERE host = '" + host + "' OR host IS NULL";
    }
    String json = null;
    OrientGraph graph = ServiceLocator.getInstance().getGraph();
    try {
        Map<String, Map<String, Object>> formMap = new HashMap<String, Map<String, Object>>();
        for (Vertex v : (Iterable<Vertex>) graph.command(
                new OCommandSQL(sql)).execute()) {
            Map<String, Object> contentMap = new HashMap<String, Object>();
            contentMap.put("action", v.getProperty("action"));
            contentMap.put("schema", v.getProperty("schema"));
            contentMap.put("form", v.getProperty("form"));
            contentMap.put("modelData", v.getProperty("modelData"));
            formMap.put(v.getProperty("formId"), contentMap);
        }
        json = mapper.writeValueAsString(formMap);
    } catch (Exception e) {
        logger.error("Exception:", e);
        throw e;
    } finally {
        graph.shutdown();
    }
    return json;
}