@@ -83,21 +83,21 @@ public class DialogService extends WatsonService { |
83 | 83 | public static final String LIMIT = "limit"; |
84 | 84 |
|
85 | 85 | /** The list conversation data type. */ |
86 | | - private static final Type listConversationDataType = new TypeToken<List<ConversationData>>() {} |
| 86 | + private static final Type LIST_CONVERSATION_DATA_TYPE = new TypeToken<List<ConversationData>>() {} |
87 | 87 | .getType(); |
88 | 88 |
|
89 | 89 | /** The list dialog content type. */ |
90 | | - private static final Type listDialogContentType = new TypeToken<List<DialogContent>>() {} |
| 90 | + private static final Type LIST_DIALOG_CONTENT_TYPE = new TypeToken<List<DialogContent>>() {} |
91 | 91 | .getType(); |
92 | 92 |
|
93 | 93 | /** The list dialog type. */ |
94 | | - private static final Type listDialogType = new TypeToken<List<Dialog>>() {}.getType(); |
| 94 | + private static final Type LIST_DIALOG_TYPE = new TypeToken<List<Dialog>>() {}.getType(); |
95 | 95 |
|
96 | 96 | /** The list name value type. */ |
97 | | - private static Type listNameValueType = new TypeToken<List<NameValue>>() {}.getType(); |
| 97 | + private static final Type LIST_NAME_VALUE_TYPE = new TypeToken<List<NameValue>>() {}.getType(); |
98 | 98 |
|
99 | | - /** The Constant log. */ |
100 | | - private static final Logger log = Logger.getLogger(DialogService.class.getName()); |
| 99 | + /** The Constant LOG. */ |
| 100 | + private static final Logger LOG = Logger.getLogger(DialogService.class.getName()); |
101 | 101 |
|
102 | 102 | /** The Constant NAME. */ |
103 | 103 | private static final String NAME = "name"; |
@@ -111,8 +111,8 @@ public class DialogService extends WatsonService { |
111 | 111 | /** The Constant PATH_DIALOGS. */ |
112 | 112 | private static final String PATH_DIALOGS = "/v1/dialogs"; |
113 | 113 |
|
114 | | - /** The Constant sdfDate. */ |
115 | | - private static final SimpleDateFormat sdfDate = new SimpleDateFormat(CONVERSATION_DATE_FORMAT); |
| 114 | + /** The Constant SIMPLE_DATE_FORMAT. */ |
| 115 | + private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(CONVERSATION_DATE_FORMAT); |
116 | 116 |
|
117 | 117 | /** The Constant URL. */ |
118 | 118 | private static final String URL = "https://gateway.watsonplatform.net/dialog/api"; |
@@ -163,10 +163,10 @@ public Conversation converse(final Map<String, Object> params) { |
163 | 163 | throw new IllegalArgumentException("dialog id cannot be null or empty"); |
164 | 164 |
|
165 | 165 | if (conversationId == null) |
166 | | - log.info("Creating a new conversation with for dialog: " + dialogId); |
| 166 | + LOG.info("Creating a new conversation with for dialog: " + dialogId); |
167 | 167 |
|
168 | 168 | if (clientId == null) { |
169 | | - log.info("Creating a new client id with for dialog: " + dialogId); |
| 169 | + LOG.info("Creating a new client id with for dialog: " + dialogId); |
170 | 170 | } |
171 | 171 |
|
172 | 172 | final String path = String.format(PATH_DIALOG_CONVERSATION, dialogId); |
@@ -249,7 +249,7 @@ public List<DialogContent> getContent(final String dialogId) { |
249 | 249 | final Response response = execute(request); |
250 | 250 | final JsonObject jsonObject = ResponseUtils.getJsonObject(response); |
251 | 251 | final List<DialogContent> content = |
252 | | - GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get("items"), listDialogContentType); |
| 252 | + GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get("items"), LIST_DIALOG_CONTENT_TYPE); |
253 | 253 | return content; |
254 | 254 | } |
255 | 255 |
|
@@ -280,8 +280,8 @@ public List<ConversationData> getConversationData(final Map<String, Object> para |
280 | 280 | if (from.after(to)) |
281 | 281 | throw new IllegalArgumentException("'" + DATE_FROM + "' is greater than '" + DATE_TO + "'"); |
282 | 282 |
|
283 | | - final String fromString = sdfDate.format(from); |
284 | | - final String toString = sdfDate.format(to); |
| 283 | + final String fromString = SIMPLE_DATE_FORMAT.format(from); |
| 284 | + final String toString = SIMPLE_DATE_FORMAT.format(to); |
285 | 285 |
|
286 | 286 | final String path = String.format(PATH_DIALOG_CONVERSATION, dialogId); |
287 | 287 |
|
@@ -298,7 +298,7 @@ public List<ConversationData> getConversationData(final Map<String, Object> para |
298 | 298 | final Response response = execute(request); |
299 | 299 | final JsonObject jsonObject = ResponseUtils.getJsonObject(response); |
300 | 300 | final List<ConversationData> conversationDataList = |
301 | | - GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get(CONVERSATIONS), listConversationDataType); |
| 301 | + GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get(CONVERSATIONS), LIST_CONVERSATION_DATA_TYPE); |
302 | 302 | return conversationDataList; |
303 | 303 | } |
304 | 304 |
|
@@ -313,7 +313,7 @@ public List<Dialog> getDialogs() { |
313 | 313 | final Response response = execute(request); |
314 | 314 | final JsonObject jsonObject = ResponseUtils.getJsonObject(response); |
315 | 315 | final List<Dialog> dialogs = |
316 | | - GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get("dialogs"), listDialogType); |
| 316 | + GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get("dialogs"), LIST_DIALOG_TYPE); |
317 | 317 | return dialogs; |
318 | 318 | } |
319 | 319 |
|
@@ -345,7 +345,7 @@ public Map<String, String> getProfile(String dialogId, Integer clientId, String. |
345 | 345 | final Response response = execute(request); |
346 | 346 | final JsonObject jsonObject = ResponseUtils.getJsonObject(response); |
347 | 347 | final List<NameValue> nameValues = |
348 | | - GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get(NAME_VALUES), listNameValueType); |
| 348 | + GsonSingleton.getGsonWithoutPrettyPrinting().fromJson(jsonObject.get(NAME_VALUES), LIST_NAME_VALUE_TYPE); |
349 | 349 |
|
350 | 350 | return fromNameValues(nameValues); |
351 | 351 | } |
|