Search in sources :

Example 21 with PropertyType

use of org.osate.aadl2.PropertyType in project osate2 by osate.

the class NamedElementImpl method checkPropertyAssociation.

/**
 * Check that the proposed association is legal.
 */
public void checkPropertyAssociation(final Property pd, final Collection<? extends PropertyExpression> vals) {
    // Check that the property applies to this element
    if (!acceptsProperty(pd)) {
        throw new IllegalArgumentException("Property " + pd.getName() + " does not apply to " + getName());
    }
    final boolean isList = pd.isList();
    if (!isList) {
        if (vals.size() == 0) {
            throw new IllegalArgumentException("Cannot assign an empty list to the non-list property " + pd.getName());
        } else if (vals.size() > 1) {
            throw new IllegalArgumentException("Cannot assign a list of values to the non-list property " + pd.getName());
        }
    }
    final PropertyType pt = (PropertyType) pd.getType();
    if (pt == null) {
        return;
    // for (final Iterator<? extends PropertyExpression> i =
    // vals.iterator(); i.hasNext();) {
    // final PropertyExpression pv = i.next();
    // final String msg = pt.containsValue(isList, pv);
    // if (msg != PropertyType.VALUE_OKAY) {
    // throw new IllegalArgumentException("Type mismatch: " + msg);
    // }
    // }
    }
}
Also used : PropertyType(org.osate.aadl2.PropertyType)

Example 22 with PropertyType

use of org.osate.aadl2.PropertyType in project geo-platform by geosdi.

the class AbstractTranctionUpdate method getPropertyToUpdate.

/**
 * @param attributes
 * @return {@link List<PropertyType>}
 * @throws Exception
 */
final List<PropertyType> getPropertyToUpdate(@Nonnull(when = NEVER) List<AttributeDTO> attributes) throws Exception {
    checkArgument((attributes != null) && !(attributes.isEmpty()), "The Parameter attributes must not be null or empty.");
    List<PropertyType> properties = Lists.newArrayListWithCapacity(attributes.size());
    for (AttributeDTO attribute : attributes) {
        if (!attribute.isNillable() && attribute.getValue() == null) {
            throw new IllegalParameterFault("Property '" + attribute.getName() + "' cannot be null.");
        }
        PropertyType property = new PropertyType();
        QName qName = new QName(attribute.getName());
        property.setName(qName);
        property.setValue(((attribute instanceof GeometryAttributeDTO) ? createGeometry((GeometryAttributeDTO) attribute) : attribute.getValue()));
        properties.add(property);
    }
    return properties;
}
Also used : GeometryAttributeDTO(org.geosdi.geoplatform.connector.wfs.response.GeometryAttributeDTO) AttributeDTO(org.geosdi.geoplatform.connector.wfs.response.AttributeDTO) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) QName(javax.xml.namespace.QName) GeometryAttributeDTO(org.geosdi.geoplatform.connector.wfs.response.GeometryAttributeDTO) PropertyType(org.geosdi.geoplatform.xml.wfs.v110.PropertyType)

Example 23 with PropertyType

use of org.osate.aadl2.PropertyType in project osate2 by osate.

the class ReqValDeclarationImpl method basicSetProperty.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetProperty(PropertyType newProperty, NotificationChain msgs) {
    PropertyType oldProperty = property;
    property = newProperty;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReqSpecPackage.REQ_VAL_DECLARATION__PROPERTY, oldProperty, newProperty);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) PropertyType(org.osate.aadl2.PropertyType)

Example 24 with PropertyType

use of org.osate.aadl2.PropertyType in project osate2 by osate.

the class AadlBaUtils method getDataRepresentation.

/**
 * Returns the data representation associated to the given PropertyReference
 * object <BR><BR>
 * Note : {@link #getDataRepresentation(PropertyType)} and
 * {@link #getDataRepresentation(PropertyExpression)} to see restrictions.
 * <BR><BR>
 * @param pv the given PropertyReference object
 * @return the data representation associated to the given
 * PropertyReference object
 * @exception UnsupportedOperationException for the unsupported types
 */
