@Test
  public void testInsertUpdateTransactionWithIndex() throws Exception {

    databaseDocumentTx.close();
    databaseDocumentTx.open("admin", "admin");
    OSchema schema = databaseDocumentTx.getMetadata().getSchema();
    schema.reload();
    databaseDocumentTx.begin();
    ODocument doc = new ODocument("City");
    doc.field("name", "");
    ODocument doc1 = new ODocument("City");
    doc1.field("name", "");
    doc = databaseDocumentTx.save(doc);
    doc1 = databaseDocumentTx.save(doc1);
    databaseDocumentTx.commit();
    databaseDocumentTx.begin();
    doc = databaseDocumentTx.load(doc);
    doc1 = databaseDocumentTx.load(doc1);
    doc.field("name", "Rome");
    doc1.field("name", "Rome");
    databaseDocumentTx.save(doc);
    databaseDocumentTx.save(doc1);
    databaseDocumentTx.commit();
    OIndex idx = schema.getClass("City").getClassIndex("City.name");
    Collection<?> coll = (Collection<?>) idx.get("Rome");
    Assert.assertEquals(coll.size(), 2);
    Assert.assertEquals(idx.getSize(), 2);
  }
Ejemplo n.º 2
0
  public void testUpdateEdgeContent() {
    final OSchema schema = database.getMetadata().getSchema();
    OClass vertex = schema.getClass("V");
    OClass edge = schema.getClass("E");

    schema.createClass("UpdateEdgeContentV", vertex);
    schema.createClass("UpdateEdgeContentE", edge);

    final ORID vOneId =
        ((ODocument)
                database.command(new OCommandSQL("create vertex UpdateEdgeContentV")).execute())
            .getIdentity();
    final ORID vTwoId =
        ((ODocument)
                database.command(new OCommandSQL("create vertex UpdateEdgeContentV")).execute())
            .getIdentity();

    database
        .command(new OCommandSQL("create edge UpdateEdgeContentE from " + vOneId + " to " + vTwoId))
        .execute();
    database
        .command(new OCommandSQL("create edge UpdateEdgeContentE from " + vOneId + " to " + vTwoId))
        .execute();
    database
        .command(new OCommandSQL("create edge UpdateEdgeContentE from " + vOneId + " to " + vTwoId))
        .execute();

    List<ODocument> result =
        database.query(
            new OSQLSynchQuery<ODocument>("select outV(), inV() from UpdateEdgeContentE"));

    Assert.assertEquals(result.size(), 3);

    for (ODocument doc : result) {
      Assert.assertEquals(doc.field("outV"), vOneId);
      Assert.assertEquals(doc.field("inV"), vTwoId);
    }

    database
        .command(new OCommandSQL("update UpdateEdgeContentE content {value : 'val'}"))
        .execute();

    result =
        database.query(
            new OSQLSynchQuery<ODocument>("select outV(), inV() from UpdateEdgeContentE"));

    Assert.assertEquals(result.size(), 3);

    for (ODocument doc : result) {
      Assert.assertEquals(doc.field("outV"), vOneId);
      Assert.assertEquals(doc.field("inV"), vTwoId);
    }

    result = database.query(new OSQLSynchQuery<ODocument>("select from UpdateEdgeContentE"));
    Assert.assertEquals(result.size(), 3);
    for (ODocument doc : result) {
      Assert.assertEquals(doc.field("value"), "val");
    }
  }
