Search in sources :

Example 1 with ParameterDefinition

use of org.eclipse.winery.model.tosca.extensions.kvproperties.ParameterDefinition in project winery by eclipse.

the class ToCanonical method convert.

public TActivityDefinition convert(YTMapActivityDefinition node) {
    if (Objects.isNull(node) || node.getMap().isEmpty()) {
        return null;
    }
    for (YTActivityDefinition value : node.getMap().values()) {
        if (value instanceof YTCallOperationActivityDefinition) {
            YTCallOperationActivityDefinition yamlDef = (YTCallOperationActivityDefinition) value;
            TCallOperationActivityDefinition canonicalDef = new TCallOperationActivityDefinition(yamlDef.getOperation());
            List<ParameterDefinition> inputs = yamlDef.getInputs().entrySet().stream().map(entry -> convert(entry.getValue(), entry.getKey())).collect(Collectors.toList());
            canonicalDef.setInputs(inputs);
            return canonicalDef;
        }
    }
    return null;
}
Also used : TEventFilterDefinition(org.eclipse.winery.model.tosca.TEventFilterDefinition) Arrays(java.util.Arrays) TBoundaryDefinitions(org.eclipse.winery.model.tosca.TBoundaryDefinitions) YTImportDefinition(org.eclipse.winery.model.tosca.yaml.YTImportDefinition) TArtifact(org.eclipse.winery.model.tosca.TArtifact) ValueHelper(org.eclipse.winery.model.tosca.yaml.support.ValueHelper) HasInheritance(org.eclipse.winery.model.tosca.HasInheritance) StringUtils(org.apache.commons.lang3.StringUtils) YTTriggerDefinition(org.eclipse.winery.model.tosca.yaml.YTTriggerDefinition) EncodingUtil(org.eclipse.winery.model.ids.EncodingUtil) TRelationshipTypeImplementation(org.eclipse.winery.model.tosca.TRelationshipTypeImplementation) YTPolicyDefinition(org.eclipse.winery.model.tosca.yaml.YTPolicyDefinition) YTRequirementDefinition(org.eclipse.winery.model.tosca.yaml.YTRequirementDefinition) YTMapActivityDefinition(org.eclipse.winery.model.tosca.yaml.support.YTMapActivityDefinition) Map(java.util.Map) TArtifactType(org.eclipse.winery.model.tosca.TArtifactType) Defaults(org.eclipse.winery.model.converter.support.Defaults) TDefinitions(org.eclipse.winery.model.tosca.TDefinitions) TEntityType(org.eclipse.winery.model.tosca.TEntityType) TActivityDefinition(org.eclipse.winery.model.tosca.TActivityDefinition) Set(java.util.Set) TImplementation(org.eclipse.winery.model.tosca.TImplementation) YTTopologyTemplateDefinition(org.eclipse.winery.model.tosca.yaml.YTTopologyTemplateDefinition) YTPropertyAssignment(org.eclipse.winery.model.tosca.yaml.YTPropertyAssignment) Stream(java.util.stream.Stream) YTGroupDefinition(org.eclipse.winery.model.tosca.yaml.YTGroupDefinition) YTPropertyDefinition(org.eclipse.winery.model.tosca.yaml.YTPropertyDefinition) TCapability(org.eclipse.winery.model.tosca.TCapability) YTRequirementAssignment(org.eclipse.winery.model.tosca.yaml.YTRequirementAssignment) QName(javax.xml.namespace.QName) TRequirementType(org.eclipse.winery.model.tosca.TRequirementType) NonNull(org.eclipse.jdt.annotation.NonNull) TPolicy(org.eclipse.winery.model.tosca.TPolicy) YTNodeType(org.eclipse.winery.model.tosca.yaml.YTNodeType) TRequirementDefinition(org.eclipse.winery.model.tosca.TRequirementDefinition) TypeConverter(org.eclipse.winery.repository.yaml.converter.support.TypeConverter) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) YTActivityDefinition(org.eclipse.winery.model.tosca.yaml.YTActivityDefinition) YTNodeTemplate(org.eclipse.winery.model.tosca.yaml.YTNodeTemplate) TCapabilityType(org.eclipse.winery.model.tosca.TCapabilityType) TArtifactReference(org.eclipse.winery.model.tosca.TArtifactReference) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) TSchema(org.eclipse.winery.model.tosca.TSchema) YTCapabilityType(org.eclipse.winery.model.tosca.yaml.YTCapabilityType) TCapabilityDefinition(org.eclipse.winery.model.tosca.TCapabilityDefinition) YTOperationDefinition(org.eclipse.winery.model.tosca.yaml.YTOperationDefinition) YTImplementationArtifactDefinition(org.eclipse.winery.repository.yaml.converter.support.extension.YTImplementationArtifactDefinition) File(java.io.File) TArtifactTemplate(org.eclipse.winery.model.tosca.TArtifactTemplate) TCallOperationActivityDefinition(org.eclipse.winery.model.tosca.TCallOperationActivityDefinition) YTEntityType(org.eclipse.winery.model.tosca.yaml.YTEntityType) ParameterDefinition(org.eclipse.winery.model.tosca.extensions.kvproperties.ParameterDefinition) YTSchemaDefinition(org.eclipse.winery.model.tosca.yaml.YTSchemaDefinition) YTServiceTemplate(org.eclipse.winery.model.tosca.yaml.YTServiceTemplate) TNodeTypeImplementation(org.eclipse.winery.model.tosca.TNodeTypeImplementation) TGroupDefinition(org.eclipse.winery.model.tosca.TGroupDefinition) YTGroupType(org.eclipse.winery.model.tosca.yaml.YTGroupType) YTPropertyAssignmentOrDefinition(org.eclipse.winery.model.tosca.yaml.YTPropertyAssignmentOrDefinition) LoggerFactory(org.slf4j.LoggerFactory) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate) TPolicyType(org.eclipse.winery.model.tosca.TPolicyType) Nullable(org.eclipse.jdt.annotation.Nullable) YTRelationshipType(org.eclipse.winery.model.tosca.yaml.YTRelationshipType) InheritanceUtils(org.eclipse.winery.repository.yaml.converter.support.InheritanceUtils) TRequirement(org.eclipse.winery.model.tosca.TRequirement) YTArtifactDefinition(org.eclipse.winery.model.tosca.yaml.YTArtifactDefinition) AttributeDefinition(org.eclipse.winery.model.tosca.extensions.kvproperties.AttributeDefinition) YTInterfaceDefinition(org.eclipse.winery.model.tosca.yaml.YTInterfaceDefinition) TTriggerDefinition(org.eclipse.winery.model.tosca.TTriggerDefinition) YTPolicyType(org.eclipse.winery.model.tosca.yaml.YTPolicyType) YTRelationshipTemplate(org.eclipse.winery.model.tosca.yaml.YTRelationshipTemplate) YTCapabilityAssignment(org.eclipse.winery.model.tosca.yaml.YTCapabilityAssignment) TNodeType(org.eclipse.winery.model.tosca.TNodeType) Collectors(java.util.stream.Collectors) TInterface(org.eclipse.winery.model.tosca.TInterface) YTInterfaceType(org.eclipse.winery.model.tosca.yaml.YTInterfaceType) Objects(java.util.Objects) TInterfaceType(org.eclipse.winery.model.tosca.TInterfaceType) List(java.util.List) IRepository(org.eclipse.winery.repository.backend.IRepository) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact) YTCapabilityDefinition(org.eclipse.winery.model.tosca.yaml.YTCapabilityDefinition) AssignmentBuilder(org.eclipse.winery.repository.yaml.converter.support.AssignmentBuilder) TInterfaceDefinition(org.eclipse.winery.model.tosca.TInterfaceDefinition) YTParameterDefinition(org.eclipse.winery.model.tosca.yaml.YTParameterDefinition) YTCallOperationActivityDefinition(org.eclipse.winery.model.tosca.yaml.YTCallOperationActivityDefinition) TEntityTemplate(org.eclipse.winery.model.tosca.TEntityTemplate) HashMap(java.util.HashMap) YTImplementation(org.eclipse.winery.model.tosca.yaml.YTImplementation) Function(java.util.function.Function) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) HashSet(java.util.HashSet) YTAttributeDefinition(org.eclipse.winery.model.tosca.yaml.YTAttributeDefinition) ConstraintClauseKV(org.eclipse.winery.model.tosca.extensions.kvproperties.ConstraintClauseKV) TParameter(org.eclipse.winery.model.tosca.TParameter) YTArtifactType(org.eclipse.winery.model.tosca.yaml.YTArtifactType) TImport(org.eclipse.winery.model.tosca.TImport) Logger(org.slf4j.Logger) TGroupType(org.eclipse.winery.model.tosca.TGroupType) TImplementationArtifact(org.eclipse.winery.model.tosca.TImplementationArtifact) TOperationDefinition(org.eclipse.winery.model.tosca.TOperationDefinition) TTag(org.eclipse.winery.model.tosca.TTag) TDataType(org.eclipse.winery.model.tosca.TDataType) Namespaces(org.eclipse.winery.model.converter.support.Namespaces) YTMapRequirementAssignment(org.eclipse.winery.model.tosca.yaml.support.YTMapRequirementAssignment) TRelationshipType(org.eclipse.winery.model.tosca.TRelationshipType) TRelationshipTemplate(org.eclipse.winery.model.tosca.TRelationshipTemplate) YTConstraintClause(org.eclipse.winery.model.tosca.yaml.YTConstraintClause) YTDataType(org.eclipse.winery.model.tosca.yaml.YTDataType) Metadata(org.eclipse.winery.model.tosca.yaml.support.Metadata) Collections(java.util.Collections) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) YTActivityDefinition(org.eclipse.winery.model.tosca.yaml.YTActivityDefinition) YTCallOperationActivityDefinition(org.eclipse.winery.model.tosca.yaml.YTCallOperationActivityDefinition) TCallOperationActivityDefinition(org.eclipse.winery.model.tosca.TCallOperationActivityDefinition) YTCallOperationActivityDefinition(org.eclipse.winery.model.tosca.yaml.YTCallOperationActivityDefinition) ParameterDefinition(org.eclipse.winery.model.tosca.extensions.kvproperties.ParameterDefinition) YTParameterDefinition(org.eclipse.winery.model.tosca.yaml.YTParameterDefinition)

Example 2 with ParameterDefinition

use of org.eclipse.winery.model.tosca.extensions.kvproperties.ParameterDefinition in project winery by eclipse.

the class ToCanonical method convert.

private ParameterDefinition convert(YTParameterDefinition node, String name) {
    if (node == null) {
        return null;
    }
    ParameterDefinition p = new ParameterDefinition();
    p.setKey(name);
    p.setType(node.getType());
    p.setDescription(node.getDescription());
    p.setRequired(node.getRequired());
    p.setDefaultValue(ValueHelper.toString(node.getDefault()));
    p.setValue(ValueHelper.toString(node.getValue()));
    return p;
}
Also used : ParameterDefinition(org.eclipse.winery.model.tosca.extensions.kvproperties.ParameterDefinition) YTParameterDefinition(org.eclipse.winery.model.tosca.yaml.YTParameterDefinition)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 QName (javax.xml.namespace.QName)1 StringUtils (org.apache.commons.lang3.StringUtils)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 Defaults (org.eclipse.winery.model.converter.support.Defaults)1 Namespaces (org.eclipse.winery.model.converter.support.Namespaces)1