private String getStatus(final TypedResponse response) { return String.format("%03d", Integer.valueOf(response.getStatusCode())); }
private Structure getStructType(final TypedResponse response) { Structure _elvis = null; ResourceDefinition _resourceType = response.getResourceType(); Structure _dataType = null; if (((ServiceDataResource) _resourceType)!=null) { _dataType=((ServiceDataResource) _resourceType).getDataType(); } if (_dataType != null) { _elvis = _dataType; } else { Structure _dataType_1 = response.getDataType(); _elvis = _dataType_1; } return _elvis; }
public static Method getMethod(final TypedMessage message) { Method _switchResult = null; boolean _matched = false; if (message instanceof TypedRequest) { _matched=true; _switchResult = ((TypedRequest)message).getContainingMethod(); } if (!_matched) { if (message instanceof TypedResponse) { _matched=true; _switchResult = ((TypedResponse)message).getContainingMethod(); } } return _switchResult; }
private EList<ReferenceTreatment> getGoverningReferenceTreatments(final TypedResponse response) { EList<ReferenceTreatment> treatments = response.getReferenceTreatments(); if ((treatments.isEmpty() && (response.getResourceType() != null))) { ResourceDefinition _resourceType = response.getResourceType(); treatments = ((ServiceDataResource) _resourceType).getReferenceTreatments(); } return treatments; }
ResourceDefinition _resourceType = response.getResourceType(); boolean _tripleNotEquals = (_resourceType != null); if (_tripleNotEquals) { _builder.append(" "); _builder.append("\"resource_type\": \""); String _name = response.getResourceType().getName(); _builder.append(_name, " "); _builder.append("\","); _builder.newLineIfNotEmpty(); } else { Structure _dataType = response.getDataType(); boolean _tripleNotEquals_1 = (_dataType != null); if (_tripleNotEquals_1) { _builder.append(" "); _builder.append("\"resource_type\": \""); String _name_1 = response.getDataType().getName(); _builder.append(_name_1, " "); _builder.append("\","); if (((response.getParameters().isEmpty() && (response.getDataType() == null)) && (response.getStatusCode() == (-1)))) { _builder.append("\t"); _builder.append("\"name\": \"(empty response)\","); int _statusCode = response.getStatusCode(); boolean _notEquals = (_statusCode != (-1)); if (_notEquals) { _builder.append("\t"); _builder.append("\"statusCodeGroup\": \"");
int _statusCode = it.getStatusCode(); boolean _greaterThan = (_statusCode > 0); if (_greaterThan) { _xifexpression = Integer.valueOf(it.getStatusCode()).toString(); } else { _xifexpression = "200"; method.getResponses().forEach(_function_2); final Function1<TypedResponse, EList<MediaType>> _function_3 = (TypedResponse it) -> { return it.getMediaTypes(); }; final Function1<MediaType, String> _function_4 = (MediaType it) -> {
final Response swaggerResponse = new Response(); this.setVendorExtensions(((Extensible) rapidResponse), swaggerResponse); final Example example = IterableExtensions.<Example>head(rapidResponse.getAllExamples()); if (((example != null) && (example.getBody() != null))) { final MediaType type = IterableExtensions.<MediaType>head(rapidResponse.getMediaTypes()); if ((type != null)) { swaggerResponse.example(IterableExtensions.<MediaType>head(rapidResponse.getMediaTypes()).getName(), this.renderExample(example.getBody(), type.getName())); rapidResponse.getParameters().forEach(_function); return swaggerResponse;
private List<PropertyRealization> getEnrichmentProperties(final TypedResponse response) { ResourceDefinition _resourceType = response.getResourceType(); final ServiceDataResource resource = ((ServiceDataResource) _resourceType); ResourceDefinition _resourceType_1 = response.getResourceType(); boolean _tripleNotEquals = (_resourceType_1 != null); if (_tripleNotEquals) { final Function1<ReferenceTreatment, Boolean> _function = (ReferenceTreatment it) -> { return Boolean.valueOf(((it instanceof ReferenceLink) && Objects.equal(it.getReferenceElement().getName(), "ObjectResourceLink"))); }; final ReferenceTreatment orLink = IterableExtensions.<ReferenceTreatment>head(IterableExtensions.<ReferenceTreatment>filter(resource.getAllReferenceTreatments(), _function)); if ((orLink != null)) { return Collections.<PropertyRealization>unmodifiableList(CollectionLiterals.<PropertyRealization>newArrayList()); } else { ResourceDefinition _resourceType_2 = response.getResourceType(); return ((ServiceDataResource) _resourceType_2).getProperties().getAllIncludedProperties(); } } else { return response.getProperties().getAllIncludedProperties(); } }
private boolean isMultivalued(final TypedResponse response) { boolean _xifexpression = false; ResourceDefinition _resourceType = response.getResourceType(); boolean _tripleNotEquals = (_resourceType != null); if (_tripleNotEquals) { ResourceDefinition _resourceType_1 = response.getResourceType(); _xifexpression = (_resourceType_1 instanceof CollectionResource); } else { _xifexpression = false; } return _xifexpression; }
protected String generateProducesAnnotation(final Method method) { String _xblockexpression = null; { final TypedResponse response = this.getOKResponse(method); StringConcatenation _builder = new StringConcatenation(); { if ((((response != null) && (!response.getMediaTypes().isEmpty())) && this.hasDataType(response))) { _builder.newLineIfNotEmpty(); _builder.append("@"); String _typeName = this.getTypeName(Produces.class); _builder.append(_typeName); _builder.append("("); final Function1<MediaType, String> _function = (MediaType it) -> { return it.getName(); }; String _annotationParameter = this.toAnnotationParameter(ListExtensions.<MediaType, String>map(response.getMediaTypes(), _function)); _builder.append(_annotationParameter); _builder.append(")"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); } } _xblockexpression = _builder.toString(); } return _xblockexpression; }
_builder.newLineIfNotEmpty(); int _statusCode = response.getStatusCode(); boolean _greaterThan = (_statusCode > 0); if (_greaterThan) { _builder.append("<span class=\"label label-"); String _statusColorCode = XGenerateInterfaces.statusColorCode(Integer.valueOf(response.getStatusCode())); _builder.append(_statusColorCode); _builder.append("\">"); int _statusCode_1 = response.getStatusCode(); _builder.append(_statusCode_1); _builder.append("</span>"); _builder.append("<table class=\"table table-condensed\">"); _builder.newLine(); CharSequence _generateMediaTypes = this.generateMediaTypes(response.getMediaTypes()); _builder.append(_generateMediaTypes); _builder.newLineIfNotEmpty();
EList<TypedResponse> _responses = method.getResponses(); for (final TypedResponse response : _responses) { ResourceDefinition _resourceType_1 = response.getResourceType(); Structure _structure_1 = null; if (_resourceType_1!=null) {
private String generateResponseStatusCode(final TypedResponse response) { String _xblockexpression = null; { final String desc = MethodServices.getResponseStatusCodeDescription(response.getStatusCode()); int _statusCode = response.getStatusCode(); String _xifexpression = null; boolean _isEmpty = desc.isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression = (" - " + desc); } else { _xifexpression = ""; } _xblockexpression = (Integer.valueOf(_statusCode) + _xifexpression); } return _xblockexpression; }
ResourceDefinition _resourceType = response.getResourceType(); Structure _dataType = null; if (((ServiceDataResource) _resourceType)!=null) { _elvis = _dataType; } else { Structure _dataType_1 = response.getDataType(); _elvis = _dataType_1; if (((response.getResourceType() != null) && (response.getResourceType() instanceof CollectionResource))) { _xifexpression_1 = "*"; } else { ResourceDefinition _resourceType_1 = response.getResourceType(); boolean _tripleNotEquals = (_resourceType_1 != null); if (_tripleNotEquals) { _builder.append(" "); _builder.append("as "); String _name = response.getResourceType().getName(); _builder.append(_name, " "); _xifexpression_2 = _builder.toString();
private Method getMethod(final TypedMessage message) { Method _switchResult = null; boolean _matched = false; if (message instanceof TypedRequest) { _matched=true; _switchResult = ((TypedRequest)message).getContainingMethod(); } if (!_matched) { if (message instanceof TypedResponse) { _matched=true; _switchResult = ((TypedResponse)message).getContainingMethod(); } } return _switchResult; } }
protected TypedResponse getOKResponse(final Method method) { final Function1<TypedResponse, Boolean> _function = (TypedResponse it) -> { return Boolean.valueOf(((it.getStatusCode() >= 200) && (it.getStatusCode() < 300))); }; return IterableExtensions.<TypedResponse>findFirst(method.getResponses(), _function); }
private CharSequence generateResponseParameters(final TypedResponse request) { CharSequence _xifexpression = null; if ((request != null)) { CharSequence _xblockexpression = null; { final Method method = request.getContainingMethod(); StringConcatenation _builder = new StringConcatenation(); { Iterable<MessageParameter> _primitiveParameters = this._wadlHelper.getPrimitiveParameters(request); for(final MessageParameter param : _primitiveParameters) { CharSequence _generateResponseParameter = this.generateResponseParameter(param, method); _builder.append(_generateResponseParameter); _builder.newLineIfNotEmpty(); } } _xblockexpression = _builder; } _xifexpression = _xblockexpression; } return _xifexpression; }
int _xifexpression = (int) 0; if (isResponse) { _xifexpression = ((TypedResponse) message).getStatusCode();
private ServiceDataResource getResource(final TypedMessage message) { ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleNotEquals = (_resourceType != null); if (_tripleNotEquals) { ResourceDefinition _resourceType_1 = message.getResourceType(); return ((ServiceDataResource) _resourceType_1); } else { ServiceDataResource _switchResult = null; boolean _matched = false; if (message instanceof TypedRequest) { _matched=true; ResourceDefinition _containingResourceDefinition = ((TypedRequest)message).getContainingMethod().getContainingResourceDefinition(); _switchResult = ((ServiceDataResource) _containingResourceDefinition); } if (!_matched) { if (message instanceof TypedResponse) { _matched=true; ResourceDefinition _containingResourceDefinition = ((TypedResponse)message).getContainingMethod().getContainingResourceDefinition(); _switchResult = ((ServiceDataResource) _containingResourceDefinition); } } return _switchResult; } }
String _format = String.format("%03d", Integer.valueOf(response.getStatusCode())); _builder.append(_format, "\t"); _builder.append("\': ");