diff options
author | andre.schmid <andre.schmid@est.tech> | 2020-10-14 20:56:11 +0100 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2020-12-07 14:51:59 +0000 |
commit | 95ad93091d5fa6e377e76f312d495151bddc9da8 (patch) | |
tree | 9923a98bd90b99cb960cf1f7ead2a57402aca1a8 /catalog-model/src/main | |
parent | a9467feb90c33ad5b6b2ed80581c4adf75114046 (diff) |
Support interface input during import VFC
Change-Id: I097ce258a7dadbedf1aff6ce53dd1286da074552
Issue-ID: SDC-3372
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java index e3b5d08bc1..204d484937 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java @@ -21,13 +21,12 @@ package org.openecomp.sdc.be.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; +import java.util.stream.Collectors; import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; -import java.util.Map; -import java.util.stream.Collectors; - /** * Definition of the operations that can be performed on (instances of) a Node * Type. @@ -36,8 +35,6 @@ import java.util.stream.Collectors; */ public class InterfaceDefinition extends InterfaceDataDefinition implements IOperationParameter { - private boolean definition; - public InterfaceDefinition() { super(); } @@ -56,10 +53,6 @@ public class InterfaceDefinition extends InterfaceDataDefinition implements IOpe return false; } - public void setDefinition(boolean definition) { - this.definition = definition; - } - @JsonIgnore public Map<String, Operation> getOperationsMap() { return getOperations().entrySet() @@ -79,9 +72,18 @@ public class InterfaceDefinition extends InterfaceDataDefinition implements IOpe setOperations(convertedOperation); } - @Override - public String toString() { - return "InterfaceDefinition [definition=" + definition + "]"; + /** + * Checks if the interface has the given operation + * @param operation the operation to check + * @return {@code true} if the operation exists, {@code false} otherwise + */ + public boolean hasOperation(final String operation) { + final Map<String, OperationDataDefinition> operationMap = getOperations(); + if (MapUtils.isEmpty(operationMap)) { + return false; + } + return operationMap.keySet().stream() + .anyMatch(operation1 -> operation1.equalsIgnoreCase(operation)); } } |