Removal of useless files & bugfix
[clamp.git] / src / main / java / org / onap / clamp / clds / dao / CldsDao.java
index d54976b..6aa5f91 100644 (file)
@@ -23,6 +23,9 @@
 
 package org.onap.clamp.clds.dao;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
@@ -51,9 +54,6 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource;
 import org.springframework.jdbc.core.simple.SimpleJdbcCall;
 import org.springframework.stereotype.Repository;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 /**
  * Data Access for CLDS Model tables.
  */
@@ -63,19 +63,19 @@ public class CldsDao {
     protected static final EELFLogger logger        = EELFManager.getInstance().getLogger(CldsDao.class);
     protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
 
-    private JdbcTemplate            jdbcTemplateObject;
-    private SimpleJdbcCall          procGetModel;
-    private SimpleJdbcCall          procGetModelTemplate;
-    private SimpleJdbcCall          procSetModel;
-    private SimpleJdbcCall          procInsEvent;
-    private SimpleJdbcCall          procUpdEvent;
-    private SimpleJdbcCall          procSetTemplate;
-    private SimpleJdbcCall          procGetTemplate;
-    private SimpleJdbcCall          procDelAllModelInstances;
-    private SimpleJdbcCall          procInsModelInstance;
-    private SimpleJdbcCall          procDelModelInstance;
+    private JdbcTemplate              jdbcTemplateObject;
+    private SimpleJdbcCall            procGetModel;
+    private SimpleJdbcCall            procGetModelTemplate;
+    private SimpleJdbcCall            procSetModel;
+    private SimpleJdbcCall            procInsEvent;
+    private SimpleJdbcCall            procUpdEvent;
+    private SimpleJdbcCall            procSetTemplate;
+    private SimpleJdbcCall            procGetTemplate;
+    private SimpleJdbcCall            procDelAllModelInstances;
+    private SimpleJdbcCall            procInsModelInstance;
+    private SimpleJdbcCall            procDelModelInstance;
 
-    private static final String     healthcheck   = "Select 1";
+    private static final String       HEALTHCHECK   = "Select 1";
 
     /**
      * Log message when instantiating
@@ -386,7 +386,7 @@ public class CldsDao {
                 cldsServiceData = (CldsServiceData) oip.readObject();
                 cldsServiceData.setAgeOfRecord(age);
             } catch (IOException | ClassNotFoundException e) {
-                logger.error("Error caught while retrieving cldsServiceData from database");
+                logger.error("Error caught while retrieving cldsServiceData from database", e);
             }
             return cldsServiceData;
         }
@@ -398,8 +398,8 @@ public class CldsDao {
      * @return model names
      */
     public List<ValueItem> getBpmnNames() {
-        String SQL = "SELECT model_name FROM model ORDER BY 1;";
-        return jdbcTemplateObject.query(SQL, new ValueItemMapper());
+        String sql = "SELECT model_name FROM model ORDER BY 1;";
+        return jdbcTemplateObject.query(sql, new ValueItemMapper());
     }
 
     /**
@@ -408,9 +408,8 @@ public class CldsDao {
      *
      * @param template
      * @param userid
-     * @return
      */
-    public CldsTemplate setTemplate(CldsTemplate template, String userid) {
+    public void setTemplate(CldsTemplate template, String userid) {
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_template_name", template.getName())
                 .addValue("v_user_id", userid).addValue("v_template_bpmn_text", template.getBpmnText())
                 .addValue("v_template_image_text", template.getImageText())
@@ -426,7 +425,6 @@ public class CldsDao {
         template.setPropId((String) (out.get("v_template_doc_id")));
         template.setPropUserid((String) out.get("v_template_doc_user_id"));
         template.setPropText((String) out.get("v_template_doc_text"));
-        return template;
     }
 
     /**
@@ -435,8 +433,8 @@ public class CldsDao {
      * @return template names
      */
     public List<ValueItem> getTemplateNames() {
-        String SQL = "SELECT template_name FROM template ORDER BY 1;";
-        return jdbcTemplateObject.query(SQL, new ValueItemMapper());
+        String sql = "SELECT template_name FROM template ORDER BY 1;";
+        return jdbcTemplateObject.query(sql, new ValueItemMapper());
     }
 
     /**
@@ -463,8 +461,7 @@ public class CldsDao {
         return template;
     }
 
-    public CldsServiceData getCldsServiceCache(String invariantUUID)
-            throws SQLException, IOException, ClassNotFoundException {
+    public CldsServiceData getCldsServiceCache(String invariantUUID) {
         CldsServiceData cldsServiceData = null;
         List<CldsServiceData> cldsServiceDataList = new ArrayList<>();
         try {
@@ -478,7 +475,7 @@ public class CldsDao {
         return cldsServiceData;
     }
 
-    public void setCldsServiceCache(CldsDBServiceCache cldsDBServiceCache) throws SQLException, IOException {
+    public void setCldsServiceCache(CldsDBServiceCache cldsDBServiceCache) {
         if (cldsDBServiceCache != null && cldsDBServiceCache.getInvariantId() != null
                 && cldsDBServiceCache.getServiceId() != null) {
             String invariantUuid = cldsDBServiceCache.getInvariantId();
@@ -500,8 +497,8 @@ public class CldsDao {
         }
     }
 
-    public void doHealthCheck() throws SQLException, IOException {
-        jdbcTemplateObject.execute(healthcheck);
+    public void doHealthCheck() {
+        jdbcTemplateObject.execute(HEALTHCHECK);
     }
 
 }