Ejemplo n.º 3
0
  public void testUpdateVertexContent() {
    final OSchema schema = database.getMetadata().getSchema();
    OClass vertex = schema.getClass("V");
    schema.createClass("UpdateVertexContent", vertex);

    final ORID vOneId =
        ((ODocument)
                database.command(new OCommandSQL("create vertex UpdateVertexContent")).execute())
            .getIdentity();
    final ORID vTwoId =
        ((ODocument)
                database.command(new OCommandSQL("create vertex UpdateVertexContent")).execute())
            .getIdentity();

    database.command(new OCommandSQL("create edge from " + vOneId + " to " + vTwoId)).execute();
    database.command(new OCommandSQL("create edge from " + vOneId + " to " + vTwoId)).execute();
    database.command(new OCommandSQL("create edge from " + vOneId + " to " + vTwoId)).execute();

    List<ODocument> result =
        database.query(
            new OSQLSynchQuery<ODocument>(
                "select sum(outE().size(), inE().size()) from UpdateVertexContent"));

    Assert.assertEquals(result.size(), 2);

    for (ODocument doc : result) {
      Assert.assertEquals(doc.field("sum"), 3);
    }

    database
        .command(
            new OCommandSQL(
                "update UpdateVertexContent content {value : 'val'} where @rid = " + vOneId))
        .execute();
    database
        .command(
            new OCommandSQL(
                "update UpdateVertexContent content {value : 'val'} where @rid =  " + vTwoId))
        .execute();

    result =
        database.query(
            new OSQLSynchQuery<ODocument>(
                "select sum(outE().size(), inE().size()) from UpdateVertexContent"));

    Assert.assertEquals(result.size(), 2);

    for (ODocument doc : result) {
      Assert.assertEquals(doc.field("sum"), 3);
    }

    result = database.query(new OSQLSynchQuery<ODocument>("select from UpdateVertexContent"));
    Assert.assertEquals(result.size(), 2);
    for (ODocument doc : result) {
      Assert.assertEquals(doc.field("value"), "val");
    }
  }
 @Override
 protected Object handleGet(String propName, Class<?> returnType) {
   if ("ownerClass".equals(propName)) {
     OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema();
     return schema.getClass(className);
   } else if ("fullName".equals(propName)) {
     return className + "." + values.get(NAME);
   } else return super.handleGet(propName, returnType);
 }
  @Before
  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();
  }
Ejemplo n.º 6
0
  @BeforeClass
  public void beforeClass() {
    database = new ODatabaseDocumentTx(url);

    if (database.isClosed()) database.open("admin", "admin");

    final OSchema schema = database.getMetadata().getSchema();
    final OClass oClass = schema.createClass("SQLDropIndexTestClass");
    oClass.createProperty("prop1", EXPECTED_PROP1_TYPE);
    oClass.createProperty("prop2", EXPECTED_PROP2_TYPE);

    schema.save();
  }
  @Before
  public void init() {
    initDB();
    OSchema schema = databaseDocumentTx.getMetadata().getSchema();
    OClass v = schema.getClass("V");
    OClass song = schema.createClass("City");
    song.setSuperClass(v);
    song.createProperty("name", OType.STRING);

    databaseDocumentTx
        .command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE"))
        .execute();
  }
Ejemplo n.º 8
0
  public static void drop(OSchema schema) {
    OClass oClass = schema.getClass("Comment");
    if (oClass != null) {
      // Indexes
      Set<OIndex<?>> idxs = oClass.getIndexes();
      if (idxs != null && idxs.size() > 0) {
        for (OIndex<?> idx : idxs) {
          idx.delete();
        }
      }

      // class
      schema.dropClass("Comment");
    }
  }
  @BeforeClass
  @Override
  public void init() {
    super.init();
    OSchema schema = databaseDocumentTx.getMetadata().getSchema();
    OClass v = schema.getClass("V");
    OClass oClass = schema.createClass("Place");
    oClass.setSuperClass(v);
    oClass.createProperty("location", OType.EMBEDDED, schema.getClass("OMultiLineString"));
    oClass.createProperty("name", OType.STRING);

    databaseDocumentTx
        .command(
            new OCommandSQL("CREATE INDEX Place.location ON Place(location) SPATIAL ENGINE LUCENE"))
        .execute();
  }
