Remove SDC query
[clamp.git] / src / main / java / org / onap / clamp / clds / dao / CldsDao.java
index bdb8e4b..eef6353 100644 (file)
@@ -32,7 +32,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 import javax.sql.DataSource;
 
@@ -47,8 +46,6 @@ import org.onap.clamp.clds.model.CldsMonitoringDetails;
 import org.onap.clamp.clds.model.CldsServiceData;
 import org.onap.clamp.clds.model.CldsTemplate;
 import org.onap.clamp.clds.model.CldsToscaModel;
-import org.onap.clamp.clds.model.CldsToscaModelDetails;
-import org.onap.clamp.clds.model.CldsToscaModelRevision;
 import org.onap.clamp.clds.model.ValueItem;
 import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -84,6 +81,7 @@ public class CldsDao {
     private SimpleJdbcCall procInsertDictionary;
     private SimpleJdbcCall procInsertDictionaryElement;
 
+    private static final String DATE_FORMAT = "MM-dd-yyyy HH:mm:ss";
 
     /**
      * Log message when instantiating
@@ -108,7 +106,8 @@ public class CldsDao {
         this.procDelAllModelInstances = new SimpleJdbcCall(dataSource).withProcedureName("del_all_model_instances");
         this.procDeleteModel = new SimpleJdbcCall(dataSource).withProcedureName("del_model");
         this.procInsertToscaModel = new SimpleJdbcCall(dataSource).withProcedureName("set_tosca_model");
-        this.procInsertNewToscaModelVersion = new SimpleJdbcCall(dataSource).withProcedureName("set_new_tosca_model_version");
+        this.procInsertNewToscaModelVersion = new SimpleJdbcCall(dataSource)
+            .withProcedureName("set_new_tosca_model_version");
         this.procInsertDictionary = new SimpleJdbcCall(dataSource).withProcedureName("set_dictionary");
         this.procInsertDictionaryElement = new SimpleJdbcCall(dataSource).withProcedureName("set_dictionary_elements");
     }
@@ -139,8 +138,7 @@ public class CldsDao {
     }
 
     /**
-     * Get a model and template information from the database given the model
-     * name.
+     * Get a model and template information from the database given the model name.
      *
      * @param modelName
      * @return model
@@ -150,14 +148,12 @@ public class CldsDao {
         model.setName(modelName);
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_model_name", modelName);
         Map<String, Object> out = logSqlExecution(procGetModelTemplate, in);
-        // todo : rationalize
         populateModelProperties(model, out);
         Map<String, Object> modelResults = logSqlExecution(procGetModel, in);
         Object modelResultObject = modelResults.get("#result-set-1");
-        if (modelResultObject != null && modelResultObject instanceof ArrayList) {
-            List<Object> modelInstanceRs = (List<Object>) modelResultObject;
-            for (Object currModelInstance : modelInstanceRs) {
-                if (currModelInstance != null && currModelInstance instanceof HashMap) {
+        if (modelResultObject instanceof ArrayList) {
+            for (Object currModelInstance : (List<Object>) modelResultObject) {
+                if (currModelInstance instanceof HashMap) {
                     HashMap<String, String> modelInstanceMap = (HashMap<String, String>) currModelInstance;
                     CldsModelInstance modelInstance = new CldsModelInstance();
                     modelInstance.setModelInstanceId(modelInstanceMap.get("model_instance_id"));
@@ -172,8 +168,8 @@ public class CldsDao {
     }
 
     /**
-     * Update model in the database using parameter values and return updated
-     * model object.
+     * Update model in the database using parameter values and return updated model
+     * object.
      *
      * @param model
      * @param userid
@@ -185,6 +181,7 @@ public class CldsDao {
             .addValue("v_model_prop_text", model.getPropText())
             .addValue("v_model_blueprint_text", model.getBlueprintText())
             .addValue("v_service_type_id", model.getTypeId()).addValue("v_deployment_id", model.getDeploymentId())
+            .addValue("v_deployment_status_url", model.getDeploymentStatusUrl())
             .addValue("v_control_name_prefix", model.getControlNamePrefix())
             .addValue(V_CONTROL_NAME_UUID, model.getControlNameUuid());
         Map<String, Object> out = logSqlExecution(procSetModel, in);
@@ -200,8 +197,8 @@ public class CldsDao {
     }
 
     /**
-     * Inserts new modelInstance in the database using parameter values and
-     * return updated model object.
+     * Inserts new modelInstance in the database using parameter values and return
+     * updated model object.
      *
      * @param model
      * @param modelInstancesList
@@ -278,7 +275,7 @@ public class CldsDao {
      *
      * @return model names
      */
-    public List<ValueItem> getBpmnNames() {
+    public List<ValueItem> getModelNames() {
         String sql = "SELECT model_name FROM model ORDER BY 1;";
         return jdbcTemplateObject.query(sql, new ValueItemMapper());
     }
@@ -339,45 +336,6 @@ public class CldsDao {
         return template;
     }
 
-    public void clearServiceCache() {
-        String clearCldsServiceCacheSql = "TRUNCATE clds_service_cache";
-        jdbcTemplateObject.execute(clearCldsServiceCacheSql);
-    }
-
-    public CldsServiceData getCldsServiceCache(String invariantUUID) {
-        CldsServiceData cldsServiceData = null;
-        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());
-            if (cldsServiceData != null) {
-                logger.info("CldsServiceData found in cache for Service Invariant ID:"
-                    + cldsServiceData.getServiceInvariantUUID());
-                return cldsServiceData;
-            } else {
-                logger.warn("CldsServiceData not found in cache for Service Invariant ID:" + invariantUUID);
-                return null;
-            }
-        } catch (EmptyResultDataAccessException e) {
-            logger.info("CldsServiceData not found in cache for Service Invariant ID: " + invariantUUID);
-            logger.debug("CldsServiceData not found in cache for Service Invariant ID: " + invariantUUID, e);
-            return null;
-        }
-    }
-
-    public void setCldsServiceCache(CldsDbServiceCache cldsDBServiceCache) {
-        if (cldsDBServiceCache != null && cldsDBServiceCache.getInvariantId() != null
-            && cldsDBServiceCache.getServiceId() != null) {
-            String invariantUuid = cldsDBServiceCache.getInvariantId();
-            String serviceUuid = cldsDBServiceCache.getServiceId();
-            InputStream is = cldsDBServiceCache.getCldsDataInstream();
-            String insertCldsServiceCacheSql = "INSERT INTO clds_service_cache"
-                + "(invariant_service_id,service_id,timestamp,object_data) VALUES"
-                + "(?,?,CURRENT_TIMESTAMP,?) ON DUPLICATE KEY UPDATE invariant_service_id = VALUES(invariant_service_id) , timestamp = CURRENT_TIMESTAMP , object_data = VALUES(object_data) ";
-            jdbcTemplateObject.update(insertCldsServiceCacheSql, invariantUuid, serviceUuid, is);
-        }
-    }
-
     private static Map<String, Object> logSqlExecution(SimpleJdbcCall call, SqlParameterSource source) {
         try {
             return call.execute(source);
@@ -417,21 +375,20 @@ public class CldsDao {
      * Method to get deployed/active models with model properties.
      *
      * @return list of CLDS-Monitoring-Details: CLOSELOOP_NAME | Close loop name
-     *         used in the CLDS application (prefix: ClosedLoop- + unique
-     *         ClosedLoop ID) MODEL_NAME | Model Name in CLDS application
-     *         SERVICE_TYPE_ID | TypeId returned from the DCAE application when
-     *         the ClosedLoop is submitted (DCAEServiceTypeRequest generated in
-     *         DCAE application). DEPLOYMENT_ID | Id generated when the
-     *         ClosedLoop is deployed in DCAE. TEMPLATE_NAME | Template used to
-     *         generate the ClosedLoop model. ACTION_CD | Current state of the
-     *         ClosedLoop in CLDS application.
+     *         used in the CLDS application (prefix: ClosedLoop- + unique ClosedLoop
+     *         ID) MODEL_NAME | Model Name in CLDS application SERVICE_TYPE_ID |
+     *         TypeId returned from the DCAE application when the ClosedLoop is
+     *         submitted (DCAEServiceTypeRequest generated in DCAE application).
+     *         DEPLOYMENT_ID | Id generated when the ClosedLoop is deployed in DCAE.
+     *         TEMPLATE_NAME | Template used to generate the ClosedLoop model.
+     *         ACTION_CD | Current state of the ClosedLoop in CLDS application.
      */
     public List<CldsMonitoringDetails> getCLDSMonitoringDetails() {
-        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
-        List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>();
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+        List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<>();
         String modelsSql = "SELECT CONCAT(M.CONTROL_NAME_PREFIX, M.CONTROL_NAME_UUID) AS CLOSELOOP_NAME , M.MODEL_NAME, M.SERVICE_TYPE_ID, M.DEPLOYMENT_ID, T.TEMPLATE_NAME, E.ACTION_CD, E.USER_ID, E.TIMESTAMP "
-            + "FROM MODEL M, TEMPLATE T, EVENT E "
-            + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID " + "ORDER BY ACTION_CD";
+            + "FROM MODEL M, TEMPLATE T, EVENT E " + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID "
+            + "ORDER BY ACTION_CD";
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(modelsSql);
         CldsMonitoringDetails cldsMonitoringDetails = null;
         for (Map<String, Object> row : rows) {
@@ -460,7 +417,6 @@ public class CldsDao {
     }
 
     private void populateModelProperties(CldsModel model, Map out) {
-        // todo : rationalize
         model.setControlNamePrefix((String) out.get(V_CONTROL_NAME_PREFIX));
         model.setControlNameUuid((String) out.get(V_CONTROL_NAME_UUID));
         model.setId((String) (out.get("v_model_id")));
@@ -478,14 +434,14 @@ public class CldsDao {
         model.getEvent().setUserid((String) out.get("v_event_user_id"));
         model.setTypeId((String) out.get("v_service_type_id"));
         model.setDeploymentId((String) out.get("v_deployment_id"));
+        model.setDeploymentStatusUrl((String) out.get("v_deployment_status_url"));
     }
 
-
     /**
      * Method to retrieve a tosca models by Policy Type from database.
-
+     *
      * @param policyType
-     * @return  List of CldsToscaModel
+     * @return List of CldsToscaModel
      */
     public List<CldsToscaModel> getAllToscaModels() {
         return getToscaModel(null, null);
@@ -493,9 +449,9 @@ public class CldsDao {
 
     /**
      * Method to retrieve a tosca models by Policy Type from database.
-
+     *
      * @param policyType
-     * @return  List of CldsToscaModel
+     * @return List of CldsToscaModel
      */
     public List<CldsToscaModel> getToscaModelByPolicyType(String policyType) {
         return getToscaModel(null, policyType);
@@ -514,10 +470,10 @@ public class CldsDao {
     // Retrieve the latest tosca model for a policy type or by tosca model name
 
     private List<CldsToscaModel> getToscaModel(String toscaModelName, String policyType) {
-        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
         List<CldsToscaModel> cldsToscaModels = new ArrayList<>();
 
-        String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
+        String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.tosca_model_json, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
             + ((toscaModelName != null) ? (", tmr.tosca_model_yaml ") : " ")
             + "FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id "
             + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ")
@@ -526,15 +482,15 @@ public class CldsDao {
 
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
 
-        if (rows != null && rows.size() > 0) {
-
-            rows.stream().forEach(row -> {
+        if (rows != null) {
+            rows.forEach(row -> {
                 CldsToscaModel cldsToscaModel = new CldsToscaModel();
                 cldsToscaModel.setId((String) row.get("tosca_model_id"));
                 cldsToscaModel.setPolicyType((String) row.get("policy_type"));
                 cldsToscaModel.setToscaModelName((String) row.get("tosca_model_name"));
                 cldsToscaModel.setUserId((String) row.get("user_id"));
                 cldsToscaModel.setRevisionId((String) row.get("tosca_model_revision_id"));
+                cldsToscaModel.setToscaModelJson((String) row.get("tosca_model_json"));
                 cldsToscaModel.setVersion(((Double) row.get("version")));
                 cldsToscaModel.setCreatedDate(sdf.format(row.get("createdTimestamp")));
                 cldsToscaModel.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp")));
@@ -543,66 +499,12 @@ public class CldsDao {
                 }
                 cldsToscaModels.add(cldsToscaModel);
             });
-
         }
         return cldsToscaModels;
     }
 
-    // Retrieve Tosca Models & its revisions by policy Type.
-    private List<CldsToscaModelDetails> getAllToscaModelVersion(String toscaModelName, String policyType,
-        String version) {
-        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
-        List<CldsToscaModelDetails> cldsToscaModelDetailsList = new ArrayList<>();
-        String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
-            + "FROM tosca_model tm, tosca_model_revision tmr " + "WHERE tmr.tosca_model_id = tm.tosca_model_id "
-            + ((policyType != null) ? (" AND tm.policy_type = '" + policyType + "'") : " ")
-            + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ")
-            + ((version != null) ? (" AND tmr.version = '" + version + "'") : "");
-
-        List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
-
-        if (rows != null && rows.size() > 0) {
-            // Get list of all available modelIds
-            List<String> listofModelIds = new ArrayList<>();
-            for (Map<String, Object> r : rows) {
-                if (r != null) {
-                    listofModelIds.add((String) r.get("tosca_model_id"));
-                }
-            }
-            // Filter Distinct elements using streams
-            listofModelIds = listofModelIds.stream().distinct().collect(Collectors.toList());
-
-            // TODO change logic using java8
-            for (String modelId : listofModelIds) {
-                CldsToscaModelDetails cldsToscaModelDetails = new CldsToscaModelDetails();
-                List<CldsToscaModelRevision> revisions = new ArrayList<>();
-                for (Map<String, Object> row : rows) {
-                    String id = (String) row.get("tosca_model_id");
-                    if (modelId.equalsIgnoreCase(id)) {
-                        cldsToscaModelDetails.setId(id);
-                        cldsToscaModelDetails.setPolicyType((String) row.get("policy_type"));
-                        cldsToscaModelDetails.setToscaModelName((String) row.get("tosca_model_name"));
-                        cldsToscaModelDetails.setUserId((String) row.get("user_id"));
-
-                        CldsToscaModelRevision modelRevision = new CldsToscaModelRevision();
-                        modelRevision.setRevisionId((String) row.get("tosca_model_revision_id"));
-                        modelRevision.setVersion(((Double) row.get("version")));
-                        modelRevision.setUserId((String) row.get("user_id"));
-                        modelRevision.setCreatedDate(sdf.format(row.get("createdTimestamp")));
-                        modelRevision.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp")));
-                        revisions.add(modelRevision);
-                    }
-                }
-                cldsToscaModelDetails.setToscaModelRevisions(revisions);
-                cldsToscaModelDetailsList.add(cldsToscaModelDetails);
-            }
-        }
-        return cldsToscaModelDetailsList;
-    }
-
-
     /**
-     *  Method to upload a new version of Tosca Model Yaml in Database
+     * Method to upload a new version of Tosca Model Yaml in Database
      *
      * @param cldsToscaModel
      * @param userId
@@ -619,9 +521,8 @@ public class CldsDao {
         return cldsToscaModel;
     }
 
-
     /**
-     *  Method to upload a new Tosca model Yaml in DB. Default version is 1.0
+     * Method to upload a new Tosca model Yaml in DB. Default version is 1.0
      *
      * @param cldsToscaModel
      * @param userId
@@ -654,7 +555,6 @@ public class CldsDao {
         cldsDictionary.setDictionaryId((String) (out.get("v_dictionary_id")));
     }
 
-
     /**
      * Method to update Dictionary with new info in Database
      *
@@ -665,12 +565,11 @@ public class CldsDao {
     public void updateDictionary(String dictionaryId, CldsDictionary cldsDictionary, String userId) {
 
         String dictionarySql = "UPDATE dictionary " + "SET dictionary_name = '" + cldsDictionary.getDictionaryName()
-        + "', modified_by = '" + userId + "'" + "WHERE dictionary_id = '" + dictionaryId + "'";
+            + "', modified_by = '" + userId + "'" + "WHERE dictionary_id = '" + dictionaryId + "'";
         jdbcTemplateObject.update(dictionarySql);
         cldsDictionary.setUpdatedBy(userId);
     }
 
-
     /**
      * Method to get list of Dictionaries from the Database
      *
@@ -679,18 +578,19 @@ public class CldsDao {
      * @return
      */
     public List<CldsDictionary> getDictionary(String dictionaryId, String dictionaryName) {
-        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
         List<CldsDictionary> dictionaries = new ArrayList<>();
         String dictionarySql = "SELECT dictionary_id, dictionary_name, created_by, modified_by, timestamp FROM dictionary"
             + ((dictionaryId != null || dictionaryName != null)
                 ? (" WHERE " + ((dictionaryName != null) ? ("dictionary_name = '" + dictionaryName + "'") : "")
                     + ((dictionaryId != null && dictionaryName != null) ? (" AND ") : "")
-                    + ((dictionaryId != null) ? ("dictionary_id = '" + dictionaryId + "'") : "")): "");
+                    + ((dictionaryId != null) ? ("dictionary_id = '" + dictionaryId + "'") : ""))
+                : "");
 
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
 
-        if (rows != null && rows.size() > 0) {
-            rows.stream().forEach(row -> {
+        if (rows != null) {
+            rows.forEach(row -> {
                 CldsDictionary cldsDictionary = new CldsDictionary();
                 cldsDictionary.setDictionaryId((String) row.get("dictionary_id"));
                 cldsDictionary.setDictionaryName((String) row.get("dictionary_name"));
@@ -715,21 +615,21 @@ public class CldsDao {
             .addValue("v_dict_element_name", cldsDictionaryItem.getDictElementName())
             .addValue("v_dict_element_short_name", cldsDictionaryItem.getDictElementShortName())
             .addValue("v_dict_element_description", cldsDictionaryItem.getDictElementDesc())
-            .addValue("v_dict_element_type", cldsDictionaryItem.getDictElementType())
-            .addValue("v_user_id", userId);
+            .addValue("v_dict_element_type", cldsDictionaryItem.getDictElementType()).addValue("v_user_id", userId);
         Map<String, Object> out = logSqlExecution(procInsertDictionaryElement, in);
         cldsDictionaryItem.setDictElementId((String) (out.get("v_dict_element_id")));
     }
 
-
     /**
-     * Method to update Dictionary Elements with new info for a given dictionary in Database
+     * Method to update Dictionary Elements with new info for a given dictionary in
+     * Database
      *
      * @param dictionaryElementId
      * @param cldsDictionaryItem
      * @param userId
      */
-    public void updateDictionaryElements(String dictionaryElementId, CldsDictionaryItem cldsDictionaryItem, String userId) {
+    public void updateDictionaryElements(String dictionaryElementId, CldsDictionaryItem cldsDictionaryItem,
+        String userId) {
 
         String dictionarySql = "UPDATE dictionary_elements SET dict_element_name = '"
             + cldsDictionaryItem.getDictElementName() + "', dict_element_short_name = '"
@@ -742,7 +642,8 @@ public class CldsDao {
     }
 
     /**
-     * Method to get list of all dictionary elements for a given dictionary in the Database
+     * Method to get list of all dictionary elements for a given dictionary in the
+     * Database
      *
      * @param dictionaryName
      * @param dictionaryId
@@ -751,18 +652,19 @@ public class CldsDao {
      */
     public List<CldsDictionaryItem> getDictionaryElements(String dictionaryName, String dictionaryId,
         String dictElementShortName) {
-        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
         List<CldsDictionaryItem> dictionaryItems = new ArrayList<>();
         String dictionarySql = "SELECT de.dict_element_id, de.dictionary_id, de.dict_element_name, de.dict_element_short_name, de.dict_element_description, de.dict_element_type, de.created_by, de.modified_by, de.timestamp  "
             + "FROM dictionary_elements de, dictionary d WHERE de.dictionary_id = d.dictionary_id "
             + ((dictionaryId != null) ? (" AND d.dictionary_id = '" + dictionaryId + "'") : "")
-            + ((dictElementShortName != null) ? (" AND de.dict_element_short_name = '" + dictElementShortName + "'"): "")
+            + ((dictElementShortName != null) ? (" AND de.dict_element_short_name = '" + dictElementShortName + "'")
+                : "")
             + ((dictionaryName != null) ? (" AND dictionary_name = '" + dictionaryName + "'") : "");
 
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
 
-        if (rows != null && rows.size() > 0) {
-            rows.stream().forEach(row -> {
+        if (rows != null) {
+            rows.forEach(row -> {
                 CldsDictionaryItem dictionaryItem = new CldsDictionaryItem();
                 dictionaryItem.setDictElementId((String) row.get("dict_element_id"));
                 dictionaryItem.setDictionaryId((String) row.get("dictionary_id"));
@@ -780,14 +682,25 @@ public class CldsDao {
     }
 
     /**
-     * Method to delete a tosca model from database.
+     * Method to get Map of all dictionary elements with key as dictionary short
+     * name and value as the full name
      *
-     * @param toscaModelId
-     * @param revisionId
+     * @param dictionaryElementType
+     * @return Map of dictionary elements as key value pair
      */
-    /*public void deleteModel(String toscaModelId, String revisionId) {
-        SqlParameterSource in = new MapSqlParameterSource().addValue("v_tosca_model_id", toscaModelId)
-                       .addValue("v_revision_id", revisionId);
-        logSqlExecution(procDelToscaModel, in);
-    }*/
+    public Map<String, String> getDictionaryElementsByType(String dictionaryElementType) {
+        Map<String, String> dictionaryItems = new HashMap<>();
+        String dictionarySql = "SELECT dict_element_name, dict_element_short_name " + "FROM dictionary_elements "
+            + "WHERE dict_element_type = '" + dictionaryElementType + "'";
+
+        List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
+
+        if (rows != null) {
+            rows.forEach(row -> {
+                dictionaryItems.put(((String) row.get("dict_element_short_name")),
+                    ((String) row.get("dict_element_name")));
+            });
+        }
+        return dictionaryItems;
+    }
 }