/** * Returns true if the given message has a resource type else false. * * @param message {@link com.modelsolv.reprezen.restapi.TypedMessage} to check * @return Boolean */ public Boolean hasResourceType(TypedMessage message) { return message.getResourceType() != null; }
private boolean hasResourceType(final TypedMessage message) { ResourceDefinition _resourceType = message.getResourceType(); return (_resourceType != null); }
private Structure getMsgResourceDataType(final TypedMessage msg) { ResourceDefinition _resourceType = msg.getResourceType(); Structure _resourceDataType = null; if (_resourceType!=null) { _resourceDataType=this.getResourceDataType(_resourceType); } return _resourceDataType; }
public static RealizationContext of(final TypedMessage message) { RealizationContext _xifexpression = null; ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleNotEquals = (_resourceType != null); if (_tripleNotEquals) { ResourceDefinition _resourceType_1 = message.getResourceType(); _xifexpression = new RealizationContext.ResourceRealizationContext(((ServiceDataResource) _resourceType_1)); } else { _xifexpression = new RealizationContext.MessageRealizationContext(message); } return _xifexpression; }
private boolean showMessageDataType(final TypedMessage message) { return ((message.getActualType() != null) && (message.getResourceType() == null)); }
private boolean hasDataType(final TypedMessage message) { return ((message.getActualType() != null) || (message.getResourceType() != null)); }
public String getDefinitionName(final TypedMessage message) { if ((message == null)) { return null; } String _xifexpression = null; Structure _actualType = message.getActualType(); boolean _tripleNotEquals = (_actualType != null); if (_tripleNotEquals) { _xifexpression = this.jsonSchemaGenerator.getDefinitionName(message); } else { String _xifexpression_1 = null; ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleNotEquals_1 = (_resourceType != null); if (_tripleNotEquals_1) { ResourceDefinition _resourceType_1 = message.getResourceType(); _xifexpression_1 = this.jsonSchemaGenerator.getDefinitionName(((ServiceDataResource) _resourceType_1)); } else { _xifexpression_1 = null; } _xifexpression = _xifexpression_1; } String typeName = _xifexpression; return typeName; }
protected String getMessageType(final TypedMessage message, final Class<?> defaultValue, final String nullValue) { if ((message == null)) { return nullValue; } EObject _xifexpression = null; ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleNotEquals = (_resourceType != null); if (_tripleNotEquals) { _xifexpression = message.getResourceType(); } else { _xifexpression = message.getDataType(); } final Object zenMessageType = _xifexpression; if ((zenMessageType != null)) { boolean _containsRow = this.zenElement2ClassQName.containsRow(zenMessageType); boolean _not = (!_containsRow); if (_not) { return this.getTypeName(defaultValue); } final String className = this.zenElement2ClassQName.get(zenMessageType, "jaxbClassName"); String _get = this.zenElement2ClassQName.get(zenMessageType, "jaxbPackageName"); String _plus = (_get + "."); String _plus_1 = (_plus + className); this.addImport(_plus_1); return className; } return this.getTypeName(defaultValue); }
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; } }
protected void processMessage(TypedMessage message) { if (message.getActualType() == null) { // no realization processing required for a dataless message return; } maybeSetWithDefaultRealization(message); if (message.getResourceType() instanceof ServiceDataResource // instanceof also checks for non-null && ((ServiceDataResource) message.getResourceType()).isWithDefaultRealization()) { message.setWithDefaultRealization(true); message.setEffectiveRealization( ((ServiceDataResource) message.getResourceType()).getEffectiveRealization()); } if (message.getResourceType() != null) { // should re-use realization of the resource return; } if (message.isWithDefaultRealization()) { RealizationRule rule = autoRealizationProcessor.processMessage(message); if (rule != null) { storeAutoRealization(message).accept(rule); } } if (message.getActualType() != null) { referenceTreatmentNormalizer.normalizeUserDefinedReferenceTreatments(message, message.getActualType()); } processNestedReferenceTreatments(message, message); }
public String getMessageDocumentation(final TypedMessage message) { String result = this._zenModelHelper.getDocumentation(message); boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(result); if (_isNullOrEmpty) { Structure _xifexpression = null; Structure _actualType = message.getActualType(); boolean _tripleNotEquals = (_actualType != null); if (_tripleNotEquals) { _xifexpression = message.getActualType(); } else { Structure _xifexpression_1 = null; ResourceDefinition _resourceType = message.getResourceType(); if ((_resourceType instanceof ServiceDataResource)) { ResourceDefinition _resourceType_1 = message.getResourceType(); _xifexpression_1 = ((ServiceDataResource) _resourceType_1).getDataType(); } _xifexpression = _xifexpression_1; } final Structure dataType = _xifexpression; if ((dataType != null)) { result = this._zenModelHelper.getDocumentation(dataType); } } return result; }
public static EList<Example> getAllExamples(TypedMessage message) { if (!message.getExamples().isEmpty()) { return message.getExamples(); } ResourceDefinition resource = message.getResourceType(); if (resource != null) { EList<Example> resourceExamples = resource.getExamples(); if (!resourceExamples.isEmpty()) { return resourceExamples; } if (resource instanceof ServiceDataResource) { Structure dataType = ((ServiceDataResource) resource).getDataType(); List<Example> result = new ArrayList<Example>(dataType.getDataExamples().size()); for (DataExample dataExample : dataType.getDataExamples()) { result.add(toExample(dataExample)); } return ECollections.asEList(result); } } return ECollections.emptyEList(); }
ServiceDataResource dataResource = (ServiceDataResource) resourceDefinition; final String actualTypeName = message.getResourceType().getName(); final String expectedTypeName = dataResource.getName();
private CharSequence generateRepresentationParameters(final TypedMessage message, final MediaType mediaType, final ServiceDataResource containingDataResource) { CharSequence _xifexpression = null; ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleEquals = (_resourceType == null); if (_tripleEquals) { StringConcatenation _builder = new StringConcatenation(); { Iterable<ReferenceLink> _filter = Iterables.<ReferenceLink>filter(message.getReferenceTreatments(), ReferenceLink.class); for(final ReferenceLink referenceLink : _filter) { CharSequence _generateRepresentationParameter = this.generateRepresentationParameter(referenceLink, mediaType, this._wadlHelper.getMessageTypeName(message), containingDataResource); _builder.append(_generateRepresentationParameter); _builder.newLineIfNotEmpty(); } } _xifexpression = _builder; } else { StringConcatenation _builder_1 = new StringConcatenation(); CharSequence _generateRepresentationParameters = this.generateRepresentationParameters(this._wadlHelper.<ResourceDefinition>getEContainer(message, ResourceDefinition.class), mediaType); _builder_1.append(_generateRepresentationParameters); _xifexpression = _builder_1; } return _xifexpression; }
if ((typeName != null)) { String _xifexpression_1 = null; ResourceDefinition _resourceType = msg.getResourceType(); if ((_resourceType instanceof CollectionResource)) { StringConcatenation _builder = new StringConcatenation();
private CharSequence generateRepresentationElement(final TypedMessage message, final MediaType mediaType) { CharSequence _xifexpression = null; boolean _supportsJaxb = this._wadlHelper.supportsJaxb(mediaType); if (_supportsJaxb) { CharSequence _xifexpression_1 = null; ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleEquals = (_resourceType == null); if (_tripleEquals) { StringConcatenation _builder = new StringConcatenation(); _builder.append("element=\""); String _nsPrefix = this.traceHelper.getNsPrefix(this._wadlHelper.<ResourceAPI>getEContainer(message, ResourceAPI.class)); _builder.append(_nsPrefix); _builder.append(":"); String _firstLower = StringExtensions.toFirstLower(this._wadlHelper.getMessageTypeName(message)); _builder.append(_firstLower); _builder.append("\""); _xifexpression_1 = _builder; } else { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("element=\""); String _complexTypeQName = this.traceHelper.getComplexTypeQName(message.getResourceType()); _builder_1.append(_complexTypeQName); _builder_1.append("\""); _xifexpression_1 = _builder_1; } _xifexpression = _xifexpression_1; } return _xifexpression; }
private CharSequence generateMessageName(final TypedMessage message) { StringConcatenation _builder = new StringConcatenation(); ResourceDefinition _resourceType = message.getResourceType(); boolean _tripleNotEquals = (_resourceType != null); if (_tripleNotEquals) { _builder.newLine(); _builder.append("<a href=\"#"); String _htmlLink = this.docHelper.htmlLink(message.getResourceType()); _builder.append(_htmlLink); _builder.append("\">"); String _name = message.getResourceType().getName(); _builder.append(_name); _builder.append("</a>");