Ejemplo n.º 10
0
  public static OClass create(OSchema schema) {
    // Create Book table
    OClass oClass = schema.createClass("Comment");

    // comment STRING
    OProperty prop = oClass.createProperty("comment", OType.STRING);
    prop.setNotNull(true);
    // submittedDate DATETIME
    prop = oClass.createProperty("submittedDate", OType.DATETIME);
    prop.setNotNull(true);
    // eMailAddress STRING 0 60
    prop = oClass.createProperty("eMailAddress", OType.STRING);
    prop.setMin("0");
    prop.setMax("60");
    // userId STRING 6 20
    prop = oClass.createProperty("userId", OType.STRING);
    prop.setMin("6");
    prop.setMax("20");

    // Idexes
    // submittedDate_idx NOTUNIQUE submittedDate
    oClass.createIndex("submittedDate_idx", INDEX_TYPE.NOTUNIQUE, "submittedDate");

    return oClass;
  }
Ejemplo n.º 11
0
  protected void open() {
    log.debug("try to open database");

    this.graphFactory =
        new OrientGraphFactory(this.databaseUrl, this.username, this.password).setupPool(10, 10);

    OSchema schema = this.graphFactory.getDatabase().getMetadata().getSchema();

    OClass oClass = schema.getClass("V");

    if (!oClass.areIndexed("mailadress")) {
      oClass.createProperty("mailadress", OType.STRING).setNotNull(true);
      oClass.createIndex("mailadressIndex", OClass.INDEX_TYPE.UNIQUE, "mailadress");
    }

    log.debug("Succesfully opened database");
  }
Ejemplo n.º 12
0
  @Test
  public void insertAvoidingSubQuery() {
    database.open("admin", "admin");

    final OSchema schema = database.getMetadata().getSchema();
    if (schema.getClass("test") == null) schema.createClass("test");

    ODocument doc =
        (ODocument)
            database
                .command(new OCommandSQL("INSERT INTO test(text) VALUES ('(Hello World)')"))
                .execute();

    Assert.assertTrue(doc != null);
    Assert.assertEquals(doc.field("text"), "(Hello World)");

    database.close();
  }
Ejemplo n.º 13
0
  @Test
  public void insertSubQuery() {
    database.open("admin", "admin");

    final OSchema schema = database.getMetadata().getSchema();
    if (schema.getClass("test") == null) schema.createClass("test");

    ODocument doc =
        (ODocument)
            database
                .command(new OCommandSQL("INSERT INTO test SET names = (select name from OUser)"))
                .execute();

    Assert.assertTrue(doc != null);
    Assert.assertNotNull(doc.field("names"));
    Assert.assertTrue(doc.field("names") instanceof Collection);
    Assert.assertEquals(((Collection<?>) doc.field("names")).size(), 3);

    database.close();
  }
