aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao/src/main/java')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
index 5d1501c0b5..c250aecdef 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
@@ -84,7 +84,14 @@ public class ToscaModelImportCassandraDao extends CassandraDao {
LOGGER.info("{} successfully initialized", ToscaModelImportCassandraDao.class.getName());
}
- public void importAll(final String modelId, final List<ToscaImportByModel> toscaImportByModelList) {
+ /**
+ * Completely replaces the previous model imports by the imports on the given list that are from the same model.
+ * New imports will be added, existing will be replaced and the remaining will be deleted.
+ *
+ * @param modelId the model id
+ * @param toscaImportByModelList the new list of imports
+ */
+ public void replaceImports(final String modelId, final List<ToscaImportByModel> toscaImportByModelList) {
final List<ToscaImportByModel> importOfModelList = toscaImportByModelList.stream()
.filter(toscaImportByModel -> modelId.equals(toscaImportByModel.getModelId()))
.collect(Collectors.toList());
@@ -99,7 +106,13 @@ public class ToscaModelImportCassandraDao extends CassandraDao {
);
}
- public void importOnly(final String modelId, final List<ToscaImportByModel> toscaImportByModelList) {
+ /**
+ * Saves all imports provided on the list that are from the given modelId.
+ *
+ * @param modelId the model id
+ * @param toscaImportByModelList the list of imports to save
+ */
+ public void saveAll(final String modelId, final List<ToscaImportByModel> toscaImportByModelList) {
toscaImportByModelList.stream()
.filter(toscaImportByModel -> modelId.equals(toscaImportByModel.getModelId()))
.forEach(toscaImportByModelMapper::save);