summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-03-05 14:24:21 +0200
committerayalaben <ayala.benzvi@amdocs.com>2018-03-05 14:24:21 +0200
commit0067871bc673ffa76c7232292156301e734fc922 (patch)
tree1103dfc3a757d298ba3e4fbcefce4ef35a19c0a3 /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
parent7d5ccf3d6207008321595ec45149a370ba80ffe8 (diff)
Delete VSP merge Hint - fix sonar issues
Change-Id: I7e8d3efd9db3ec714ab97d740cc71e826713b467 Issue-ID: SDC-1014 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspMergeDao.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java34
2 files changed, 27 insertions, 17 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspMergeDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspMergeDao.java
index c9525bfbd8..aefab60759 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspMergeDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspMergeDao.java
@@ -5,12 +5,14 @@ import org.openecomp.sdc.versioning.dao.types.Version;
public interface VspMergeDao {
- boolean isVspModelConflicted(String vspId, Version version);
+ boolean isConflicted(String vspId, Version version);
- void updateVspModelId(String vspId, Version version);
+ void updateHint(String vspId, Version version);
+
+ void deleteHint(String vspId, Version version);
// TODO: 11/7/2017 change to sdc Resolution
- void updateVspModelConflictResolution(String vspId, Version version, Resolution resolution);
+ void updateConflictResolution(String vspId, Version version, Resolution resolution);
- void applyVspModelConflictResolution(String vspId, Version version);
+ void applyConflictResolution(String vspId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java
index 2ccc47a651..3516263fbc 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java
@@ -38,7 +38,7 @@ public class VspMergeDaoImpl implements VspMergeDao {
}
@Override
- public boolean isVspModelConflicted(String vspId, Version version) {
+ public boolean isConflicted(String vspId, Version version) {
SessionContext context = createSessionContext();
ElementContext elementContext = new ElementContext(new Id(vspId), new Id(version.getId()));
@@ -46,7 +46,7 @@ public class VspMergeDaoImpl implements VspMergeDao {
}
@Override
- public void updateVspModelId(String vspId, Version version) {
+ public void updateHint(String vspId, Version version) {
SessionContext context = createSessionContext();
ElementContext elementContext = new ElementContext(new Id(vspId), new Id(version.getId()));
@@ -60,13 +60,18 @@ public class VspMergeDaoImpl implements VspMergeDao {
}
@Override
- public void updateVspModelConflictResolution(String vspId, Version version,
- Resolution resolution) {
+ public void deleteHint(String vspId, Version version) {
+ accessor.delete(getUser(),vspId,version.getId());
+ }
+
+ @Override
+ public void updateConflictResolution(String vspId, Version version,
+ Resolution resolution) {
accessor.updateModelResolution(resolution, getUser(), vspId, version.getId());
}
@Override
- public void applyVspModelConflictResolution(String vspId, Version version) {
+ public void applyConflictResolution(String vspId, Version version) {
//called only when no conflicts
SessionContext context = createSessionContext();
@@ -83,7 +88,7 @@ public class VspMergeDaoImpl implements VspMergeDao {
}
String user = getUser();
- Row row = accessor.getModelMergeHint(user, vspId, version.getId()).one();
+ Row row = accessor.get(user, vspId, version.getId()).one();
if (row == null) {
throw new IllegalStateException(
"Vsp model id must exists if its conflict is being resolved");
@@ -99,7 +104,7 @@ public class VspMergeDaoImpl implements VspMergeDao {
String chosenModelId =
keepOnlyChosenVspModel(context, elementContext, vspModels, resolution, localModelId);
- accessor.updateModelMergeHint(chosenModelId, null, user, vspId, version.getId());
+ accessor.update(chosenModelId, null, user, vspId, version.getId());
}
private String keepOnlyChosenVspModel(SessionContext context, ElementContext elementContext,
@@ -130,7 +135,7 @@ public class VspMergeDaoImpl implements VspMergeDao {
}
private void updateVspModelId(String vspId, Version version, String vspModelId) {
- accessor.updateModelMergeHint(vspModelId, null, getUser(), vspId, version.getId());
+ accessor.update(vspModelId, null, getUser(), vspId, version.getId());
}
private String getUser() {
@@ -141,18 +146,21 @@ public class VspMergeDaoImpl implements VspMergeDao {
@Accessor
interface VspMergeHintAccessor {
+ @Query("SELECT model_id, model_resolution FROM vsp_merge_hint " +
+ "WHERE space=? AND item_id=? AND version_id=?")
+ ResultSet get(String space, String itemId, String versionId);
+
@Query("UPDATE vsp_merge_hint SET model_id=?, model_resolution=? " +
"WHERE space=? AND item_id=? AND version_id=?")
- void updateModelMergeHint(String vspModelId, Resolution modelResolution, String space,
- String itemId, String versionId);
+ void update(String vspModelId, Resolution modelResolution, String space,
+ String itemId, String versionId);
@Query(
"UPDATE vsp_merge_hint SET model_resolution=? WHERE space=? AND item_id=? AND version_id=?")
void updateModelResolution(Resolution modelResolution, String space, String itemId,
String versionId);
- @Query("SELECT model_id, model_resolution FROM vsp_merge_hint " +
- "WHERE space=? AND item_id=? AND version_id=?")
- ResultSet getModelMergeHint(String space, String itemId, String versionId);
+ @Query("DELETE from vsp_merge_hint WHERE space=? AND item_id=? AND version_id=?")
+ void delete(String space, String itemId, String versionId);
}
}