2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.utils;
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() throws UnsupportedOperationException;
42 public boolean removeItem(Object itemId)
43 throws UnsupportedOperationException;
45 public boolean addContainerProperty(Object propertyId, Class<?> type,
46 Object defaultValue) throws UnsupportedOperationException;
48 public boolean removeContainerProperty(Object propertyId)
49 throws UnsupportedOperationException;
51 public boolean removeAllItems() throws UnsupportedOperationException;
53 public interface Ordered extends PolicyContainer {
55 public Object nextItemId(Object itemId);
57 public Object prevItemId(Object itemId);
59 public Object firstItemId();
61 public Object lastItemId();
63 public boolean isFirstId(Object itemId);
65 public boolean isLastId(Object itemId);
67 public Object addItemAfter(Object previousItemId)
68 throws UnsupportedOperationException;
73 public interface Indexed extends Ordered {
75 public int indexOfId(Object itemId);
77 public Object getIdByIndex(int index);
79 public List<?> getItemIds(int startIndex, int numberOfItems);
81 public Object addItemAt(int index) throws UnsupportedOperationException;
83 public interface ItemAddEvent extends ItemSetChangeEvent {
85 public Object getFirstItemId();
87 public int getFirstIndex();
89 public int getAddedItemsCount();
93 public interface ItemRemoveEvent extends ItemSetChangeEvent {
95 public Object getFirstItemId();
97 public int getFirstIndex();
99 public int getRemovedItemsCount();
103 public interface ItemSetChangeEvent extends Serializable {
105 public PolicyContainer getContainer();
108 public interface ItemSetChangeListener extends Serializable {
110 public void containerItemSetChange(PolicyContainer.ItemSetChangeEvent event);
113 public interface ItemSetChangeNotifier extends Serializable {
115 public void addItemSetChangeListener(
116 PolicyContainer.ItemSetChangeListener listener);
118 public void removeItemSetChangeListener(
119 PolicyContainer.ItemSetChangeListener listener);