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;
*
* @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())
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;
}
/**
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;
}