1 package org.openecomp.sdc.be.model.operations.api;
5 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
6 import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
7 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
9 import java.util.function.Function;
11 public interface DerivedFromOperation {
15 * @param parentUniqueId the unique id of the object which is the parent of the derived from object
16 * @param derivedFromUniqueId the unique id of the derived from object
17 * @param nodeType the type of the derived from and its parent objects
18 * @return the status of the operation
20 Either<GraphRelation, StorageOperationStatus> addDerivedFromRelation(String parentUniqueId, String derivedFromUniqueId, NodeTypeEnum nodeType);
24 * @param uniqueId the id of the entity of which to fetch its derived from object
25 * @param nodeType the type of the derived from object
26 * @param clazz the class which represent the derived from object
27 * @return the derived from object or error status of operation failed
29 <T extends GraphNode> Either<T, StorageOperationStatus> getDerivedFromChild(String uniqueId, NodeTypeEnum nodeType, Class<T> clazz);
33 * @param uniqueId the id of the entity of which to remove its derived from object
34 * @param derivedFromUniqueId the unique id of the derived from object
35 * @param nodeType the type of the derived from and its parent objects
36 * @return the status of the remove operation. if no derived from relation exists the operation is successful.
38 StorageOperationStatus removeDerivedFromRelation(String uniqueId, String derivedFromUniqueId, NodeTypeEnum nodeType);
42 * Checks whether childCandidateType is derived from parentCandidateType
44 public <T extends GraphNode> Either<Boolean, StorageOperationStatus> isTypeDerivedFrom(String childCandidateType, String parentCandidateType, String currentChildType,
45 NodeTypeEnum capabilitytype, Class<T> clazz,
46 Function<T, String> typeProvider);
49 * Checks whether replacement of oldTypeParent hold in DERIVED FROM with newTypeParent is legal
51 public <T extends GraphNode> StorageOperationStatus isUpdateParentAllowed(String oldTypeParent, String newTypeParent, String childType,
52 NodeTypeEnum capabilitytype, Class<T> clazz,
53 Function<T, String> typeProvider);