private static String buildMessage(final String key, final JsonNode params, final JsonNode data) {
   final ProcessingMessage message = new ProcessingMessage().setMessage(BUNDLE.getMessage(key));
   if (params != null) {
     String name;
     JsonNode value;
     for (final JsonNode node : params) {
       name = node.textValue();
       value = data.get(name);
       message.putArgument(name, valueToArgument(value));
     }
   }
   return message.getMessage();
 }
Exemplo n.º 2
0
 private static void ensureEmailUnique(Resource user, ProcessingReport aReport) {
   String aEmail = user.get("mbox_sha1sum").toString();
   if ((!mBaseRepository
       .getResourcesByContent("Person", "mbox_sha1sum", aEmail, true)
       .isEmpty())) {
     ProcessingMessage message = new ProcessingMessage();
     message.setMessage("This e-mail address is already registered");
     ObjectNode instance = new ObjectNode(JsonNodeFactory.instance);
     instance.put("pointer", "/mbox_sha1sum");
     message.put("instance", instance);
     try {
       aReport.error(message);
     } catch (ProcessingException e) {
       e.printStackTrace();
     }
   }
 }