Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode.asText()


                } else if (value.isDouble()) {
                    tree.setProperty(name, value.asDouble());
                } else if (value.isBigDecimal()) {
                    tree.setProperty(name, value.decimalValue());
                } else {
                    tree.setProperty(name, value.asText());
                }
            }
        }
    }
View Full Code Here


                    String entryName = property.getKey();
                    JsonNode entryValueNode = property.getValue();

                    // We check if the entry is well-formed (i.e can be output to a String meaningfully).
                    if (entryValueNode.isTextual() || entryValueNode.isInt()) {
                        String entryValue = entryValueNode.asText();
                        entryMetadata.put(entryName, entryValue);
                    }

                    // We get environment variables from the metadata when we iterate over app.env
                    if (id.equals("app") && entryName.equals("env")) {
View Full Code Here

                             envVariables.hasNext(); ) {
                            Map.Entry<String, JsonNode> envVariable = envVariables.next();
                            String envName = envVariable.getKey();
                            JsonNode envValue = envVariable.getValue();
                            if (envValue.isTextual()) {
                                environment.put(envName, envValue.asText());
                            }
                        }
                    }
                }
View Full Code Here

            }

            JsonNode message = data.get("message");
            String msg;
            if (message != null && message.isTextual()){
                msg = message.asText();
            } else {
                msg = "";
            }

            if(status.asBoolean()){
View Full Code Here

    public static String getAndvalidateCodeProperty(JsonNode script) throws InvalidScriptException{
        JsonNode code = script.get(ScriptsDao.CODE);
        if (code == null||!code.isTextual()){
            throw new InvalidScriptException("missing code property");
        }
        String c = code.asText();
        if (c==null){
            throw new InvalidScriptException("missing code property");
        }
        return c;
    }
View Full Code Here

        if (langNode==null){
            return ScriptLanguage.JS;
        } else if(!langNode.isTextual()){
            throw new InvalidScriptException("Invalid language: should be a name");
        }else {
            return validateLang(langNode.asText());
        }
    }


    public static String getAndValidateNameProperty(JsonNode script) throws InvalidScriptException{
View Full Code Here

    public static String getAndValidateNameProperty(JsonNode script) throws InvalidScriptException{
        JsonNode nameNode = script.get(ScriptsDao.NAME);
        if (nameNode==null||!nameNode.isTextual()){
            throw new InvalidScriptException("Missing name property");
        }
        String name = nameNode.asText();
        validateName(name);
        return name;
    }

    public static ScriptLanguage validateLang(String name) throws InvalidScriptException {
View Full Code Here

    JsonNode json = om.readTree(content);
    JsonNode root = JsonTree.read(json, pp);
    if(root.isMissingNode()){
      fail();
    }else{
      assertEquals("title", root.asText());
    }
  }


  @Test
View Full Code Here

    if (bodyJson==null) return badRequest("The body payload cannot be empty.");   
    if (!bodyJson.has("password"))  return badRequest("The 'password' field is missing into the body");
    JsonNode passwordNode=bodyJson.findValue("password");
   
    if (passwordNode==null) return badRequest("The body payload doesn't contain password field");
    String password=passwordNode.asText();  
    try{
      UserService.changePassword("admin", password);
    } catch (SqlInjectionException e) {
      return badRequest("The password is not valid");
    } catch (UserNotFoundException e) {
View Full Code Here

                    String s = n==null?null:n.toString();
                    ary[idx] = s;
                }
                query.put(k,ary);
            } else {
                String[] o = {val.asText()};
                query.put(k,o);
            }
        }

        return getParamsFromQueryString(query);
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.