2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.model.operations.api;
23 import java.util.List;
25 import org.apache.commons.lang3.tuple.ImmutablePair;
26 import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
27 import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
28 import org.openecomp.sdc.be.model.CapabilityDefinition;
29 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
30 import org.openecomp.sdc.be.model.PropertyDefinition;
31 import org.openecomp.sdc.be.resources.data.CapabilityInstData;
32 import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
33 import org.openecomp.sdc.be.resources.data.PropertyValueData;
35 import com.thinkaurelius.titan.core.TitanVertex;
37 import fj.data.Either;
40 * public interface ICapabilityInstanceOperation provides methods for CRUD
41 * operations for CapabilityInstance on component instance level
46 public interface ICapabilityInstanceOperation {
48 * create capability instance of capability with property values for
51 * @param resourceInstanceId
53 * @param propertyValues
54 * @param validateCapabilityInstExistance
55 * @param capabilityName
58 public Either<Map<CapabilityInstData, List<PropertyValueData>>, TitanOperationStatus> createCapabilityInstanceOfCapabilityWithPropertyValuesForResourceInstance(
59 String resourceInstanceId, String capabilityId, String capabilityName,
60 List<ComponentInstanceProperty> propertyValues, boolean validateCapabilityInstExistance);
64 * @param resourceInstanceVertex
66 * @param capabilityName
67 * @param propertyValues
68 * @param validateCapabilityInstExistence
71 public TitanOperationStatus createCapabilityInstanceOfCapabilityWithPropertyValuesForResourceInstance(
72 TitanVertex resourceInstanceVertex, String resourceInstanceId, String capabilityId, String capabilityName,
73 List<ComponentInstanceProperty> propertyValues, boolean validateCapabilityInstExistence);
76 * validate capability instance uniqueness
78 * @param resourceInstanceId
82 public Either<Boolean, TitanOperationStatus> validateCapabilityInstExistence(String resourceInstanceId,
86 * delete capability instance from resource instance
88 * @param resourceInstanceId
89 * @param capabilityInstanceId
92 public Either<CapabilityInstData, TitanOperationStatus> deleteCapabilityInstanceFromResourceInstance(
93 String resourceInstanceId, String capabilityInstanceId);
96 * get all capability instances for resource instance returns all Capability
97 * Instances related to Resource Instance as List<CapabilityInstData> or
98 * TitanOperationStatus if error occurs or if Resource Instance have no any
99 * related Capability Instance
101 * @param resourceInstanceId
102 * @return Either<List<CapabilityInstData>, TitanOperationStatus>
104 public Either<List<ImmutablePair<CapabilityInstData, GraphEdge>>, TitanOperationStatus> getAllCapabilityInstancesOfResourceInstance(
105 String resourceInstanceId);
108 * get capability instance of capability for resource instance
110 * @param resourceInstanceId
111 * @param capabilityId
114 public Either<CapabilityInstData, TitanOperationStatus> getCapabilityInstanceOfCapabilityOfResourceInstance(
115 String resourceInstanceId, String capabilityId);
118 * update capability property values
120 * @param resourceInstanceId
121 * @param capabilityInstanceId
122 * @param propertyValues
123 * @param capabilityId
126 public Either<List<PropertyValueData>, TitanOperationStatus> updateCapabilityPropertyValues(
127 String resourceInstanceId, String capabilityId, List<ComponentInstanceProperty> propertyValues);
130 * clone and associate capability instance with property values
132 * @param createdComponentInstance
134 * @param capabilityInstPair
137 public Either<ImmutablePair<CapabilityInstData, List<PropertyValueData>>, TitanOperationStatus> cloneAssociateCapabilityInstanceWithPropertyValues(
138 ComponentInstanceData createdComponentInstance, CapabilityDefinition capability,
139 ImmutablePair<CapabilityInstData, GraphEdge> capabilityInstPair);
141 Either<Boolean, TitanOperationStatus> validateCapabilityInstExistence(TitanVertex instanceVertex,
142 String resourceInstanceId, String capabilityId);