Search in sources :

Example 1 with Param

use of org.eclipse.vorto.repository.api.content.Param in project vorto by eclipse.

the class ModelDtoFactory method createParam.

private static Param createParam(org.eclipse.vorto.core.api.model.functionblock.Param p) {
    Param param = new Param();
    param.setDescription(p.getDescription());
    param.setMultiple(p.isMultiplicity());
    param.setName(p.getName());
    if (p instanceof PrimitiveParam) {
        PrimitiveType pt = ((PrimitiveParam) p).getType();
        param.setType(org.eclipse.vorto.repository.api.content.PrimitiveType.valueOf(pt.name()));
        if (((PrimitiveParam) p).getConstraintRule() != null && ((PrimitiveParam) p).getConstraintRule().getConstraints() != null) {
            List<Constraint> constraints = ((PrimitiveParam) p).getConstraintRule().getConstraints().stream().map(c -> createConstraint(c)).collect(Collectors.toList());
            param.setConstraints(constraints);
        }
    } else {
        param.setType(createModelId(((RefParam) p).getType()));
    }
    return param;
}
Also used : InformationModel(org.eclipse.vorto.core.api.model.informationmodel.InformationModel) EntitySource(org.eclipse.vorto.core.api.model.mapping.EntitySource) ReturnPrimitiveType(org.eclipse.vorto.core.api.model.functionblock.ReturnPrimitiveType) Event(org.eclipse.vorto.core.api.model.functionblock.Event) PropertyAttribute(org.eclipse.vorto.core.api.model.datatype.PropertyAttribute) BooleanPropertyAttribute(org.eclipse.vorto.core.api.model.datatype.BooleanPropertyAttribute) Entity(org.eclipse.vorto.core.api.model.datatype.Entity) Attribute(org.eclipse.vorto.core.api.model.mapping.Attribute) BooleanAttributeProperty(org.eclipse.vorto.repository.api.content.BooleanAttributeProperty) PrimitivePropertyType(org.eclipse.vorto.core.api.model.datatype.PrimitivePropertyType) RefParam(org.eclipse.vorto.core.api.model.functionblock.RefParam) ModelProperty(org.eclipse.vorto.repository.api.content.ModelProperty) Map(java.util.Map) ReturnObjectType(org.eclipse.vorto.core.api.model.functionblock.ReturnObjectType) AbstractModel(org.eclipse.vorto.repository.api.AbstractModel) ModelId(org.eclipse.vorto.repository.api.ModelId) EnumAttributePropertyType(org.eclipse.vorto.repository.api.content.EnumAttributePropertyType) Infomodel(org.eclipse.vorto.repository.api.content.Infomodel) ConfigurationSource(org.eclipse.vorto.core.api.model.mapping.ConfigurationSource) InfoModelPropertySource(org.eclipse.vorto.core.api.model.mapping.InfoModelPropertySource) EntityModel(org.eclipse.vorto.repository.api.content.EntityModel) Collectors(java.util.stream.Collectors) List(java.util.List) BooleanAttributePropertyType(org.eclipse.vorto.repository.api.content.BooleanAttributePropertyType) FunctionblockModel(org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel) ReturnType(org.eclipse.vorto.repository.api.content.ReturnType) Optional(java.util.Optional) IPropertyAttribute(org.eclipse.vorto.repository.api.content.IPropertyAttribute) EnumLiteral(org.eclipse.vorto.repository.api.content.EnumLiteral) Stereotype(org.eclipse.vorto.repository.api.content.Stereotype) EnumAttributeProperty(org.eclipse.vorto.repository.api.content.EnumAttributeProperty) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty) MappingModel(org.eclipse.vorto.core.api.model.mapping.MappingModel) ConstraintType(org.eclipse.vorto.repository.api.content.ConstraintType) FunctionBlockAttributeSource(org.eclipse.vorto.core.api.model.mapping.FunctionBlockAttributeSource) StatusSource(org.eclipse.vorto.core.api.model.mapping.StatusSource) Model(org.eclipse.vorto.core.api.model.model.Model) ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) Property(org.eclipse.vorto.core.api.model.datatype.Property) PrimitiveParam(org.eclipse.vorto.core.api.model.functionblock.PrimitiveParam) MappingRule(org.eclipse.vorto.core.api.model.mapping.MappingRule) StereoTypeTarget(org.eclipse.vorto.core.api.model.mapping.StereoTypeTarget) Enum(org.eclipse.vorto.core.api.model.datatype.Enum) ModelType(org.eclipse.vorto.repository.api.ModelType) ModelReference(org.eclipse.vorto.core.api.model.model.ModelReference) InfoModelAttributeSource(org.eclipse.vorto.core.api.model.mapping.InfoModelAttributeSource) Param(org.eclipse.vorto.repository.api.content.Param) ReferenceTarget(org.eclipse.vorto.core.api.model.mapping.ReferenceTarget) FunctionBlockPropertySource(org.eclipse.vorto.core.api.model.mapping.FunctionBlockPropertySource) EnumLiteralPropertyAttribute(org.eclipse.vorto.core.api.model.datatype.EnumLiteralPropertyAttribute) Source(org.eclipse.vorto.core.api.model.mapping.Source) Operation(org.eclipse.vorto.repository.api.content.Operation) FaultSource(org.eclipse.vorto.core.api.model.mapping.FaultSource) Constraint(org.eclipse.vorto.repository.api.content.Constraint) ModelEvent(org.eclipse.vorto.repository.api.content.ModelEvent) ObjectPropertyType(org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType) EnumModel(org.eclipse.vorto.repository.api.content.EnumModel) PrimitiveType(org.eclipse.vorto.core.api.model.datatype.PrimitiveType) RefParam(org.eclipse.vorto.core.api.model.functionblock.RefParam) Constraint(org.eclipse.vorto.repository.api.content.Constraint) RefParam(org.eclipse.vorto.core.api.model.functionblock.RefParam) PrimitiveParam(org.eclipse.vorto.core.api.model.functionblock.PrimitiveParam) Param(org.eclipse.vorto.repository.api.content.Param) PrimitiveParam(org.eclipse.vorto.core.api.model.functionblock.PrimitiveParam) ReturnPrimitiveType(org.eclipse.vorto.core.api.model.functionblock.ReturnPrimitiveType) PrimitiveType(org.eclipse.vorto.core.api.model.datatype.PrimitiveType)

