# HG changeset patch
# User Adrián Romero <adrianromero@openbravo.com>
# Date 1571071137 -7200
#      Mon Oct 14 18:38:57 2019 +0200
# Node ID aea275869ffc2a048b842837da72b5a8dea6d10f
# Parent  4216f8c73e855745e45cdc2a2efdfb460b0ba7e7
Related to issue 0041890: StringBuffer/Builder in Retail modules should be replaced by String
* Replace StringBuilder/StringBuffer by String in simple cases
* Removes @SuppressWarnings where not needed
* Fixes copyright year

diff --git a/src/org/openbravo/mobile/core/listener/InitializeLastPingFromCentralServer.java b/src/org/openbravo/mobile/core/listener/InitializeLastPingFromCentralServer.java
--- a/src/org/openbravo/mobile/core/listener/InitializeLastPingFromCentralServer.java
+++ b/src/org/openbravo/mobile/core/listener/InitializeLastPingFromCentralServer.java
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2017-2018 Openbravo S.L.U.
+ * Copyright (C) 2017-2019 Openbravo S.L.U.
  * Licensed under the Openbravo Commercial License version 1.0
  * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
  * or in the legal folder of this module distribution.
@@ -54,12 +54,10 @@
   }
 
   private void resetLastPingFromCentralServer() {
-    StringBuilder hqlBuilder = new StringBuilder();
-    hqlBuilder.append(" UPDATE OBMOBC_SERVER_DEFINITION ");
-    hqlBuilder.append(" SET last_ping = null ");
-    hqlBuilder.append(" WHERE serverType = 'MAIN' ");
-    @SuppressWarnings("rawtypes")
-    final Query query = OBDal.getInstance().getSession().createQuery(hqlBuilder.toString());
+    String hql = " UPDATE OBMOBC_SERVER_DEFINITION " //
+        + " SET last_ping = null " //
+        + " WHERE serverType = 'MAIN' ";
+    final Query<?> query = OBDal.getInstance().getSession().createQuery(hql);
     int nUpdates = query.executeUpdate();
     if (nUpdates == 0) {
       log.info("There is no central server defined in obmobc_server_definition, nothing to update");
diff --git a/src/org/openbravo/mobile/core/listener/StatusBackgroundProcessScheduler.java b/src/org/openbravo/mobile/core/listener/StatusBackgroundProcessScheduler.java
--- a/src/org/openbravo/mobile/core/listener/StatusBackgroundProcessScheduler.java
+++ b/src/org/openbravo/mobile/core/listener/StatusBackgroundProcessScheduler.java
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2017-2018 Openbravo S.L.U.
+ * Copyright (C) 2017-2019 Openbravo S.L.U.
  * Licensed under the Openbravo Commercial License version 1.0
  * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
  * or in the legal folder of this module distribution.
@@ -81,13 +81,11 @@
   }
 
   private void unscheduleOtherStatusBackgroundProcesses() {
-    StringBuilder hqlBuilder = new StringBuilder();
-    hqlBuilder.append(" UPDATE ProcessRequest ");
-    hqlBuilder.append(" SET status = :status ");
-    hqlBuilder.append(" WHERE process.id = :processId ");
-    hqlBuilder.append(" AND id <> :processRequestId ");
-    @SuppressWarnings("rawtypes")
-    final Query query = OBDal.getInstance().getSession().createQuery(hqlBuilder.toString());
+    String hql = "UPDATE ProcessRequest " //
+        + " SET status = :status " //
+        + " WHERE process.id = :processId " //
+        + " AND id <> :processRequestId ";
+    final Query<?> query = OBDal.getInstance().getSession().createQuery(hql);
     query.setParameter("status", Process.UNSCHEDULED);
     query.setParameter("processId", SERVER_STATE_BACKGROUND_PROCESS_ID);
     query.setParameter("processRequestId", PROCESS_REQUEST_ID);
