Search in sources :

Example 1 with YTMapRequirementDefinition

use of org.eclipse.winery.model.tosca.yaml.support.YTMapRequirementDefinition in project winery by eclipse.

the class FromCanonical method convert.

public YTMapRequirementDefinition convert(TRequirementDefinition node) {
    if (Objects.isNull(node)) {
        return null;
    }
    YTRequirementDefinition.Builder builder = new YTRequirementDefinition.Builder(node.getCapability()).setDescription(convertDocumentation(node.getDocumentation())).setOccurrences(node.getLowerBound(), node.getUpperBound()).setNode(node.getNode());
    if (node.getRelationship() != null) {
        YTRelationshipDefinition.Builder relationshipDefBuilder = new YTRelationshipDefinition.Builder(node.getRelationship());
        builder = builder.setRelationship(relationshipDefBuilder.build());
    }
    return new YTMapRequirementDefinition().setMap(Collections.singletonMap(node.getName(), builder.build()));
}
Also used : YTRelationshipDefinition(org.eclipse.winery.model.tosca.yaml.YTRelationshipDefinition) YTRequirementDefinition(org.eclipse.winery.model.tosca.yaml.YTRequirementDefinition) YTMapRequirementDefinition(org.eclipse.winery.model.tosca.yaml.support.YTMapRequirementDefinition)

Example 2 with YTMapRequirementDefinition

use of org.eclipse.winery.model.tosca.yaml.support.YTMapRequirementDefinition in project winery by eclipse.

the class YamlBuilder method buildMapRequirementDefinition.

@Nullable
public YTMapRequirementDefinition buildMapRequirementDefinition(Object object, Parameter<YTMapRequirementDefinition> parameter) {
    YTMapRequirementDefinition result = new YTMapRequirementDefinition();
    put(result, parameter.getValue(), buildRequirementDefinition(object, new Parameter<>(parameter.getContext())));
    return result;
}
Also used : YTMapRequirementDefinition(org.eclipse.winery.model.tosca.yaml.support.YTMapRequirementDefinition) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

YTMapRequirementDefinition (org.eclipse.winery.model.tosca.yaml.support.YTMapRequirementDefinition)2 Nullable (org.eclipse.jdt.annotation.Nullable)1 YTRelationshipDefinition (org.eclipse.winery.model.tosca.yaml.YTRelationshipDefinition)1 YTRequirementDefinition (org.eclipse.winery.model.tosca.yaml.YTRequirementDefinition)1