junit tests devicemanager
[ccsdk/features.git] / sdnr / wt / devicemanager / provider / src / main / java / org / onap / ccsdk / features / sdnr / wt / devicemanager / impl / xml / MwtNotificationBase.java
1 /*******************************************************************************
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt
4  * =================================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * =================================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  * 
10  * http://www.apache.org/licenses/LICENSE-2.0
11  * 
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  * ============LICENSE_END==========================================================================
17  ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
19
20 import com.fasterxml.jackson.annotation.JsonProperty;
21 import javax.xml.bind.annotation.XmlElement;
22 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
23
24 public class MwtNotificationBase {
25
26     private static String EMPTY = "empty";
27
28     private String nodeName;
29     private String counter;
30     private String timeStamp;
31     private String objectId;
32
33     public MwtNotificationBase() {
34         // For Jaxb
35     }
36
37     public MwtNotificationBase(String nodeName, String counter, InternalDateAndTime timeStamp, String objectId) {
38         this.nodeName = nodeName;
39         this.counter = counter;
40         this.timeStamp = timeStamp.getValue();
41         this.objectId = objectId;
42         if (this.objectId == null) {
43             this.objectId = EMPTY;
44         }
45     }
46
47     @XmlElement(name = "nodeName")
48     public String getNodeName() {
49         return nodeName;
50     }
51
52     @XmlElement(name = "counter")
53     public String getCounter() {
54         return counter;
55     }
56
57     @XmlElement(name = "timeStamp")
58     public String getTimeStamp() {
59         return timeStamp;
60     }
61
62     @XmlElement(name = "objectId")
63     public String getObjectId() {
64         return objectId;
65     }
66
67     /**
68      * Type for the Database to document the the same name that is used in the websockets.
69      * @return String with type name of child class
70      */
71     @JsonProperty("type")
72     public String getType() {
73         return this.getClass().getSimpleName();
74     }
75
76     @Override
77     public String toString() {
78         return "MwtNotificationBase [getType()="+ getType() + ", nodeName=" + nodeName + ", counter=" + counter + ", timeStamp=" + timeStamp
79                 + ", objectId=" + objectId + "]";
80     }
81
82
83 }