[SDC-29] rebase continue work to align source
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / operations / api / IAttributeOperation.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.be.model.operations.api;
22
23 import java.util.List;
24 import java.util.Map;
25
26 import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
27 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
28 import org.openecomp.sdc.be.model.ComponentInstance;
29 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
30 import org.openecomp.sdc.be.model.DataTypeDefinition;
31 import org.openecomp.sdc.be.model.PropertyDefinition;
32 import org.openecomp.sdc.be.resources.data.AttributeData;
33 import org.openecomp.sdc.be.resources.data.AttributeValueData;
34
35 import com.thinkaurelius.titan.core.TitanVertex;
36
37 import fj.data.Either;
38
39 public interface IAttributeOperation {
40         Either<AttributeData, StorageOperationStatus> deleteAttribute(String attributeId);
41
42         TitanOperationStatus addAttributesToGraph(TitanVertex metadataVertex, Map<String, PropertyDefinition> attributes, String resourceId, Map<String, DataTypeDefinition> dataTypes);
43
44         Either<List<ComponentInstanceProperty>, TitanOperationStatus> getAllAttributesOfResourceInstance(ComponentInstance compInstance);
45
46         TitanOperationStatus findAllResourceAttributesRecursively(String resourceId, List<PropertyDefinition> attributes);
47
48         Either<Map<String, PropertyDefinition>, StorageOperationStatus> deleteAllAttributeAssociatedToNode(NodeTypeEnum nodeType, String uniqueId);
49
50         TitanOperationStatus findNodeNonInheretedAttribues(String uniqueId, NodeTypeEnum nodeType, List<PropertyDefinition> attributes);
51
52         Either<AttributeData, StorageOperationStatus> addAttribute(PropertyDefinition attributeDefinition, String resourceId);
53
54         Either<AttributeData, TitanOperationStatus> addAttributeToGraph(PropertyDefinition attribute, String resourceId, Map<String, DataTypeDefinition> dataTypes);
55
56         PropertyDefinition convertAttributeDataToAttributeDefinition(AttributeData attributeData, String attributeName, String resourceId);
57
58         Either<AttributeData, StorageOperationStatus> updateAttribute(String attributeId, PropertyDefinition newAttDef, Map<String, DataTypeDefinition> dataTypes);
59
60         /**
61          * Builds ComponentInstanceAttribute from AttributeValueData
62          * 
63          * @param attributeValueData
64          * @param resourceInstanceAttribute
65          * @return
66          */
67         ComponentInstanceProperty buildResourceInstanceAttribute(AttributeValueData attributeValueData, ComponentInstanceProperty resourceInstanceAttribute);
68
69         TitanOperationStatus addAttributeToGraphByVertex(TitanVertex metadataVertex, PropertyDefinition attribute, String resourceId, Map<String, DataTypeDefinition> dataTypes);
70
71 }