1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
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
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=========================================================
19 ******************************************************************************/
21 package com.wipro.www.sonhms;
23 import java.util.HashMap;
24 import java.util.List;
26 import java.util.concurrent.BlockingQueue;
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;
37 public String getSdnrNotification() {
38 return sdnrNotification;
41 public void setSdnrNotification(String sdnrNotification) {
42 this.sdnrNotification = sdnrNotification;
45 SonContext(SonState pciState) {
46 this.pciState = pciState;
47 this.childStatus = new HashMap<>();
55 * Parameterized constructor.
57 public SonContext(BlockingQueue<List<String>> childStatusUpdate, NewNotification newNotification) {
58 this.setChildStatusUpdate(childStatusUpdate);
59 this.setNewNotification(newNotification);
60 this.childStatus = new HashMap<>();
63 public SonState getPciState() {
67 public long getChildThreadId() {
71 public void setChildThreadId(long childThreadId) {
72 this.childThreadId = childThreadId;
75 public void setPciState(SonState pciState) {
76 this.pciState = pciState;
79 public boolean isNotifToBeProcessed() {
80 return notifToBeProcessed;
83 public void setNotifToBeProcessed(boolean notifToBeProcessed) {
84 this.notifToBeProcessed = notifToBeProcessed;
88 public void stateChange(SonContext pciContext) {
89 this.pciState.stateChange(pciContext);
92 public BlockingQueue<List<String>> getChildStatusUpdate() {
93 return childStatusUpdate;
96 public void setChildStatusUpdate(BlockingQueue<List<String>> childStatusUpdate) {
97 this.childStatusUpdate = childStatusUpdate;
100 public void addChildStatus(Long threadId, String status) {
101 this.childStatus.put(threadId, status);
104 public String getChildStatus(Long threadId) {
105 return childStatus.get(threadId);
109 public NewNotification getNewNotification() {
110 return newNotification;
113 public void setNewNotification(NewNotification newNotification) {
114 this.newNotification = newNotification;
117 public void deleteChildStatus() {
118 this.childStatus.remove(childThreadId);