public static DataRepresentation getDataRepresentation(PropertyReference pr) {
    EList<PropertyNameHolder> holders = pr.getProperties();
    PropertyNameHolder last = holders.get(holders.size() - 1);
    Element el = last.getProperty().getElement();
    if (el instanceof PropertyType || el instanceof BasicProperty) {
        return getDataRepresentation(((BasicProperty) el).getPropertyType());
    } else if (el instanceof PropertyAssociation) {
        return getDataRepresentation((PropertyAssociation) el);
    } else if (el instanceof PropertyExpression) {
        return getDataRepresentation((PropertyExpression) el);
    } else if (el instanceof EnumerationLiteral) {
        return DataRepresentation.ENUM_LITERAL;
    } else {
        String errorMsg = "getDataRepresentation: " + el.getClass().getSimpleName() + " is not supported yet.";
        System.err.println(errorMsg);
        throw new UnsupportedOperationException(errorMsg);
    }
}
Also used : BasicProperty(org.osate.aadl2.BasicProperty) PropertyNameHolder(org.osate.ba.aadlba.PropertyNameHolder) PropertyAssociation(org.osate.aadl2.PropertyAssociation) StructUnionElement(org.osate.ba.aadlba.StructUnionElement) BehaviorNamedElement(org.osate.ba.aadlba.BehaviorNamedElement) NamedElement(org.osate.aadl2.NamedElement) ArrayableElement(org.osate.aadl2.ArrayableElement) Element(org.osate.aadl2.Element) BehaviorElement(org.osate.ba.aadlba.BehaviorElement) IndexableElement(org.osate.ba.aadlba.IndexableElement) PropertyExpression(org.osate.aadl2.PropertyExpression) PropertyType(org.osate.aadl2.PropertyType) AadlString(org.osate.aadl2.AadlString) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Example 25 with PropertyType

use of org.osate.aadl2.PropertyType in project osate2 by osate.

the class AadlBaUtils method getPropertyType.

/**
 * Returns the PropertyType object associated to the given PropertyElementHolder
 * given object.
 * @param holder the PropertyElementHolder given object
 * @return the associated PropertyType object
 */
public static PropertyType getPropertyType(PropertyElementHolder holder) {
    PropertyType result = null;
    Element el = holder.getElement();
    if (el instanceof PropertyType) {
        result = (PropertyType) el;
    } else if (el instanceof BasicProperty) {
        result = ((BasicProperty) el).getPropertyType();
    } else if (el instanceof PropertyAssociation) {
        result = ((PropertyAssociation) el).getProperty().getPropertyType();
    } else if (el instanceof PropertyExpression) {
        result = PropertyUtils.getContainingProperty((PropertyExpression) el).getPropertyType();
    } else if (el instanceof EnumerationLiteral) {
        result = (EnumerationType) el.eContainer();
    }
    return result;
}
Also used : BasicProperty(org.osate.aadl2.BasicProperty) PropertyAssociation(org.osate.aadl2.PropertyAssociation) StructUnionElement(org.osate.ba.aadlba.StructUnionElement) BehaviorNamedElement(org.osate.ba.aadlba.BehaviorNamedElement) NamedElement(org.osate.aadl2.NamedElement) ArrayableElement(org.osate.aadl2.ArrayableElement) Element(org.osate.aadl2.Element) BehaviorElement(org.osate.ba.aadlba.BehaviorElement) IndexableElement(org.osate.ba.aadlba.IndexableElement) PropertyExpression(org.osate.aadl2.PropertyExpression) PropertyType(org.osate.aadl2.PropertyType) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Aggregations

PropertyType (org.osate.aadl2.PropertyType)35 Property (org.osate.aadl2.Property)13 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)12 PropertyExpression (org.osate.aadl2.PropertyExpression)8 BasicProperty (org.osate.aadl2.BasicProperty)7 NamedElement (org.osate.aadl2.NamedElement)7 PropertyAssociation (org.osate.aadl2.PropertyAssociation)5 PropertyConstant (org.osate.aadl2.PropertyConstant)5 EObject (org.eclipse.emf.ecore.EObject)4 ArraySizeProperty (org.osate.aadl2.ArraySizeProperty)4 EnumerationLiteral (org.osate.aadl2.EnumerationLiteral)4 PropertySet (org.osate.aadl2.PropertySet)4 AadlPackage (org.osate.aadl2.AadlPackage)3 Element (org.osate.aadl2.Element)3 PackageSection (org.osate.aadl2.PackageSection)3 List (java.util.List)2 QName (javax.xml.namespace.QName)2 EOperation (org.eclipse.emf.ecore.EOperation)2 EReference (org.eclipse.emf.ecore.EReference)2 AadlString (org.osate.aadl2.AadlString)2