Merge "Fixed a bug on view and editor screens"
[policy/engine.git] / PolicyEngineUtils / src / main / java / org / onap / policy / std / StdPDPNotification.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineUtils
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
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.std;
22
23 import java.util.Collection;
24 import java.util.HashSet;
25 import org.onap.policy.api.LoadedPolicy;
26 import org.onap.policy.api.NotificationType;
27 import org.onap.policy.api.PDPNotification;
28 import org.onap.policy.api.RemovedPolicy;
29
30 public class StdPDPNotification implements PDPNotification {
31
32     private Collection<StdRemovedPolicy> removedPolicies = null;
33     private Collection<StdLoadedPolicy> loadedPolicies = null;
34     private Collection<RemovedPolicy> removed = null;
35     private Collection<LoadedPolicy> updated = null;
36     private NotificationType notificationType = null;
37
38     @Override
39     public Collection<RemovedPolicy> getRemovedPolicies() {
40         removed = new HashSet<>();
41         if (removedPolicies != null) {
42             removed.addAll(removedPolicies);
43             return this.removed;
44         }
45         return null;
46     }
47
48     @Override
49     public Collection<LoadedPolicy> getLoadedPolicies() {
50         updated = new HashSet<>();
51         if (loadedPolicies != null) {
52             updated.addAll(loadedPolicies);
53             return updated;
54         }
55         return null;
56     }
57
58     @Override
59     public NotificationType getNotificationType() {
60         return notificationType;
61     }
62
63     public void setNotificationType(NotificationType notificationType) {
64         this.notificationType = notificationType;
65     }
66
67     public void setLoadedPolicies(Collection<StdLoadedPolicy> loadedPolicies) {
68         this.loadedPolicies = loadedPolicies;
69     }
70
71     public void setRemovedPolicies(Collection<StdRemovedPolicy> removedPolicies) {
72         this.removedPolicies = removedPolicies;
73     }
74 }