Ejemplo n.º 14
0
  /**
   * Check if a class already exists, otherwise create it at the fly. If a transaction is running
   * commit changes, create the class and begin a new transaction.
   *
   * @param className Class's name
   */
  protected String checkForClassInSchema(final String className) {
    if (className == null) return null;

    OrientBaseGraph graph = getGraph();
    if (graph == null) return className;

    final OSchema schema = graph.getRawGraph().getMetadata().getSchema();

    if (!schema.existsClass(className)) {
      // CREATE A NEW CLASS AT THE FLY
      try {
        graph.executeOutsideTx(
            new OCallable<OClass, OrientBaseGraph>() {

              @Override
              public OClass call(final OrientBaseGraph g) {
                return schema.createClass(className, schema.getClass(getBaseClassName()));
              }
            },
            "Committing the active transaction to create the new type '",
            className,
            "' as subclass of '",
            getBaseClassName(),
            "'. The transaction will be reopen right after that. To avoid this behavior create the classes outside the transaction");

      } catch (OSchemaException e) {
        if (!schema.existsClass(className)) throw e;
      }
    } else {
      // CHECK THE CLASS INHERITANCE
      final OClass cls = schema.getClass(className);
      if (!cls.isSubClassOf(getBaseClassName()))
        throw new IllegalArgumentException(
            "Class '" + className + "' is not an instance of " + getBaseClassName());
    }

    return className;
  }
  @BeforeClass
  public void beforeClass() throws Exception {
    db = new ODatabaseDocumentTx(DB_STORAGE + ":" + DB_NAME);
    db.create();
    getProfilerInstance().startRecording();

    db.command(new OCommandSQL("CREATE class foo")).execute();
    db.command(new OCommandSQL("CREATE property foo.name STRING")).execute();
    db.command(new OCommandSQL("CREATE property foo.bar INTEGER")).execute();
    db.command(new OCommandSQL("CREATE property foo.address EMBEDDED")).execute();
    db.command(new OCommandSQL("CREATE property foo.comp STRING")).execute();
    db.command(new OCommandSQL("CREATE property foo.osite INTEGER")).execute();

    db.command(new OCommandSQL("CREATE index foo_name on foo (name) NOTUNIQUE")).execute();
    db.command(new OCommandSQL("CREATE index foo_bar on foo (bar) NOTUNIQUE")).execute();
    db.command(new OCommandSQL("CREATE index foo_comp_osite on foo (comp, osite) NOTUNIQUE"))
        .execute();

    db.command(
            new OCommandSQL(
                "insert into foo (name, bar, address) values ('a', 1, {'street':'1st street', 'city':'NY', '@type':'d'})"))
        .execute();
    db.command(new OCommandSQL("insert into foo (name, bar) values ('b', 2)")).execute();
    db.command(new OCommandSQL("insert into foo (name, bar) values ('c', 3)")).execute();

    db.command(new OCommandSQL("insert into foo (comp, osite) values ('a', 1)")).execute();
    db.command(new OCommandSQL("insert into foo (comp, osite) values ('b', 2)")).execute();

    db.command(new OCommandSQL("CREATE class bar")).execute();

    db.command(new OCommandSQL("insert into bar (name, foo) values ('a', 1)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('b', 2)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('c', 3)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('d', 4)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('e', 5)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('f', 1)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('g', 2)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('h', 3)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('i', 4)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('j', 5)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('k', 1)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('l', 2)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('m', 3)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('n', 4)")).execute();
    db.command(new OCommandSQL("insert into bar (name, foo) values ('o', 5)")).execute();

    db.command(new OCommandSQL("CREATE class ridsorttest")).execute();
    db.command(new OCommandSQL("CREATE property ridsorttest.name INTEGER")).execute();
    db.command(new OCommandSQL("CREATE index ridsorttest_name on ridsorttest (name) NOTUNIQUE"))
        .execute();

    db.command(new OCommandSQL("insert into ridsorttest (name) values (1)")).execute();
    db.command(new OCommandSQL("insert into ridsorttest (name) values (5)")).execute();
    db.command(new OCommandSQL("insert into ridsorttest (name) values (3)")).execute();
    db.command(new OCommandSQL("insert into ridsorttest (name) values (4)")).execute();
    db.command(new OCommandSQL("insert into ridsorttest (name) values (1)")).execute();
    db.command(new OCommandSQL("insert into ridsorttest (name) values (8)")).execute();
    db.command(new OCommandSQL("insert into ridsorttest (name) values (6)")).execute();

    db.command(new OCommandSQL("CREATE class unwindtest")).execute();
    db.command(
            new OCommandSQL("insert into unwindtest (name, coll) values ('foo', ['foo1', 'foo2'])"))
        .execute();
    db.command(
            new OCommandSQL("insert into unwindtest (name, coll) values ('bar', ['bar1', 'bar2'])"))
        .execute();

    db.command(new OCommandSQL("CREATE class edge")).execute();

    db.command(new OCommandSQL("CREATE class TestFromInSquare")).execute();
    db.command(
            new OCommandSQL(
                "insert into TestFromInSquare set tags = {' from ':'foo',' to ':'bar'}"))
        .execute();

    db.command(new OCommandSQL("CREATE class TestMultipleClusters")).execute();
    db.command(
            new OCommandSQL("alter class TestMultipleClusters addcluster testmultipleclusters1 "))
        .execute();
    db.command(
            new OCommandSQL("alter class TestMultipleClusters addcluster testmultipleclusters2 "))
        .execute();
    db.command(new OCommandSQL("insert into cluster:testmultipleclusters set name = 'aaa'"))
        .execute();
    db.command(new OCommandSQL("insert into cluster:testmultipleclusters1 set name = 'foo'"))
        .execute();
    db.command(new OCommandSQL("insert into cluster:testmultipleclusters2 set name = 'bar'"))
        .execute();

    db.command(new OCommandSQL("CREATE class TestUrl")).execute();
    db.command(
            new OCommandSQL("insert into TestUrl content { \"url\": \"http://www.google.com\" }"))
        .execute();

    db.command(new OCommandSQL("CREATE class TestParams")).execute();
    db.command(
            new OCommandSQL(
                "insert into TestParams  set name = 'foo', surname ='foo', active = true"))
        .execute();
    db.command(
            new OCommandSQL(
                "insert into TestParams  set name = 'foo', surname ='bar', active = false"))
        .execute();

    db.command(new OCommandSQL("CREATE class TestParamsEmbedded")).execute();
    db.command(
            new OCommandSQL(
                "insert into TestParamsEmbedded set emb = {  \n"
                    + "            \"count\":0,\n"
                    + "            \"testupdate\":\"1441258203385\"\n"
                    + "         }"))
        .execute();
    db.command(
            new OCommandSQL(
                "insert into TestParamsEmbedded set emb = {  \n"
                    + "            \"count\":1,\n"
                    + "            \"testupdate\":\"1441258203385\"\n"
                    + "         }"))
        .execute();

    db.command(new OCommandSQL("CREATE class TestBacktick")).execute();
    db.command(new OCommandSQL("insert into TestBacktick  set foo = 1, bar = 2, `foo-bar` = 10"))
        .execute();

    // /*** from issue #2743
    OSchema schema = db.getMetadata().getSchema();
    if (!schema.existsClass("alphabet")) {
      schema.createClass("alphabet");
    }

    ORecordIteratorClass<ODocument> iter = db.browseClass("alphabet");
    while (iter.hasNext()) {
      iter.next().delete();
    }

    // add 26 entries: { "letter": "A", "number": 0 }, ... { "letter": "Z", "number": 25 }

    String rowModel = "{\"letter\": \"%s\", \"number\": %d}";
    for (int i = 0; i < 26; ++i) {
      String l = String.valueOf((char) ('A' + i));
      String json = String.format(rowModel, l, i);
      ODocument doc = db.newInstance("alphabet");
      doc.fromJSON(json);
      doc.save();
    }

    db.command(new OCommandSQL("create class OCommandExecutorSQLSelectTest_aggregations"))
        .execute();
    db.command(
            new OCommandSQL(
                "insert into OCommandExecutorSQLSelectTest_aggregations set data = [{\"size\": 0}, {\"size\": 0}, {\"size\": 30}, {\"size\": 50}, {\"size\": 50}]"))
        .execute();

    initExpandSkipLimit(db);

    initMassiveOrderSkipLimit(db);
    initDatesSet(db);

    initMatchesWithRegex(db);
    initDistinctLimit(db);
  }
