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

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


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

    ODocument cerseiDoc = new ODocument("PersonTest");
    cerseiDoc.fromJSON("{\"@type\":\"d\",\"name\":\"cersei\",\"valonqar\":" + jaimeDoc.toJSON() + "}");
    cerseiDoc.save();

    // The link between jamie and tyrion is not saved properly
    ODocument tyrionDoc = new ODocument("PersonTest");
    tyrionDoc.fromJSON("{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"relationship\":\"brother\",\"contact\":"
View Full Code Here


    cerseiDoc.fromJSON("{\"@type\":\"d\",\"name\":\"cersei\",\"valonqar\":" + jaimeDoc.toJSON() + "}");
    cerseiDoc.save();

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

    System.out.println("The saved documents are:");
    for (ODocument o : database.browseClass("PersonTest")) {
View Full Code Here

    testDocument.reload();

    final String json = testDocument.toJSON();

    ODocument doc = new ODocument();
    doc.fromJSON(json);

    Assert.assertTrue(ODocumentHelper.hasSameContentOf(doc, database, testDocument, database, null));
  }

  public void stackOverflowDuringToString() {
View Full Code Here

           
            //anonymous
                 {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{
                              if (nonAppUserAttributes!=null) attrObj.fromJSON(nonAppUserAttributes.toString());
                              else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER + " is not a valid JSON object",e);
                          }
                          PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));
View Full Code Here

            //anonymous
                 {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{
                              if (nonAppUserAttributes!=null) attrObj.fromJSON(nonAppUserAttributes.toString());
                              else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER + " is not a valid JSON object",e);
                          }
                          PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));
                          PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.ANONYMOUS_USER.toString()));       
View Full Code Here

                     *    User
                     */                               
                  {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{
                            if (privateAttributes!=null) attrObj.fromJSON(privateAttributes.toString());
                            else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER + " is not a valid JSON object",e);
                          }
                          profile.field(dao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER, attrObj);
View Full Code Here

                     */                               
                  {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{
                            if (privateAttributes!=null) attrObj.fromJSON(privateAttributes.toString());
                            else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER + " is not a valid JSON object",e);
                          }
                          profile.field(dao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER, attrObj);
                          PermissionsHelper.changeOwner(attrObj, userRid);                                       
View Full Code Here

                     *    User
                     */                               
                 {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{       
                             if (friendsAttributes!=null) attrObj.fromJSON(friendsAttributes.toString());
                             else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER + " is not a valid JSON object",e);
                          }
                          PermissionsHelper.grantRead(attrObj, friendRole);                               
View Full Code Here

                     */                               
                 {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{       
                             if (friendsAttributes!=null) attrObj.fromJSON(friendsAttributes.toString());
                             else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER + " is not a valid JSON object",e);
                          }
                          PermissionsHelper.grantRead(attrObj, friendRole);                               
                          PermissionsHelper.changeOwner(attrObj, userRid);
View Full Code Here

                     *    User
                     */                               
                 {
                          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
                          try{
                            if (appUsersAttributes!=null) attrObj.fromJSON(appUsersAttributes.toString());
                             else attrObj.fromJSON("{}");
                          }catch (OSerializationException e){
                                  throw new InvalidJsonException (dao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER + " is not a valid JSON object",e);
                          }
                          attrObj.field("_social",new HashMap());
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.