2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.rest.util;
24 import java.io.Serializable;
25 import java.util.Collection;
26 import java.util.List;
28 public interface PolicyContainer extends Serializable {
30 public Collection<?> getContainerPropertyIds();
32 public Collection<?> getItemIds();
34 public Class<?> getType(Object propertyId);
38 public boolean containsId(Object itemId);
40 public Object addItem();
42 public boolean removeItem(Object itemId);
44 public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue);
46 public boolean removeContainerProperty(Object propertyId);
48 public boolean removeAllItems();
50 public interface Ordered extends PolicyContainer {
52 public Object nextItemId(Object itemId);
54 public Object prevItemId(Object itemId);
56 public Object firstItemId();
58 public Object lastItemId();
60 public boolean isFirstId(Object itemId);
62 public boolean isLastId(Object itemId);
64 public Object addItemAfter(Object previousItemId);
68 public interface Indexed extends Ordered {
70 public int indexOfId(Object itemId);
72 public Object getIdByIndex(int index);
74 public List<?> getItemIds(int startIndex, int numberOfItems);
76 public Object addItemAt(int index);
78 public interface ItemAddEvent extends ItemSetChangeEvent {
80 public Object getFirstItemId();
82 public int getFirstIndex();
84 public int getAddedItemsCount();
87 public interface ItemRemoveEvent extends ItemSetChangeEvent {
89 public Object getFirstItemId();
91 public int getFirstIndex();
93 public int getRemovedItemsCount();
98 public interface ItemSetChangeEvent {
99 public PolicyContainer getContainer();
103 public interface ItemSetChangeListener {
104 public void containerItemSetChange(PolicyContainer.ItemSetChangeEvent event);
107 public interface ItemSetChangeNotifier extends Serializable {
109 public void addItemSetChangeListener(PolicyContainer.ItemSetChangeListener listener);
111 public void removeItemSetChangeListener(PolicyContainer.ItemSetChangeListener listener);