public Document create(String database,String table,String json) throws IndexParseException {
  verifyTable(database,table);
  Document doc=new Document();
  doc.setTable(database,table);
  doc.setObjectAsString(json);
  doc.setUuid(UUID.randomUUID());
  ValidationEngine.validateAndThrow(doc);
  try {
    Document created=docRepo.create(doc);
    notifyAllPlugins(NotifierPlugin.MutateType.CREATE,created);
    return created;
  }
 catch (  RuntimeException e) {
    if (e.getCause() != null && e.getCause() instanceof IndexParseException) {
      throw (IndexParseException)e.getCause();
    }
 else {
      throw e;
    }
  }
}

public Document create ( String database , String table , String json ) throws IndexParseException { verifyTable ( database , table ) ; Document doc = new Document ( ) ; doc . setTable ( database , table ) ; doc . setObjectAsString ( json ) ; doc . setUuid ( UUID . randomUUID ( ) ) ; ValidationEngine . validateAndThrow ( doc ) ; try { Document created = docRepo . create ( doc ) ; notifyAllPlugins ( NotifierPlugin . MutateType . CREATE , created ) ; return created ; } catch ( RuntimeException e ) { if ( e . getCause ( ) != null && e . getCause ( ) instanceof IndexParseException ) { throw ( IndexParseException ) e . getCause ( ) ; } else { throw e ; } } }
creates a document , ensuring that all business rules are met .
