1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.grubusiness.business.web.rs.responseStatus;
35
36 import com.fasterxml.jackson.annotation.JsonInclude;
37 import com.fasterxml.jackson.annotation.JsonProperty;
38 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
39
40 import java.beans.ConstructorProperties;
41 import java.util.ArrayList;
42 import java.util.List;
43
44
45
46 @JsonInclude( JsonInclude.Include.NON_EMPTY )
47 public class ResponseStatus
48 {
49
50 public static final String KEY_ATTRIBUTE_STATUS = "status";
51 public static final String KEY_ATTRIBUTE_STATUS_CODE = "code";
52 public static final String KEY_STATUS = "status";
53 public static final String KEY_MESSAGE = "message";
54 public static final String KEY_MESSAGE_KEY = "message_key";
55 public static final String KEY_HTTP_CODE = "http_code";
56
57 private final int httpCode;
58 private final ResponseStatusType type;
59 private String message;
60 private String messageKey;
61
62
63 @ConstructorProperties( {
64 "httpCode", "status"
65 } )
66 public ResponseStatus( final int httpCode, final ResponseStatusType type )
67 {
68 this.httpCode = httpCode;
69 this.type = type;
70 }
71
72 @JsonProperty( value = KEY_HTTP_CODE )
73 public int getHttpCode( )
74 {
75 return httpCode;
76 }
77
78 @JsonProperty( value = KEY_STATUS )
79 public ResponseStatusType getType( )
80 {
81 return type;
82 }
83
84 @JsonProperty( value = KEY_MESSAGE )
85 public String getMessage( )
86 {
87 return message;
88 }
89
90 @JsonProperty( value = KEY_MESSAGE )
91 public ResponseStatus setMessage( final String message )
92 {
93 this.message = message;
94 return this;
95 }
96
97 @JsonProperty( value = KEY_MESSAGE_KEY )
98 public String getMessageKey( )
99 {
100 return messageKey;
101 }
102
103 @JsonProperty( value = KEY_MESSAGE_KEY )
104 public ResponseStatus setMessageKey( final String messageKey )
105 {
106 this.messageKey = messageKey;
107 return this;
108 }
109
110 @Override
111 public boolean equals( final Object o )
112 {
113 if ( !( o instanceof ResponseStatus ) )
114 {
115 return false;
116 }
117 final ResponseStatus./../../../../../../fr/paris/lutece/plugins/grubusiness/business/web/rs/responseStatus/ResponseStatus.html#ResponseStatus">ResponseStatus other = (ResponseStatus) o;
118 return this.httpCode == other.httpCode && this.type == other.type;
119 }
120
121 @Override
122 public String toString() {
123 return "ResponseStatus{" +
124 "httpCode=" + httpCode +
125 ", type=" + type +
126 ", message='" + message + '\'' +
127 ", messageKey='" + messageKey + '\'' +
128 '}';
129 }
130 }