private void checkPrimitivePropertyRestrictionType(PrimitiveProperty validatedProperty, Feature overriddenProperty) { SingleValueType typeOverride = validatedProperty.getType(); if (overriddenProperty instanceof PrimitiveProperty) { SingleValueType overriddenType = ((PrimitiveProperty) overriddenProperty).getType(); if (!canSubstitute(typeOverride, overriddenType)) { String message = String.format( "The type of property '%s' is incompatible with inherited property type: '%s'", validatedProperty.getName(), overriddenType.getName()); error(message, validatedProperty, RapidmlPackage.Literals.PRIMITIVE_PROPERTY__TYPE); } } }
private JsonNode createStructureMetadata(Structure struct) { ObjectNode root = newObjectNode(); root.put("name", struct.getName()); ObjectNode fields = root.putObject("fields"); for (PrimitiveProperty prop : struct.getPrimitiveProperties()) { ObjectNode field = fields.putObject(prop.getName()); field.put("name", prop.getName()); field.put("type", prop.getPrimitiveType().getName()); field.put("multi", prop.getMaxOccurs() < 0); } for (ReferenceProperty prop : struct.getReferenceProperties()) { ObjectNode field = fields.putObject(prop.getName()); field.put("name", prop.getName()); field.put("type", "ref"); field.put("multi", prop.getMaxOccurs() < 0); field.put("refType", getRefTypeName(prop)); } return root; }
public static String getStringValue(Object object, StringBuffer result) { if (object instanceof HasStringValue) { if (object instanceof URI) { List<String> segments = new ArrayList<String>(((URI) object).getSegments().size()); for (URISegment segment : ((URI) object).getSegments()) { segments.add(segment.toString()); } return Joiner.on("/").join(segments); //$NON-NLS-1$ } else if (object instanceof URISegmentWithParameter) { return "{" + ((URISegmentWithParameter) object).getName() + "}"; //$NON-NLS-1$//$NON-NLS-2$ } else if (object instanceof URISegment) { return ((URISegment) object).getName(); } else if (object instanceof PrimitiveProperty) { PrimitiveProperty prop = (PrimitiveProperty) object; result.append(" (name: "); //$NON-NLS-1$ result.append(prop.getName()); result.append(", cardinality: "); //$NON-NLS-1$ result.append(prop.getCardinality()); result.append(", type: "); //$NON-NLS-1$ result.append(prop.getType()); result.append(')'); return result.toString(); } else { return null; } } return object.toString(); }
private boolean isEnumField(final Feature field) { return ((field instanceof PrimitiveProperty) && (((PrimitiveProperty) field).getType() instanceof Enumeration)); }
PrimitiveProperty inheritedPrimitiveProperty = (PrimitiveProperty) inheritedProperty; PrimitiveProperty newPrimitiveProperty = RapidmlFactory.eINSTANCE.createPrimitiveProperty(); newPrimitiveProperty.setType(inheritedPrimitiveProperty.getType()); List<Constraint> constraintsToCopy = Lists.newArrayList(inheritedPrimitiveProperty.getAllConstraints()); for (PrimitiveProperty nextInheritedProperty : Iterables.filter(inheritedPropertiesForName, PrimitiveProperty.class)) { constraintsToCopy.addAll(nextInheritedProperty.getAllConstraints()); newPrimitiveProperty.getAllConstraints().add(newConstraint);
private CharSequence _generatePropertyType(final PrimitiveProperty property) { StringConcatenation _builder = new StringConcatenation(); { if (((property.getType() instanceof Enumeration) || (property.getType() instanceof UserDefinedType))) { _builder.append("<a href=\"#"); String _htmlLink = this.docHelper.htmlLink(property.getType()); _builder.append(_htmlLink); _builder.append("\">"); String _generateFeatureType = this.generateFeatureType(property); _builder.append(_generateFeatureType); _builder.append("</a>"); _builder.newLineIfNotEmpty(); } else { String _generateFeatureType_1 = this.generateFeatureType(property); _builder.append(_generateFeatureType_1); _builder.newLineIfNotEmpty(); } } CharSequence _generateInlineConstraints = this.docHelper.generateInlineConstraints(property.getAllConstraints()); _builder.append(_generateInlineConstraints); _builder.newLineIfNotEmpty(); return _builder; }
/** * Parameters Helpers */ public String paramName(final SourceReference sourceReference) { return ((PropertyReference) sourceReference).getConceptualFeature().getName(); }
public List<Constraint> getMessageParameterConstraints(final MessageParameter parameter) { final SourceReference ref = parameter.getSourceReference(); boolean _matched = false; if (ref instanceof PropertyReference) { _matched=true; final Function1<PropertyRealization, Boolean> _function = (PropertyRealization it) -> { Feature _baseProperty = it.getBaseProperty(); PrimitiveProperty _conceptualFeature = ((PropertyReference)ref).getConceptualFeature(); return Boolean.valueOf(Objects.equal(_baseProperty, _conceptualFeature)); }; PropertyRealization property = IterableExtensions.<PropertyRealization>findFirst(parameter.getContainingMessage().getIncludedProperties(), _function); if ((property == null)) { return ((PropertyReference)ref).getConceptualFeature().getAllConstraints(); } return property.getAllConstraints(); } return null; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public com.reprezen.rapidml.PrimitiveType getPrimitiveType() { if (getBaseProperty() instanceof PrimitiveProperty) { return ((PrimitiveProperty) getBaseProperty()).getPrimitiveType(); } return null; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public com.reprezen.rapidml.PrimitiveProperty getConceptualFeature() { if (conceptualFeature != null && conceptualFeature.eIsProxy()) { InternalEObject oldConceptualFeature = (InternalEObject)conceptualFeature; conceptualFeature = (com.reprezen.rapidml.PrimitiveProperty)eResolveProxy(oldConceptualFeature); if (conceptualFeature != oldConceptualFeature) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, RapidmlPackage.PROPERTY_REFERENCE__CONCEPTUAL_FEATURE, oldConceptualFeature, conceptualFeature)); } } return conceptualFeature; }
protected Collection<Enumeration> _getUsedEnums(final PrimitiveProperty pp) { List<Enumeration> _xifexpression = null; SingleValueType _type = pp.getType(); if ((_type instanceof Enumeration)) { SingleValueType _type_1 = pp.getType(); _xifexpression = Collections.<Enumeration>singletonList(((Enumeration) _type_1)); } else { _xifexpression = Collections.<Enumeration>emptyList(); } return _xifexpression; }
_builder.append(": \'"); SourceReference _sourceReference = param.getSourceReference(); String _name_1 = ((PropertyReference) _sourceReference).getConceptualFeature().getName(); _builder.append(_name_1, "\t"); _builder.append("\'");
private void processPropertyOverride(Feature declaredProperty, Iterable<Feature> overriddenPropertyHierarchy) { if (declaredProperty instanceof PrimitiveProperty) { PrimitiveProperty declaredPrimitiveProperty = (PrimitiveProperty) declaredProperty; for (PrimitiveProperty overriddenProperty : Iterables.filter(overriddenPropertyHierarchy, PrimitiveProperty.class)) { EList<Constraint> constraintsToCopy = overriddenProperty.getAllConstraints(); for (Constraint next : constraintsToCopy) { Constraint newConstraint = EcoreUtil.copy(next); declaredPrimitiveProperty.getAllConstraints().add(newConstraint); } } } if (declaredProperty.getDocumentation() == null) { for (Feature next : overriddenPropertyHierarchy) { if (next.getDocumentation() != null) { Documentation documentation = RapidmlFactory.eINSTANCE.createDocumentation(); documentation.setText(next.getDocumentation().getText()); declaredProperty.setDocumentation(documentation); } } } if (declaredProperty.getCardinality() == null) { for (Feature next : overriddenPropertyHierarchy) { if (next.getCardinality() != null) { declaredProperty.setCardinality(next.getCardinality()); } } } }
_builder.append(" "); _builder.append("\"name\": \""); String _name = feature.getName(); _builder.append(_name, " "); _builder.append("\","); _builder.append(" "); _builder.append("\"type\": \""); String _name_1 = feature.getType().getName(); _builder.append(_name_1, " "); _builder.append("\","); String _name_2 = feature.getName(); String _plus_1 = (_plus + _name_2); _builder.append(_plus_1, " ");
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public com.reprezen.rapidml.SingleValueType getType() { return getConceptualFeature().getType(); }
if (primFieldSkeleton != null) { for (PrimitiveProperty prop : ((Structure) s).getAllPrimitiveProperties()) { ObjectNode propNode = fieldRoot.putObject(prop.getName()); if (primFieldSkeleton != null) { propNode.setAll(primFieldSkeleton);
public String primitiveFeatureType(final PrimitiveProperty primitiveProperty) { return primitiveProperty.getType().getName(); }
_builder.append("\"property\": \""); SourceReference _sourceReference_2 = parameter.getSourceReference(); String _name = ((PropertyReference) _sourceReference_2).getConceptualFeature().getName(); _builder.append(_name, " "); _builder.append("\",");
protected Collection<UserDefinedType> _getUsedUserDefinedTypes(final PrimitiveProperty pp) { List<UserDefinedType> _xifexpression = null; SingleValueType _type = pp.getType(); if ((_type instanceof UserDefinedType)) { List<UserDefinedType> _xblockexpression = null; { List<UserDefinedType> list = new ArrayList<UserDefinedType>(); SingleValueType _type_1 = pp.getType(); list.add(((UserDefinedType) _type_1)); SingleValueType _type_2 = pp.getType(); SimpleType parent = ((UserDefinedType) _type_2).getBaseType(); while ((parent instanceof UserDefinedType)) { { list.add(((UserDefinedType) parent)); parent = ((UserDefinedType) parent).getBaseType(); } } _xblockexpression = list; } _xifexpression = _xblockexpression; } else { _xifexpression = Collections.<UserDefinedType>emptyList(); } return _xifexpression; }