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

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


      data.commandInfo = "Update db configuration from server node leader";

      final ODocument config = (ODocument) new ODocument().fromStream(channel.readBytes());
      manager.setClusterConfiguration(connection.database.getName(), config);

      OLogManager.instance().warn(this, "Changed distributed server configuration:\n%s", config.toJSON());

      sendOk(lastClientTxId);
      break;
    }
View Full Code Here


    final ArrayList<ODocument> list = new ArrayList<ODocument>();
    newDoc.field("embeddedList", list, OType.EMBEDDEDLIST);
    list.add(new ODocument().field("name", "Luca"));
    list.add(new ODocument().field("name", "Marcus"));

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("embeddedList"));
View Full Code Here

    ODocument newDoc = new ODocument();

    final Map<String, ODocument> map = new HashMap<String, ODocument>();
    newDoc.field("embeddedMap", map, OType.EMBEDDEDMAP);

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("embeddedMap"));
View Full Code Here

    newDoc.field("map", map);
    map.put("Luca", new ODocument().field("name", "Luca"));
    map.put("Marcus", new ODocument().field("name", "Marcus"));
    map.put("Cesare", new ODocument().field("name", "Cesare"));

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("map"));
View Full Code Here

    map1.put("map2", (HashMap<?, ?>) map2);

    final Map<String, HashMap<?, ?>> map3 = new HashMap<String, HashMap<?, ?>>();
    map2.put("map3", (HashMap<?, ?>) map3);

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("map1"));
View Full Code Here

      currentDocument.getRecordVersion().copyFrom(doc.getRecordVersion());

      currentDocument.save();

      iResponse.send(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN,
          currentDocument.toJSON(), OHttpUtils.HEADER_ETAG + doc.getVersion(), true);

    } finally {
      if (db != null)
        db.close();
    }
View Full Code Here

       ((ORecordId) doc.getIdentity()).clusterPosition = ORID.CLUSTER_POS_INVALID;

       doc.save();

       iResponse.send(OHttpUtils.STATUS_CREATED_CODE, OHttpUtils.STATUS_CREATED_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN,
           doc.toJSON(), OHttpUtils.HEADER_ETAG + doc.getVersion(), true);

     } finally {
       if (db != null)
         db.close();
     }
View Full Code Here

      return null;
    }

    if (iThis instanceof ODocument) {
      final ODocument doc = (ODocument) iThis;
      return iParams.length == 1 ? doc.toJSON(((String) iParams[0]).replace("\"", "")) : doc.toJSON();
    }
    return null;
  }
}
View Full Code Here

      return null;
    }

    if (iThis instanceof ODocument) {
      final ODocument doc = (ODocument) iThis;
      return iParams.length == 1 ? doc.toJSON(((String) iParams[0]).replace("\"", "")) : doc.toJSON();
    }
    return null;
  }
}
View Full Code Here

    final OStorage stg = currentDatabase.getStorage();
    if (stg instanceof OStorageRemoteThread) {
      final ODocument distributedCfg = ((OStorageRemoteThread) stg).getClusterConfiguration();
      if (distributedCfg != null && !distributedCfg.isEmpty()) {
        message("\n\nDISTRIBUTED CONFIGURATION:\n" + distributedCfg.toJSON("prettyPrint"));
      } else if (iForce)
        message("\n\nDISTRIBUTED CONFIGURATION: none (OrientDB is running in standalone mode)");
    }
  }
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.