@Override public Object doWithLock() { if ((roles == null || roles.isEmpty()) && accountId == null) { throw new ValidationErrorException(ValidationErrorCodes.MISSING_REQUIRED, "MustSpecifyAccountIdOrRole"); } try { jsonMapper.readValue( String.valueOf(requestObject.get(DEFINITION_FIELD)).getBytes("UTF-8"), SchemaImpl.class); } catch (Exception e) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_FORMAT, DEFINITION_FIELD); } return filter.callSuperCreate(type, request, next); } });
Map<String, Object> obj = jsonMapper.convertValue(objectToPlace, Map.class); jsonMapper.writeValue(os, obj); data.put(fieldForObject, os.toString()); } catch (IOException e) {
protected void writeJson(JsonMapper jsonMapper, OutputStream os, Object responseObject, ApiRequest request) throws IOException { jsonMapper.writeValue(os, responseObject); }
Map<String, Object> resourceData = jsonMapper.convertValue(resource, Map.class);; if (request.getOptions().get("_actionLinks") != null) { data.put("actionLinks", resourceData.remove("actions"));
protected Object getObject(ApiRequest request) throws IOException { if (!RequestUtils.mayHaveBody(request.getMethod())) return null; if (!shouldBeParsed(request)) { return null; } InputStream is = request.getInputStream(); if (is == null) { return null; } byte[] content = IOUtils.toByteArray(is); if (content.length == 0) return null; try { Object body = jsonMarshaller.readValue(content); if (isAllowedType(body)) { return body; } } catch (IOException e) { throw new ClientVisibleException(ResponseCodes.BAD_REQUEST, ValidationErrorCodes.INVALID_BODY_CONTENT); } return null; }
SchemaImpl newSchema = jsonMapper.readValue(dynamicSchema.getDefinition().getBytes("UTF-8"), SchemaImpl.class); newSchema.setId(dynamicSchema.getName()); return newSchema; SchemaImpl newSchema = jsonMapper.readValue(dynamicSchema.getDefinition().getBytes("UTF-8"), SchemaImpl.class); newSchema.setName(dynamicSchema.getName()); SchemaImpl mergedSchema = new SchemaImpl((SchemaImpl)parentSchema);