Merge "added test cases to JsonResponseTest.java"
[music.git] / src / main / java / org / onap / music / datastore / jsonobjects / JsonNotification.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2017 AT&T Intellectual Property
6  *  Modifications Copyright (C) 2018 IBM.
7  * ===================================================================
8  *  Licensed under the Apache License, Version 2.0 (the "License");
9  *  you may not use this file except in compliance with the License.
10  *  You may obtain a copy of the License at
11  * 
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  *  Unless required by applicable law or agreed to in writing, software
15  *  distributed under the License is distributed on an "AS IS" BASIS,
16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *  See the License for the specific language governing permissions and
18  *  limitations under the License.
19  * 
20  * ============LICENSE_END=============================================
21  * ====================================================================
22  */
23 package org.onap.music.datastore.jsonobjects;
24
25 import java.io.Serializable;
26 import java.util.Map;
27
28 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
29 import com.fasterxml.jackson.annotation.JsonInclude;
30 import com.fasterxml.jackson.annotation.JsonInclude.Include;
31
32 import org.onap.music.eelf.logging.EELFLoggerDelegate;
33 import org.onap.music.eelf.logging.format.AppMessages;
34 import org.onap.music.eelf.logging.format.ErrorSeverity;
35 import org.onap.music.eelf.logging.format.ErrorTypes;
36
37 import io.swagger.annotations.ApiModel;
38
39 @ApiModel(value = "JsonNotification", description = "Json model for callback")
40 @JsonIgnoreProperties(ignoreUnknown = true)
41 @JsonInclude(Include.NON_NULL) 
42 public class JsonNotification implements Serializable {
43         
44         private String notify_field;
45     private String endpoint;
46     private String username;
47     private String password;
48     private String notify_change;
49     private String notify_insert;
50     private String notify_delete;
51     private String operation_type;
52     private String triggerName;
53     private Map<String, String> response_body;
54         private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JsonNotification.class);
55     
56         public String getNotify_field() {
57                 return notify_field;
58         }
59         public void setNotify_field(String notify_field) {
60                 this.notify_field = notify_field;
61         }
62         public String getEndpoint() {
63                 return endpoint;
64         }
65         public void setEndpoint(String endpoint) {
66                 this.endpoint = endpoint;
67         }
68         public String getUsername() {
69                 return username;
70         }
71         public void setUsername(String username) {
72                 this.username = username;
73         }
74         public String getPassword() {
75                 return password;
76         }
77         public void setPassword(String password) {
78                 this.password = password;
79         }
80         public Map<String, String> getResponse_body() {
81                 return response_body;
82         }
83         public void setResponse_body(Map<String, String> response_body) {
84                 this.response_body = response_body;
85         }
86         public String getNotify_change() {
87                 return notify_change;
88         }
89         public void setNotify_change(String notify_change) {
90                 this.notify_change = notify_change;
91         }
92         public String getNotify_insert() {
93                 return notify_insert;
94         }
95         public void setNotify_insert(String notify_insert) {
96                 this.notify_insert = notify_insert;
97         }
98         public String getNotify_delete() {
99                 return notify_delete;
100         }
101         public void setNotify_delete(String notify_delete) {
102                 this.notify_delete = notify_delete;
103         }
104         public String getOperation_type() {
105                 return operation_type;
106         }
107         public void setOperation_type(String operation_type) {
108                 this.operation_type = operation_type;
109         }
110         public String getTriggerName() {
111                 return triggerName;
112         }
113         public void setTriggerName(String triggerName) {
114                 this.triggerName = triggerName;
115         }
116         @Override
117         public String toString() {
118                 try {
119                 return new com.fasterxml.jackson.databind.ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
120             } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
121                         logger.error(EELFLoggerDelegate.errorLogger, e, AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
122                         return notify_field+ " : "+endpoint+ " : "+username+ " : "+password+ " : "+response_body;
123             }
124
125         }
126         
127 }