- private static void fillToscaOperationOutputs(OperationDataDefinition operation,
- ToscaLifecycleOperationDefinition toscaOperation,
- String interfaceName,
- ToscaNodeType nodeType) {
- if (Objects.isNull(operation.getOutputs()) || operation.getOutputs().isEmpty()) {
- toscaOperation.setOutputs(null);
- return;
- }
- Map<String, ToscaAttribute> toscaOutputs = new HashMap<>();
- for (OperationOutputDefinition output : operation.getOutputs().getListToscaDataDefinition()) {
- if (Objects.nonNull(output.getInputId())) {
- ToscaAttribute toscaOutput = new ToscaAttribute();
- toscaOutput.setDescription(output.getDescription());
- String outputName = output.getName();
- String mappedAttributeName = getLastPartOfName(output.getInputId());
- toscaOutput.setType(getOperationOutputType(mappedAttributeName, nodeType));
- toscaOutputs.put(outputName, toscaOutput);
- createDefaultValueForMappedAttribute(nodeType, mappedAttributeName, outputName, interfaceName,
- operation.getName());
- }
- }
- toscaOperation.setOutputs(toscaOutputs);
- }
-
- private static String getOperationInputType(String inputName, ToscaNodeType nodeType) {
- if (nodeType.getProperties() != null
- && nodeType.getProperties().containsKey(inputName)) {
- return nodeType.getProperties().get(inputName).getType();
- }
- return DEFAULT_INPUT_TYPE;
- }
-
- private static String getOperationOutputType(String inputName, ToscaNodeType nodeType) {
- if (nodeType.getProperties() != null
- && nodeType.getProperties().containsKey(inputName)) {
- return nodeType.getProperties().get(inputName).getType();
- }
- return DEFAULT_OUTPUT_TYPE;
- }
-