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