c5a16a2871fe573cc0ffc256355035e1f79ece29
[ccsdk/apps.git] / sdnr / wireless-transport / code-Carbon-SR1 / apps / devicemanager / impl / src / main / java / org / opendaylight / mwtn / devicemanager / impl / xml / MwtNotificationBase.java
1 /*
2 * Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
7 */
8
9 package org.opendaylight.mwtn.devicemanager.impl.xml;
10
11 import javax.xml.bind.annotation.XmlElement;
12
13 import org.opendaylight.mwtn.base.internalTypes.InternalDateAndTime;
14
15 import com.fasterxml.jackson.annotation.JsonProperty;
16
17 public class MwtNotificationBase {
18
19     private static String EMPTY = "empty";
20
21     private String nodeName;
22     private String counter;
23     private String timeStamp;
24     private String objectId;
25
26     public MwtNotificationBase() {
27         // For Jaxb
28     }
29
30     public MwtNotificationBase(String nodeName, String counter, InternalDateAndTime timeStamp, String objectId) {
31         this.nodeName = nodeName;
32         this.counter = counter;
33         this.timeStamp = timeStamp.getValue();
34         this.objectId = objectId;
35         if (this.objectId == null) {
36             this.objectId = EMPTY;
37         }
38     }
39
40     @XmlElement(name = "nodeName")
41     public String getNodeName() {
42         return nodeName;
43     }
44
45     @XmlElement(name = "counter")
46     public String getCounter() {
47         return counter;
48     }
49
50     @XmlElement(name = "timeStamp")
51     public String getTimeStamp() {
52         return timeStamp;
53     }
54
55     @XmlElement(name = "objectId")
56     public String getObjectId() {
57         return objectId;
58     }
59
60     /**
61      * Type for the Database to document the the same name that is used in the websockets.
62      * @return String with type name of child class
63      */
64     @JsonProperty("type")
65     public String getType() {
66         return this.getClass().getSimpleName();
67     }
68
69     @Override
70     public String toString() {
71         return "MwtNotificationBase [getType()="+ getType() + ", nodeName=" + nodeName + ", counter=" + counter + ", timeStamp=" + timeStamp
72                 + ", objectId=" + objectId + "]";
73     }
74
75
76 }