Removal of useless files & bugfix
[clamp.git] / src / main / java / org / onap / clamp / clds / dao / CldsDao.java
index 3cc6a32..6aa5f91 100644 (file)
@@ -46,6 +46,7 @@ import org.onap.clamp.clds.model.CldsModelInstance;
 import org.onap.clamp.clds.model.CldsServiceData;
 import org.onap.clamp.clds.model.CldsTemplate;
 import org.onap.clamp.clds.model.ValueItem;
+import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -407,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())
@@ -425,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;
     }
 
     /**
@@ -465,10 +464,14 @@ public class CldsDao {
     public CldsServiceData getCldsServiceCache(String invariantUUID) {
         CldsServiceData cldsServiceData = null;
         List<CldsServiceData> cldsServiceDataList = new ArrayList<>();
-        String getCldsServiceSQL = "SELECT * , TIMESTAMPDIFF(SECOND, timestamp, CURRENT_TIMESTAMP()) FROM clds_service_cache where invariant_service_id  = ? ";
-        cldsServiceData = jdbcTemplateObject.queryForObject(getCldsServiceSQL, new Object[] { invariantUUID },
-                new CldsServiceDataMapper());
-        logger.info("value of cldsServiceDataList: {}", cldsServiceDataList);
+        try {
+            String getCldsServiceSQL = "SELECT * , TIMESTAMPDIFF(SECOND, timestamp, CURRENT_TIMESTAMP()) FROM clds_service_cache where invariant_service_id  = ? ";
+            cldsServiceData = jdbcTemplateObject.queryForObject(getCldsServiceSQL, new Object[] { invariantUUID },
+                    new CldsServiceDataMapper());
+            logger.info("value of cldsServiceDataList: {}", cldsServiceDataList);
+        } catch (EmptyResultDataAccessException e) {
+            logger.info("cache row not found for invariantUUID: {}", invariantUUID);
+        }
         return cldsServiceData;
     }