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

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


    }


  public static String prepareResponseToJson(ODocument doc, JSONFormats.Formats format){
     ODocument retDoc = JSONFormats.cutBaasBoxFields(doc);
     String ret = retDoc.toJSON(format.toString());
    return ret;
  }
 
  public static String prepareResponseToJson(List<ODocument> listOfDoc,JSONFormats.Formats format) throws IOException{
    for (ODocument doc: listOfDoc){
View Full Code Here


      return badRequest("The request is malformed: check your query criteria");
    }
    if (user==null) return notFound("User " + username + " not found");
    String ret="";
    try{
      ret=user.toJSON(JSONFormats.Formats.USER.toString());
    }catch (Throwable e){
      return internalServerError(ExceptionUtils.getFullStackTrace(e));
    }
    if (Logger.isTraceEnabled()) Logger.trace("Method End");
    response().setContentType("application/json");
View Full Code Here

   */
  public static Result getRole(String name) throws SqlInjectionException{
    List<ODocument> listOfRoles=RoleService.getRoles(name);
    if (listOfRoles.size()==0) return notFound("Role " + name + " not found");
    ODocument role = listOfRoles.get(0);
    String ret = role.toJSON(JSONFormats.Formats.ROLES.toString());
    response().setContentType("application/json");
    return ok(ret);
  }

  /* create user in any role */
 
View Full Code Here

      Logger.warn("signUp", e);
      if (Play.isDev()) return internalServerError(ExceptionUtils.getFullStackTrace(e));
      else return internalServerError(e.getMessage());
    }
    if (Logger.isTraceEnabled()) Logger.trace("Method End");
    return ok(user.toJSON(Formats.USER.toString()));
  }//updateUser

  /***
   * Change password of a specific user
   * @param username of user
View Full Code Here

      .append(bodyJson.get("data").toString());

    }else{
      q.append("update ").append(rid)
      .append(" merge ");
      String content = od.toJSON();
      ObjectNode json = null;
      try{
        json = (ObjectNode)mapper.readTree(content.toString());
      }catch(Exception e){
        throw new RuntimeException("Unable to modify inline json");
View Full Code Here

            throw new CommandParsingException(command,"unknown action: "+action);
        }
        if (result == null){
            return NullNode.getInstance();
        } else {
            String s = result.toJSON();
            try {
                JsonNode jsonNode = Json.mapper().readTree(s);
                return jsonNode;
            } catch (IOException e) {
                throw new CommandExecutionException(command,"error converting result",e);
View Full Code Here

        {
          try{
          DbHelper.open("1234567890", "admin", "admin");
          OResultSet result1=(OResultSet)DbHelper.genericSQLStatementExecute("select sysdate()",new String[]{});
          ODocument res1 = (ODocument)result1.get(0);
          String jsonString1= res1.toJSON();
          ObjectMapper om = new ObjectMapper();
          JsonNode json1 = om.readTree(jsonString1);
          String dateString1 = json1.get("sysdate").asText();
          String seconds1=dateString1.substring(17,19);
          String milliseconds1=dateString1.substring(20,23);
View Full Code Here

          String seconds1=dateString1.substring(17,19);
          String milliseconds1=dateString1.substring(20,23);
          Thread.sleep(1000);
          OResultSet result2=(OResultSet)DbHelper.genericSQLStatementExecute("select sysdate()",new String[]{});
          ODocument res2 = (ODocument)result2.get(0);
          String jsonString2= res2.toJSON();
          JsonNode json2 = om.readTree(jsonString2);
          String dateString2 = json2.get("sysdate").asText();
          String seconds2=dateString2.substring(17,19);
          String milliseconds2=dateString2.substring(20,23);
         
View Full Code Here

          exportEntry.field("rid", indexEntry.field("rid"));

          i++;

          writer.append(exportEntry.toJSON());

          final long percent = indexContent.size() / 10;
          if (percent > 0 && (i % percent) == 0)
            listener.onMessage(".");
        }
View Full Code Here

   */
  public ODocument clusterStatus() {
    final ODocument response = sendRequest(OChannelBinaryProtocol.REQUEST_CLUSTER, new ODocument().field("operation", "status"),
        "Cluster status");

    OLogManager.instance().debug(this, "Cluster status %s", response.toJSON("prettyPrint"));
    return response;
  }

  /**
   * Copies a database to a remote server instance.
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.