Aggregations

List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 BooleanPropertyAttribute (org.eclipse.vorto.core.api.model.datatype.BooleanPropertyAttribute)1 Entity (org.eclipse.vorto.core.api.model.datatype.Entity)1 Enum (org.eclipse.vorto.core.api.model.datatype.Enum)1 EnumLiteralPropertyAttribute (org.eclipse.vorto.core.api.model.datatype.EnumLiteralPropertyAttribute)1 ObjectPropertyType (org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType)1 PrimitivePropertyType (org.eclipse.vorto.core.api.model.datatype.PrimitivePropertyType)1 PrimitiveType (org.eclipse.vorto.core.api.model.datatype.PrimitiveType)1 Property (org.eclipse.vorto.core.api.model.datatype.Property)1 PropertyAttribute (org.eclipse.vorto.core.api.model.datatype.PropertyAttribute)1 Event (org.eclipse.vorto.core.api.model.functionblock.Event)1 FunctionblockModel (org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel)1 PrimitiveParam (org.eclipse.vorto.core.api.model.functionblock.PrimitiveParam)1 RefParam (org.eclipse.vorto.core.api.model.functionblock.RefParam)1 ReturnObjectType (org.eclipse.vorto.core.api.model.functionblock.ReturnObjectType)1 ReturnPrimitiveType (org.eclipse.vorto.core.api.model.functionblock.ReturnPrimitiveType)1 FunctionblockProperty (org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty)1