Update css file name in conf.py
[policy/engine.git] / ONAP-XACML / src / main / java / org / onap / policy / xacml / std / pap / StdPDPItemSetChangeNotifier.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-XACML
4  * ================================================================================
5  * Copyright (C) 2017, 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
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.xacml.std.pap;
22
23 import java.util.Collection;
24 import java.util.LinkedList;
25
26 import org.onap.policy.xacml.api.pap.OnapPDP;
27 import org.onap.policy.xacml.api.pap.OnapPDPGroup;
28
29 public class StdPDPItemSetChangeNotifier {
30
31     private Collection<StdItemSetChangeListener> listeners = null;
32
33     public interface StdItemSetChangeListener {
34
35         public void changed();
36
37         public void groupChanged(OnapPDPGroup group);
38
39         public void pdpChanged(OnapPDP pdp);
40
41     }
42
43     /**
44      * addItemSetChangeListener.
45      *
46      * @param listener StdItemSetChangeListener
47      */
48     public void addItemSetChangeListener(StdItemSetChangeListener listener) {
49         if (this.listeners == null) {
50             this.listeners = new LinkedList<>();
51         }
52         this.listeners.add(listener);
53     }
54
55     /**
56      * removeItemSetChangeListener.
57      *
58      * @param listener StdItemSetChangeListener
59      */
60     public void removeItemSetChangeListener(StdItemSetChangeListener listener) {
61         if (this.listeners != null) {
62             this.listeners.remove(listener);
63         }
64     }
65
66     /**
67      * fireChanged.
68      */
69     public void fireChanged() {
70         if (this.listeners == null) {
71             return;
72         }
73         for (StdItemSetChangeListener l : this.listeners) {
74             l.changed();
75         }
76     }
77
78     /**
79      * firePDPGroupChanged.
80      *
81      * @param group OnapPDPGroup
82      */
83     public void firePDPGroupChanged(OnapPDPGroup group) {
84         if (this.listeners == null) {
85             return;
86         }
87         for (StdItemSetChangeListener l : this.listeners) {
88             l.groupChanged(group);
89         }
90     }
91
92     /**
93      * firePDPChanged.
94      *
95      * @param pdp OnapPDP
96      */
97     public void firePDPChanged(OnapPDP pdp) {
98         if (this.listeners == null) {
99             return;
100         }
101         for (StdItemSetChangeListener l : this.listeners) {
102             l.pdpChanged(pdp);
103         }
104     }
105 }