Catalog alignment
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / property / PropertyDeclarator.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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.components.property;
22
23 import fj.data.Either;
24 import org.openecomp.sdc.be.model.Component;
25 import org.openecomp.sdc.be.model.ComponentInstancePropInput;
26 import org.openecomp.sdc.be.model.InputDefinition;
27 import org.openecomp.sdc.be.model.PolicyDefinition;
28 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
29
30 import java.util.List;
31
32 public interface PropertyDeclarator {
33
34     /**
35      * creates a list of inputs from the given list of properties and updates the properties accordingly
36      * @param component the container
37      * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
38      * @param propsToDeclare the list of properties that are being declared as inputs
39      * @return the list of inputs that were created from the given properties
40      */
41     Either<List<InputDefinition>, StorageOperationStatus> declarePropertiesAsInputs(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare);
42
43     /**
44      * returns the values of declared properties to each original state before it was declared as an input.
45      * this function is to be called when an input, that was created by declaring a property, is deleted.
46      * @param component the container of the input to be deleted
47      * @param input the input to be deleted
48      */
49     StorageOperationStatus unDeclarePropertiesAsInputs(Component component, InputDefinition input);
50
51     /**
52      * creates a list of policies from the given list of properties and updates the properties accordingly
53      * @param component the container
54      * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
55      * @param propsToDeclare the list of properties that are being declared as inputs
56      * @return the list of policies that were created from the given properties
57      */
58     Either<List<PolicyDefinition>, StorageOperationStatus> declarePropertiesAsPolicies(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare);
59
60     /**
61      * returns the values of declared properties to each original state before it was declared as an policy.
62      * this function is to be called when an policy, that was created by declaring a property, is deleted.
63      * @param component the container of the input to be deleted
64      * @param policy the policy to be deleted
65      */
66     StorageOperationStatus unDeclarePropertiesAsPolicies(Component component, PolicyDefinition policy);
67
68     /**
69      * Updates given list of properties to get values from the specified "list input" with get_input function.
70      * This function does NOT create "list input", it needs to be created separately.
71      * @param component the container
72      * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
73      * @param propsToDeclare the list of properties that are being declared as inputs
74      * @param input the input from which properties get values
75      * @return the input same as passed one at 4th argument
76      */
77     Either<InputDefinition, StorageOperationStatus> declarePropertiesAsListInput(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare, InputDefinition input);
78
79     /**
80      * Un declare properties declared as list type input
81      * @param component the container of the input to be deleted
82      * @param input the input to be deleted
83      */
84     StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input);
85 }