@Override public InternalEndpointRoute exampleRequest(String bodyText) { HashMap<String, MimeType> bodyMap = new HashMap<>(); MimeType mimeType = new MimeType(); mimeType.setExample(bodyText); bodyMap.put("text/plain", mimeType); this.exampleRequestMap = bodyMap; return this; }
@Override public InternalEndpointRoute exampleRequest(Map<String, List<FormParameter>> parameters) { HashMap<String, MimeType> bodyMap = new HashMap<>(); MimeType mimeType = new MimeType(); mimeType.setFormParameters(parameters); bodyMap.put("multipart/form-data", mimeType); this.exampleRequestMap = bodyMap; return this; }
@Override public InternalEndpointRoute exampleRequest(JSONObject jsonObject) { HashMap<String, MimeType> bodyMap = new HashMap<>(); MimeType mimeType = new MimeType(); String json = jsonObject.toString(); mimeType.setExample(json); bodyMap.put("application/json", mimeType); this.exampleRequestMap = bodyMap; return this; }
@Override public InternalEndpointRoute exampleRequest(RestModel model) { HashMap<String, MimeType> bodyMap = new HashMap<>(); MimeType mimeType = new MimeType(); String json = model.toJson(); mimeType.setExample(json); mimeType.setSchema(JsonUtil.getJsonSchema(model.getClass())); bodyMap.put("application/json", mimeType); this.exampleRequestMap = bodyMap; this.exampleRequestClass = model.getClass(); return this; }
@Override public InternalEndpointRoute exampleResponse(HttpResponseStatus status, Object model, String description) { Response response = new Response(); response.setDescription(description); HashMap<String, MimeType> map = new HashMap<>(); response.setBody(map); MimeType mimeType = new MimeType(); if (model instanceof RestModel) { String json = ((RestModel) model).toJson(); mimeType.setExample(json); mimeType.setSchema(JsonUtil.getJsonSchema(model.getClass())); map.put("application/json", mimeType); } else { mimeType.setExample(model.toString()); map.put("text/plain", mimeType); } exampleResponses.put(status.code(), response); exampleResponseClasses.put(status.code(), model.getClass()); return this; }
final MimeType mime = new MimeType();
@Override public Map<String, Response> resolve(final Method method) { final ImmutableMap.Builder<String, Response> mapping = ImmutableMap.builder(); for (final com.sap.cloud.yaas.servicegenerator.model.Response modelResponse : method.getResponses()) { final Response ramlResponse = new Response(); ramlResponse.setDescription(modelResponse.getDescription()); final MimeType mimeType = new MimeType(); mimeType.setExample(modelResponse.getExample()); if (modelResponse.getType() instanceof SchemaNameAware) { mimeType.setSchema(((SchemaNameAware) modelResponse.getType()).getSchemaName()); } ramlResponse.setBody(ImmutableMap.of(modelResponse.getBodyType(), mimeType)); ramlResponse.setHeaders(processHeaders(modelResponse)); mapping.put(String.valueOf(modelResponse.getCode()), ramlResponse); } return mapping.build(); }
MimeType ramlInRepresentationWithMediaType; for (String mediaType : operation.getConsumes()) { ramlInRepresentationWithMediaType = new MimeType(); ramlInRepresentationWithMediaType.setSchema(ramlInRepresentation .getSchema());
MimeType ramlInRepresentationWithMediaType; for (String mediaType : operation.getConsumes()) { ramlInRepresentationWithMediaType = new MimeType(); ramlInRepresentationWithMediaType.setSchema(ramlInRepresentation .getSchema());
MimeType ramlInRepresentationWithMediaType; for (String mediaType : operation.getConsumes()) { ramlInRepresentationWithMediaType = new MimeType(); ramlInRepresentationWithMediaType.setSchema(ramlInRepresentation .getSchema());
MimeType ramlInRepresentationWithMediaType; for (String mediaType : operation.getConsumes()) { ramlInRepresentationWithMediaType = new MimeType(); ramlInRepresentationWithMediaType.setSchema(ramlInRepresentation .getSchema());
MimeType ramlInRepresentationWithMediaType; for (String mediaType : operation.getConsumes()) { ramlInRepresentationWithMediaType = new MimeType(); ramlInRepresentationWithMediaType.setSchema(ramlInRepresentation .getSchema());
MimeType ramlInRepresentation = new MimeType(); fillInputRepresentation(m, representationSamples, action, operation, ramlInRepresentation); ramlResponse.setDescription(response.getDescription()); ramlResponse.setBody(new LinkedHashMap<String, MimeType>()); ramlOutRepresentation = new MimeType(); if (Status.isSuccess(response.getCode()) && response.getOutputPayLoad() != null MimeType ramlOutRepresentationWithMediaType; for (String mediaType : operation.getProduces()) { ramlOutRepresentationWithMediaType = new MimeType(); ramlOutRepresentationWithMediaType .setSchema(ramlOutRepresentation
MimeType ramlInRepresentation = new MimeType(); fillInputRepresentation(m, representationSamples, action, operation, ramlInRepresentation); ramlResponse.setDescription(response.getDescription()); ramlResponse.setBody(new LinkedHashMap<String, MimeType>()); ramlOutRepresentation = new MimeType(); if (Status.isSuccess(response.getCode()) && response.getOutputPayLoad() != null MimeType ramlOutRepresentationWithMediaType; for (String mediaType : operation.getProduces()) { ramlOutRepresentationWithMediaType = new MimeType(); ramlOutRepresentationWithMediaType .setSchema(ramlOutRepresentation
MimeType ramlInRepresentation = new MimeType(); fillInputRepresentation(m, representationSamples, action, operation, ramlInRepresentation); ramlResponse.setDescription(response.getDescription()); ramlResponse.setBody(new LinkedHashMap<String, MimeType>()); ramlOutRepresentation = new MimeType(); if (Status.isSuccess(response.getCode()) && response.getOutputPayLoad() != null MimeType ramlOutRepresentationWithMediaType; for (String mediaType : operation.getProduces()) { ramlOutRepresentationWithMediaType = new MimeType(); ramlOutRepresentationWithMediaType .setSchema(ramlOutRepresentation
MimeType ramlInRepresentation = new MimeType(); fillInputRepresentation(m, representationSamples, action, operation, ramlInRepresentation); ramlResponse.setDescription(response.getDescription()); ramlResponse.setBody(new LinkedHashMap<String, MimeType>()); ramlOutRepresentation = new MimeType(); if (Status.isSuccess(response.getCode()) && response.getOutputPayLoad() != null MimeType ramlOutRepresentationWithMediaType; for (String mediaType : operation.getProduces()) { ramlOutRepresentationWithMediaType = new MimeType(); ramlOutRepresentationWithMediaType .setSchema(ramlOutRepresentation
MimeType ramlInRepresentation = new MimeType(); fillInputRepresentation(m, representationSamples, action, operation, ramlInRepresentation); ramlResponse.setDescription(response.getDescription()); ramlResponse.setBody(new LinkedHashMap<String, MimeType>()); ramlOutRepresentation = new MimeType(); if (Status.isSuccess(response.getCode()) && response.getOutputPayLoad() != null MimeType ramlOutRepresentationWithMediaType; for (String mediaType : operation.getProduces()) { ramlOutRepresentationWithMediaType = new MimeType(); ramlOutRepresentationWithMediaType .setSchema(ramlOutRepresentation