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

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


    String json = "{ \"@class\": \"Account\", \"type\": \"Residence\", \"street\": \"Piazza di Spagna\"}";

    db.begin(TXTYPE.OPTIMISTIC);
    for (int g = 0; g < 1000; g++) {
      ODocument doc = new ODocument(db, "Account");
      doc.fromJSON(json);
      doc.field("nr", g);

      doc.save();
    }
    db.commit();
View Full Code Here


        }
        if (fileDocument.contains("$file")) {
          fileDocument = fileDocument.replace("$file", fileRID.toString());
        }
        ODocument doc = new ODocument(database);
        doc.fromJSON(fileDocument);
        doc.save();
        writer.beginObject("updatedDocument");
        writer.writeAttribute(1, true, "rid", doc.getIdentity().toString());
        writer.endObject();
        writer.endObject();
View Full Code Here

    String json = "{ \"@class\": \"Account\", \"type\": \"Residence\", \"street\": \"Piazza di Spagna\"}";

    db.begin(TXTYPE.OPTIMISTIC);
    for (int g = 0; g < 1000; g++) {
      ODocument doc = new ODocument(db, "Account");
      doc.fromJSON(json);
      doc.field("nr", g);

      doc.save();
    }
    db.commit();
View Full Code Here

      } else
        recordId = new ORecordId();

      // UNMARSHALL DOCUMENT WITH REQUEST CONTENT
      doc = new ODocument(db);
      doc.fromJSON(iRequest.content);

      if (!recordId.isValid())
        recordId = (ORecordId) doc.getIdentity();
      else
        doc.setIdentity(recordId);
View Full Code Here

        }
        if (fileDocument.contains("$file")) {
          fileDocument = fileDocument.replace("$file", fileRID.toString());
        }
        ODocument doc = new ODocument(database);
        doc.fromJSON(fileDocument);
        doc.save();
        writer.beginObject("updatedDocument");
        writer.writeAttribute(1, true, "rid", doc.getIdentity().toString());
        writer.endObject();
        writer.endObject();
View Full Code Here

      final ODocument doc = new ODocument(db, recordId);

      // UNMARSHALL DOCUMENT WITH REQUEST CONTENT
      if (iRequest.content != null)
        // GET THE VERSION FROM THE DOCUMENT
        doc.fromJSON(iRequest.content);
      else {
        if (iRequest.ifMatch != null)
          // USE THE IF-MATCH HTTP HEADER AS VERSION
          doc.setVersion(Integer.parseInt(iRequest.ifMatch));
        else
View Full Code Here

      } else
        recordId = new ORecordId();

      // UNMARSHALL DOCUMENT WITH REQUEST CONTENT
      doc = new ODocument();
      doc.fromJSON(iRequest.content);

      if (iRequest.ifMatch != null)
        // USE THE IF-MATCH HTTP HEADER AS VERSION
        doc.getRecordVersion().getSerializer().fromString(iRequest.ifMatch, doc.getRecordVersion());
View Full Code Here

        }
        if (fileDocument.contains("$file")) {
          fileDocument = fileDocument.replace("$file", fileRID.toString());
        }
        ODocument doc = new ODocument();
        doc.fromJSON(fileDocument);
        doc.save();
        writer.beginObject("updatedDocument");
        writer.writeAttribute(1, true, "rid", doc.getIdentity().toString());
        writer.endObject();
      } else {
View Full Code Here

      final ODocument doc = new ODocument(recordId);

      // UNMARSHALL DOCUMENT WITH REQUEST CONTENT
      if (iRequest.content != null)
        // GET THE VERSION FROM THE DOCUMENT
        doc.fromJSON(iRequest.content);
      else {
        if (iRequest.ifMatch != null)
          // USE THE IF-MATCH HTTP HEADER AS VERSION
          doc.getRecordVersion().getSerializer().fromString(iRequest.ifMatch, doc.getRecordVersion());
        else
View Full Code Here

    ODocument jaimeDoc = new ODocument("PersonTest");
    jaimeDoc.field("name", "jaime");
    jaimeDoc.save();

    ODocument tyrionDoc = new ODocument("PersonTest");
    tyrionDoc.fromJSON("{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":[{\"relationship\":\"brother\",\"contact\":"
        + jaimeDoc.toJSON() + "}]}");
    tyrionDoc.save();
    List<Map<String, OIdentifiable>> res = tyrionDoc.field("emergency_contact");
    Map<String, OIdentifiable> doc = res.get(0);
    Assert.assertTrue(doc.get("contact").getIdentity().isValid());
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.