2 * ============LICENSE_START=======================================================
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
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.onap.policy.rest.util;
23 import java.io.Serializable;
24 import java.util.Collection;
25 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,
47 public boolean removeContainerProperty(Object propertyId);
49 public boolean removeAllItems();
51 public interface Ordered extends PolicyContainer {
53 public Object nextItemId(Object itemId);
55 public Object prevItemId(Object itemId);
57 public Object firstItemId();
59 public Object lastItemId();
61 public boolean isFirstId(Object itemId);
63 public boolean isLastId(Object itemId);
65 public Object addItemAfter(Object previousItemId);
70 public interface Indexed extends Ordered {
72 public int indexOfId(Object itemId);
74 public Object getIdByIndex(int index);
76 public List<?> getItemIds(int startIndex, int numberOfItems);
78 public Object addItemAt(int index);
80 public interface ItemAddEvent extends ItemSetChangeEvent {
82 public Object getFirstItemId();
84 public int getFirstIndex();
86 public int getAddedItemsCount();
90 public interface ItemRemoveEvent extends ItemSetChangeEvent {
92 public Object getFirstItemId();
94 public int getFirstIndex();
96 public int getRemovedItemsCount();
100 public interface ItemSetChangeEvent extends Serializable {
102 public PolicyContainer getContainer();
105 public interface ItemSetChangeListener extends Serializable {
107 public void containerItemSetChange(PolicyContainer.ItemSetChangeEvent event);
110 public interface ItemSetChangeNotifier extends Serializable {
112 public void addItemSetChangeListener(
113 PolicyContainer.ItemSetChangeListener listener);
115 public void removeItemSetChangeListener(
116 PolicyContainer.ItemSetChangeListener listener);