X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fclamp%2Fclds%2Fdao%2FCldsDao.java;h=6aa5f9127066753d7bd1e32ef07243958c744c1a;hb=2b15edd224cc6dcff90e170959102eb1a1bb1a50;hp=d54976b849aa4aa24b8e9b1aaefa438dc4a1cf71;hpb=5ff37e6b05bfd235ba782462e83355c5289018a1;p=clamp.git diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java index d54976b8..6aa5f912 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java @@ -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 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 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 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); } }