Ejemplo n.º 16
0
  public void testEscaping() {
    final OSchema schema = database.getMetadata().getSchema();
    schema.createClass("FormatEscapingTest");

    final ODocument document = new ODocument("FormatEscapingTest");
    document.save();

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = format('aaa \\' bbb') WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();

    Assert.assertEquals(document.field("test"), "aaa ' bbb");

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = 'ccc \\' eee', test2 = format('aaa \\' bbb') WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();
    Assert.assertEquals(document.field("test"), "ccc ' eee");
    Assert.assertEquals(document.field("test2"), "aaa ' bbb");

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = 'aaa \\n bbb' WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();
    Assert.assertEquals(document.field("test"), "aaa \n bbb");

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = 'aaa \\r bbb' WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();
    Assert.assertEquals(document.field("test"), "aaa \r bbb");

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = 'aaa \\b bbb' WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();
    Assert.assertEquals(document.field("test"), "aaa \b bbb");

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = 'aaa \\t bbb' WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();
    Assert.assertEquals(document.field("test"), "aaa \t bbb");

    database
        .command(
            new OCommandSQL(
                "UPDATE FormatEscapingTest SET test = 'aaa \\f bbb' WHERE @rid = "
                    + document.getIdentity()))
        .execute();

    document.reload();
    Assert.assertEquals(document.field("test"), "aaa \f bbb");
  }
 @Override
 protected OProperty createInstance(OProperty proxy) {
   OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema();
   OClass oClass = schema.getClass(className);
   return oClass.createProperty(proxy.getName(), proxy.getType());
 }
