Convert tabs to spaces basic refactoring
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / util / PolicyContainer.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017-2018 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.onap.policy.rest.util;
22
23 import java.io.Serializable;
24 import java.util.Collection;
25 import java.util.List;
26
27
28 public interface PolicyContainer extends Serializable{
29
30     public Collection<?> getContainerPropertyIds();
31     
32     public Collection<?> getItemIds();
33
34     public Class<?> getType(Object propertyId);
35
36     public int size();
37   
38     public boolean containsId(Object itemId);
39
40     public Object addItem();
41     
42     public boolean removeItem(Object itemId);
43
44     public boolean addContainerProperty(Object propertyId, Class<?> type,
45             Object defaultValue);
46    
47     public boolean removeContainerProperty(Object propertyId);
48
49     public boolean removeAllItems();
50
51     public interface Ordered extends PolicyContainer {
52
53         public Object nextItemId(Object itemId);
54
55         public Object prevItemId(Object itemId);
56
57         public Object firstItemId();
58
59         public Object lastItemId();
60
61         public boolean isFirstId(Object itemId);
62
63         public boolean isLastId(Object itemId);
64
65         public Object addItemAfter(Object previousItemId);
66         
67     }
68
69     
70     public interface Indexed extends Ordered {
71
72         public int indexOfId(Object itemId);
73
74         public Object getIdByIndex(int index);
75
76         public List<?> getItemIds(int startIndex, int numberOfItems);
77         
78         public Object addItemAt(int index);
79
80         public interface ItemAddEvent extends ItemSetChangeEvent {
81
82             public Object getFirstItemId();
83
84             public int getFirstIndex();
85
86             public int getAddedItemsCount();
87         }
88
89      
90         public interface ItemRemoveEvent extends ItemSetChangeEvent {
91           
92             public Object getFirstItemId();
93
94             public int getFirstIndex();
95
96             public int getRemovedItemsCount();
97         }
98     }
99   
100     public interface ItemSetChangeEvent extends Serializable {
101
102         public PolicyContainer getContainer();
103     }
104
105     public interface ItemSetChangeListener extends Serializable {
106
107         public void containerItemSetChange(PolicyContainer.ItemSetChangeEvent event);
108     }
109
110     public interface ItemSetChangeNotifier extends Serializable {
111
112         public void addItemSetChangeListener(
113                 PolicyContainer.ItemSetChangeListener listener);
114
115         public void removeItemSetChangeListener(
116                 PolicyContainer.ItemSetChangeListener listener);
117     }
118 }