Version change for security fix
[dcaegen2/services/son-handler.git] / src / main / java / com / wipro / www / sonhms / SonContext.java
1 /*******************************************************************************
2  * ============LICENSE_START=======================================================
3  * pcims
4  *  ================================================================================
5  *  Copyright (C) 2018 Wipro Limited.
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 com.wipro.www.sonhms;
22
23 import java.util.HashMap;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.concurrent.BlockingQueue;
27
28 public class SonContext implements SonState {
29     private SonState pciState;
30     boolean notifToBeProcessed;
31     private String sdnrNotification;
32     private long childThreadId;
33     private Map<Long, String> childStatus;
34     private BlockingQueue<List<String>> childStatusUpdate;
35     private NewNotification newNotification;
36
37     public String getSdnrNotification() {
38         return sdnrNotification;
39     }
40
41     public void setSdnrNotification(String sdnrNotification) {
42         this.sdnrNotification = sdnrNotification;
43     }
44
45     SonContext(SonState pciState) {
46         this.pciState = pciState;
47         this.childStatus = new HashMap<>();
48     }
49
50     public SonContext() {
51
52     }
53
54     /**
55      * Parameterized constructor.
56      */
57     public SonContext(BlockingQueue<List<String>> childStatusUpdate, NewNotification newNotification) {
58         this.setChildStatusUpdate(childStatusUpdate);
59         this.setNewNotification(newNotification);
60         this.childStatus = new HashMap<>();
61     }
62
63     public SonState getPciState() {
64         return pciState;
65     }
66
67     public long getChildThreadId() {
68         return childThreadId;
69     }
70
71     public void setChildThreadId(long childThreadId) {
72         this.childThreadId = childThreadId;
73     }
74
75     public void setPciState(SonState pciState) {
76         this.pciState = pciState;
77     }
78
79     public boolean isNotifToBeProcessed() {
80         return notifToBeProcessed;
81     }
82
83     public void setNotifToBeProcessed(boolean notifToBeProcessed) {
84         this.notifToBeProcessed = notifToBeProcessed;
85     }
86
87     @Override
88     public void stateChange(SonContext pciContext) {
89         this.pciState.stateChange(pciContext);
90     }
91
92     public BlockingQueue<List<String>> getChildStatusUpdate() {
93         return childStatusUpdate;
94     }
95
96     public void setChildStatusUpdate(BlockingQueue<List<String>> childStatusUpdate) {
97         this.childStatusUpdate = childStatusUpdate;
98     }
99
100     public void addChildStatus(Long threadId, String status) {
101         this.childStatus.put(threadId, status);
102     }
103
104     public String getChildStatus(Long threadId) {
105         return childStatus.get(threadId);
106
107     }
108
109     public NewNotification getNewNotification() {
110         return newNotification;
111     }
112
113     public void setNewNotification(NewNotification newNotification) {
114         this.newNotification = newNotification;
115     }
116
117     public void deleteChildStatus() {
118         this.childStatus.remove(childThreadId);
119
120     }
121
122 }