Change to enable SDC list type input
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / property / PropertyDeclarator.java
1 package org.openecomp.sdc.be.components.property;
2
3 import fj.data.Either;
4 import java.util.List;
5 import org.openecomp.sdc.be.model.Component;
6 import org.openecomp.sdc.be.model.ComponentInstancePropInput;
7 import org.openecomp.sdc.be.model.InputDefinition;
8 import org.openecomp.sdc.be.model.PolicyDefinition;
9 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
10
11 public interface PropertyDeclarator {
12
13     /**
14      * creates a list of inputs from the given list of properties and updates the properties accordingly
15      * @param component the container
16      * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
17      * @param propsToDeclare the list of properties that are being declared as inputs
18      * @return the list of inputs that were created from the given properties
19      */
20     Either<List<InputDefinition>, StorageOperationStatus> declarePropertiesAsInputs(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare);
21
22     /**
23      * returns the values of declared properties to each original state before it was declared as an input.
24      * this function is to be called when an input, that was created by declaring a property, is deleted.
25      * @param component the container of the input to be deleted
26      * @param input the input to be deleted
27      */
28     StorageOperationStatus unDeclarePropertiesAsInputs(Component component, InputDefinition input);
29
30     /**
31      * creates a list of policies from the given list of properties and updates the properties accordingly
32      * @param component the container
33      * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
34      * @param propsToDeclare the list of properties that are being declared as inputs
35      * @return the list of policies that were created from the given properties
36      */
37     Either<List<PolicyDefinition>, StorageOperationStatus> declarePropertiesAsPolicies(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare);
38
39     /**
40      * returns the values of declared properties to each original state before it was declared as an policy.
41      * this function is to be called when an policy, that was created by declaring a property, is deleted.
42      * @param component the container of the input to be deleted
43      * @param policy the policy to be deleted
44      */
45     StorageOperationStatus unDeclarePropertiesAsPolicies(Component component, PolicyDefinition policy);
46
47     /**
48      * Updates given list of properties to get values from the specified "list input" with get_input function.
49      * This function does NOT create "list input", it needs to be created separately.
50      * @param component the container
51      * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
52      * @param propsToDeclare the list of properties that are being declared as inputs
53      * @param input the input from which properties get values
54      * @return the input same as passed one at 4th argument
55      */
56     Either<InputDefinition, StorageOperationStatus> declarePropertiesAsListInput(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare, InputDefinition input);
57
58     /**
59      * Un declare properties declared as list type input
60      * @param component the container of the input to be deleted
61      * @param input the input to be deleted
62      */
63     StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input);
64 }