diff options
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)); } } |