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

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


                     */                               
                 {
                          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());
                          PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));      
View Full Code Here


      JsonNode privateAttributes, JsonNode friendsAttributes,
      JsonNode appUsersAttributes) throws Exception{
    if (nonAppUserAttributes!=null)  {
      ODocument attrObj = profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER);
      if (attrObj==null) attrObj=new ODocument(UserDao.USER_ATTRIBUTES_CLASS);
      attrObj.fromJSON(nonAppUserAttributes.toString());
      PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));
      PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.ANONYMOUS_USER.toString()))
      PermissionsHelper.grantRead(attrObj, RoleDao.getFriendRole());       
      profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER,attrObj);
      attrObj.save();
View Full Code Here

      attrObj.save();
    }
    if (privateAttributes!=null)  {
      ODocument attrObj = profile.field(UserDao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER);
      if (attrObj==null) attrObj=new ODocument(UserDao.USER_ATTRIBUTES_CLASS);
      attrObj.fromJSON(privateAttributes.toString());
      PermissionsHelper.grant(attrObj, Permissions.ALLOW,getOUserByUsername(getUsernameByProfile(profile)));
      profile.field(UserDao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER, attrObj);
      attrObj.save();
    }
    if (friendsAttributes!=null)  {
View Full Code Here

      attrObj.save();
    }
    if (friendsAttributes!=null)  {
      ODocument attrObj = profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER);
      if (attrObj==null) attrObj=new ODocument(UserDao.USER_ATTRIBUTES_CLASS);
      attrObj.fromJSON(friendsAttributes.toString());
      PermissionsHelper.grantRead(attrObj, RoleDao.getFriendRole());       
      profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER, attrObj);
      attrObj.save();
    }
    if (appUsersAttributes!=null)  {
View Full Code Here

      ODocument attrObj = profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER);
      if (attrObj==null) attrObj=new ODocument(UserDao.USER_ATTRIBUTES_CLASS);
      //preserve the _social field
        OTrackedMap oldSocial = (OTrackedMap)attrObj.field("_social");
        ((ObjectNode)(appUsersAttributes)).remove("_social");
      attrObj.fromJSON(appUsersAttributes.toString());
        if (oldSocial!=null) attrObj.field("_social",oldSocial);
      PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));
      PermissionsHelper.grantRead(attrObj, RoleDao.getFriendRole())
      profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER, attrObj);
      attrObj.save();
View Full Code Here

        ODocument privateSection = user.field(UserDao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER);
        ODocument friendsSection = user.field(UserDao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER);
       
        if (anonymousSection==null){
          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
          attrObj.fromJSON("{}");
                    PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.ANONYMOUS_USER.toString()));       
                    PermissionsHelper.changeOwner(attrObj,userRid );
                    user.field(dao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER,attrObj);
                    attrObj.save();
        }
View Full Code Here

                    attrObj.save();
        }
       
        if (registeredSection==null){
          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
          attrObj.fromJSON("{}");
          PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));      
                  PermissionsHelper.changeOwner(attrObj, userRid);
                  user.field(dao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER, attrObj);
                    attrObj.save();
        }
View Full Code Here

                    attrObj.save();
        }

        if (privateSection==null){
          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
          attrObj.fromJSON("{}");
                    user.field(dao.ATTRIBUTES_VISIBLE_ONLY_BY_THE_USER, attrObj);
                    PermissionsHelper.changeOwner(attrObj, userRid);                                       
                    attrObj.save();
        }       
       
View Full Code Here

                    attrObj.save();
        }       
       
        if (friendsSection==null){
          ODocument attrObj = new ODocument(dao.USER_ATTRIBUTES_CLASS);
          attrObj.fromJSON("{}");
          PermissionsHelper.grantRead(attrObj, RoleDao.getFriendRole(user));                               
            PermissionsHelper.changeOwner(attrObj, userRid);
            user.field(dao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER, attrObj);
            attrObj.save();
        }
View Full Code Here

    file.field(FILENAME_FIELD_NAME,fileName);
    file.field(CONTENT_TYPE_FIELD_NAME,contentType);
    file.field(CONTENT_LENGTH_FIELD_NAME,new Long(contentLength));
    if (metadata!=null){
            ODocument doc = new ODocument();
            doc = doc.fromJSON(new JSONObject(metadata).toString());
      file.field(METADATA_FIELD_NAME,doc);
    }
    if (!StringUtils.isEmpty(contentString)){
      file.field(FILE_CONTENT_FIELD_NAME,(new ODocument(FILE_CONTENT_CLASS)).field("content",contentString));
    }
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.