Package com.orientechnologies.orient.core.record.impl

Examples of com.orientechnologies.orient.core.record.impl.ODocument.fromJSON()


        doc.field(DATE,new Date());
        doc.field(LIB,isLibrary);
        doc.field(ACTIVE,active);
        ODocument local = new ODocument();
        if (initialStore!=null){
            local.fromJSON(initialStore.toString());
        }
        doc.field(LOCAL_STORAGE,local);
        doc.field(INVALID,false);
        return doc;
    }
View Full Code Here


        + "}");
    cerseiDoc.save();

    // The link between jamie and tyrion is not saved properly
    ODocument tyrionDoc = new ODocument("NestedLinkCreationFieldTypes");
    tyrionDoc
        .fromJSON("{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\", \"@fieldTypes\":\"contact=x\",\"relationship\":\"brother\",\"contact\":"
            + jaimeDoc.getIdentity() + "}}");
    tyrionDoc.save();

    final Map<ORID, ODocument> contentMap = new HashMap<ORID, ODocument>();
View Full Code Here

    Assert.assertTrue(traverseMap.isEmpty());
  }

  public void testInnerDocCreation() {
    ODocument adamDoc = new ODocument("InnerDocCreation");
    adamDoc.fromJSON("{\"name\":\"adam\"}");
    adamDoc.save();

    ODocument eveDoc = new ODocument("InnerDocCreation");
    eveDoc.fromJSON("{\"@type\":\"d\",\"name\":\"eve\",\"friends\":[" + adamDoc.toJSON() + "]}");
    eveDoc.save();
View Full Code Here

    ODocument adamDoc = new ODocument("InnerDocCreation");
    adamDoc.fromJSON("{\"name\":\"adam\"}");
    adamDoc.save();

    ODocument eveDoc = new ODocument("InnerDocCreation");
    eveDoc.fromJSON("{\"@type\":\"d\",\"name\":\"eve\",\"friends\":[" + adamDoc.toJSON() + "]}");
    eveDoc.save();

    Map<ORID, ODocument> contentMap = new HashMap<ORID, ODocument>();
    ODocument adam = new ODocument("InnerDocCreation");
    adam.field("name", "adam");
View Full Code Here

    Assert.assertTrue(traverseMap.isEmpty());
  }

  public void testInnerDocCreationFieldTypes() {
    ODocument adamDoc = new ODocument("InnerDocCreationFieldTypes");
    adamDoc.fromJSON("{\"name\":\"adam\"}");
    adamDoc.save();

    ODocument eveDoc = new ODocument("InnerDocCreationFieldTypes");
    eveDoc.fromJSON("{\"@type\":\"d\", \"@fieldTypes\" : \"friends=z\", \"name\":\"eve\",\"friends\":[" + adamDoc.getIdentity()
        + "]}");
View Full Code Here

    ODocument adamDoc = new ODocument("InnerDocCreationFieldTypes");
    adamDoc.fromJSON("{\"name\":\"adam\"}");
    adamDoc.save();

    ODocument eveDoc = new ODocument("InnerDocCreationFieldTypes");
    eveDoc.fromJSON("{\"@type\":\"d\", \"@fieldTypes\" : \"friends=z\", \"name\":\"eve\",\"friends\":[" + adamDoc.getIdentity()
        + "]}");
    eveDoc.save();

    Map<ORID, ODocument> contentMap = new HashMap<ORID, ODocument>();
    ODocument adam = new ODocument("InnerDocCreationFieldTypes");
View Full Code Here

    ODocument eveDoc = new ODocument("JSONTxDocOne");
    eveDoc.field("name", "eve");
    eveDoc.save();

    ODocument nestedWithTypeD = new ODocument("JSONTxDocTwo");
    nestedWithTypeD.fromJSON("{\"@type\":\"d\",\"event_name\":\"world cup 2014\",\"admin\":[" + eveDoc.toJSON() + ","
        + adamDoc.toJSON() + "]}");
    nestedWithTypeD.save();

    database.commit();
View Full Code Here

  }

  @Test
  public void testAlmostLink() {
    ODocument doc = new ODocument();
    doc.fromJSON("{'title': '#330: Dollar Coins Are Done'}");
  }

  @Test
  public void testNullList() throws Exception {
    ODocument documentSource = new ODocument();
View Full Code Here

  }

  @Test
  public void testNullList() throws Exception {
    ODocument documentSource = new ODocument();
    documentSource.fromJSON("{\"list\" : [\"string\", null]}");

    ODocument documentTarget = new ODocument();
    documentTarget.fromStream(documentSource.toStream());

    OTrackedList<Object> list = documentTarget.field("list", OType.EMBEDDEDLIST);
View Full Code Here

  @Test
  public void testNullity() {
    ODocument newDoc = new ODocument();

    newDoc.fromJSON("{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\","
        + "\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith Ave\","
        + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"}," + "\"dob\":\"2011-11-17 03:17:04\"}");

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.