@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); } });
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);