Ejemplo n.º 18
0
  private void configureDocument(
      ORecordAbstract<?> document, ODatabaseRecord db, DefinitionGroup definition) {
    // configure document

    // as of OrientDB 1.0rc8 the database may no longer be set on the
    // document
    // instead the current database can be set using
    // ODatabaseRecordThreadLocal.INSTANCE.set(db);
    //		document.setDatabase(db);
    if (document instanceof ODocument) {
      // reset class name
      ODocument doc = (ODocument) document;
      /*
       * Attention: Two long class names cause problems as file names will
       * be based on them.
       */
      String className = null;
      if (definition != null) {
        className = ONamespaceMap.encode(determineName(definition));
      } else if (doc.containsField(OSerializationHelper.BINARY_WRAPPER_FIELD)
          || doc.containsField(OSerializationHelper.FIELD_SERIALIZATION_TYPE)) {
        className = OSerializationHelper.BINARY_WRAPPER_CLASSNAME;
      }

      if (className != null) {
        OSchema schema = db.getMetadata().getSchema();
        if (!schema.existsClass(className)) {
          // if the class doesn't exist yet, create a physical cluster
          // manually for it
          int cluster = db.addCluster(className, CLUSTER_TYPE.PHYSICAL);
          schema.createClass(className, cluster);
        }
        doc.setClassName(className);
      }

      // configure children
      for (Entry<String, Object> field : doc) {
        List<ODocument> docs = new ArrayList<ODocument>();
        List<ORecordAbstract<?>> recs = new ArrayList<ORecordAbstract<?>>();
        if (field.getValue() instanceof Collection<?>) {
          for (Object value : (Collection<?>) field.getValue()) {
            if (value instanceof ODocument && !getSpecialFieldNames().contains(field.getKey())) {
              docs.add((ODocument) value);
            } else if (value instanceof ORecordAbstract<?>) {
              recs.add((ORecordAbstract<?>) value);
            }
          }
        } else if (field.getValue() instanceof ODocument
            && !getSpecialFieldNames().contains(field.getKey())) {
          docs.add((ODocument) field.getValue());
        } else if (field.getValue() instanceof ORecordAbstract<?>) {
          recs.add((ORecordAbstract<?>) field.getValue());
        }

        if (definition != null) {
          for (ODocument valueDoc : docs) {
            ChildDefinition<?> child = definition.getChild(decodeProperty(field.getKey()));
            DefinitionGroup childGroup;
            if (child.asProperty() != null) {
              childGroup = child.asProperty().getPropertyType();
            } else if (child.asGroup() != null) {
              childGroup = child.asGroup();
            } else {
              throw new IllegalStateException(
                  "Document is associated neither with a property nor a property group.");
            }
            configureDocument(valueDoc, db, childGroup);
          }
        }

        for (ORecordAbstract<?> fieldRec : recs) {
          configureDocument(fieldRec, db, null);
        }
      }
    }
  }