[SDC-29] rebase continue work to align source
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / operations / api / IResourceOperation.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 import java.util.Set;
26
27 import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
28 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
29 import org.openecomp.sdc.be.model.LifecycleStateEnum;
30 import org.openecomp.sdc.be.model.Resource;
31
32 import fj.data.Either;
33
34 public interface IResourceOperation extends IComponentOperation {
35
36         public TitanGenericDao getTitanGenericDao();
37
38         // public StorageOperationStatus lockResource(Resource resource);
39         //
40         // public StorageOperationStatus unlockResource(Resource resource);
41
42         public Either<Resource, StorageOperationStatus> createResource(Resource resource);
43
44         public Either<Resource, StorageOperationStatus> createResource(Resource resource, boolean inTransaction);
45
46         public Either<Resource, StorageOperationStatus> getResource(String resourceId);
47
48         // public Either<Resource, StorageOperationStatus> getResource_tx(String
49         // resourceId,boolean inTransaction);
50
51         public Either<Resource, StorageOperationStatus> getResource(String resourceId, boolean inTransaction);
52
53         /**
54          * the method retrieves all the certified resources, the returned values are only abstract or only none abstract according to the supplied parameters.
55          * 
56          * @param getAbstract
57          *            the value defines which resources to return only abstract or only none abstract
58          * @return
59          */
60         public Either<List<Resource>, StorageOperationStatus> getAllCertifiedResources(boolean getAbstract);
61
62         public Either<List<Resource>, StorageOperationStatus> getAllCertifiedResources(boolean getAbstract, Boolean isHighest);
63
64         public Either<Boolean, StorageOperationStatus> validateResourceNameExists(String resourceName, ResourceTypeEnum resourceType);
65
66         public Either<Resource, StorageOperationStatus> deleteResource(String resourceId);
67
68         public Either<Resource, StorageOperationStatus> deleteResource(String resourceId, boolean inTransaction);
69
70         public Either<Resource, StorageOperationStatus> updateResource(Resource resource);
71
72         public Either<Resource, StorageOperationStatus> updateResource(Resource resource, boolean inTransaction);
73
74         public Either<Integer, StorageOperationStatus> getNumberOfResourcesByName(String resourceName);
75
76         // public Either<List<ArtifactDefinition>, StorageOperationStatus>
77         // getResourceArtifactsForDelete(Resource resource);
78
79         public Either<List<Resource>, StorageOperationStatus> getFollowed(String userId, Set<LifecycleStateEnum> lifecycleStates, Set<LifecycleStateEnum> lastStateStates, boolean inTransaction);
80
81         public Either<Set<Resource>, StorageOperationStatus> getCatalogData(Map<String, Object> propertiesToMatch, boolean inTransaction);
82
83         public Either<Resource, StorageOperationStatus> getLatestByName(String resourceName, boolean inTransaction);
84
85         public Either<Resource, StorageOperationStatus> overrideResource(Resource resource, Resource resourceSaved, boolean inTransaction);
86
87         public Either<List<Resource>, StorageOperationStatus> getTesterFollowed(String userId, Set<LifecycleStateEnum> lifecycleStates, boolean inTransaction);
88
89         public Either<List<Resource>, StorageOperationStatus> getResourceListByUuid(String uuid, boolean inTransaction);
90
91         public Either<List<Resource>, StorageOperationStatus> getLatestResourceByUuid(String uuid, boolean inTransaction);
92
93         public Either<List<Resource>, StorageOperationStatus> getResourceListBySystemName(String systemName, boolean inTransaction);
94
95         public Either<List<Resource>, StorageOperationStatus> getResourceCatalogData(boolean inTransaction);
96
97         public Either<List<Resource>, StorageOperationStatus> getResourceCatalogDataVFLatestCertifiedAndNonCertified(boolean inTransaction);
98
99         public Either<List<Resource>, StorageOperationStatus> getResourceByNameAndVersion(String name, String version, boolean inTransaction);
100
101         public Either<List<Resource>, StorageOperationStatus> getResourceByNameAndVersion(String name, String version);
102
103         public Either<Resource, StorageOperationStatus> getResourceBySystemNameAndVersion(String name, String version, Map<String, Object> additionalParams, boolean inTransaction);
104
105         // public Either<List<Resource>, StorageOperationStatus>
106         // getAllNotCheckoutResources(boolean getAbstract);
107
108         // public Either<List<Resource>, StorageOperationStatus>
109         // getAllNotCheckoutResources(boolean getAbstract, Boolean isHighest);
110
111         public Either<List<String>, StorageOperationStatus> getAllResourcesMarkedForDeletion();
112
113         public Either<Boolean, StorageOperationStatus> isResourceInUse(String resourceToDelete);
114
115         public Either<Resource, StorageOperationStatus> getLatestByToscaResourceName(String toscaResourceName, boolean inTransaction);
116
117         public Either<Boolean, StorageOperationStatus> validateToscaResourceNameExists(String templateName);
118         
119         public Either<Boolean, StorageOperationStatus> validateToscaResourceNameExtends(String templateNameCurrent, String templateNameExtends);
120
121         /**
122          *
123          * @param resource the resource to look for its derived resources
124          * @return all resources which derives from the given resource
125          */
126         Either<List<Resource>, StorageOperationStatus> getAllDerivedResources(Resource resource);
127
128         /**
129          *
130          * @return all root resources (i.e all normatives with tosca name {@code Resource.ROOT_RESOURCE}
131          */
132         Either<List<Resource>, StorageOperationStatus> getRootResources();
133
134         /**
135          *
136          * @return all resources with type VF
137          */
138         Either<List<Resource>, StorageOperationStatus> getVFResources();
139
140
141 }