aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/impl/VspMergeHandler.java21
-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
3 files changed, 34 insertions, 31 deletions
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/impl/VspMergeHandler.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/impl/VspMergeHandler.java
index f7d0bca392..8a5a53f98b 100644
--- a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/impl/VspMergeHandler.java
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/impl/VspMergeHandler.java
@@ -14,14 +14,7 @@ import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VspMergeDao;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -42,7 +35,7 @@ public class VspMergeHandler implements ItemMergeHandler {
.of(OrchestrationTemplateCandidateContent, OrchestrationTemplateValidationData)
.collect(Collectors.toSet());
private static final Map<ElementType, Set<ElementType>> ELEMENT_TYPE_TO_CONFLICT_DEPENDANT_TYPES =
- new HashMap<>();
+ new EnumMap<>(ElementType.class);
static {
ELEMENT_TYPE_TO_CONFLICT_DEPENDANT_TYPES.put(OrchestrationTemplateCandidate,
@@ -61,13 +54,13 @@ public class VspMergeHandler implements ItemMergeHandler {
@Override
public boolean isConflicted(String itemId, Version version) {
- return vspMergeDao.isVspModelConflicted(itemId, version);
+ return vspMergeDao.isConflicted(itemId, version);
}
@Override
public void finalizeMerge(String itemId, Version version) {
if (!conflictsDao.isConflicted(itemId, version)) {
- vspMergeDao.applyVspModelConflictResolution(itemId, version);
+ vspMergeDao.applyConflictResolution(itemId, version);
}
}
@@ -88,7 +81,7 @@ public class VspMergeHandler implements ItemMergeHandler {
}
}
- if (!vspModelConflicted && vspMergeDao.isVspModelConflicted(itemId, version)) {
+ if (!vspModelConflicted && vspMergeDao.isConflicted(itemId, version)) {
elementConflicts
.add(new ConflictInfo(VSP_MODEL_CONFLICT_ID, NetworkPackage, NetworkPackage.name()));
}
@@ -127,7 +120,7 @@ public class VspMergeHandler implements ItemMergeHandler {
public boolean resolveConflict(String itemId, Version version, String conflictId,
ConflictResolution resolution) {
if (VSP_MODEL_CONFLICT_ID.equals(conflictId)) {
- vspMergeDao.updateVspModelConflictResolution(itemId, version,
+ vspMergeDao.updateConflictResolution(itemId, version,
com.amdocs.zusammen.datatypes.item.Resolution.valueOf(resolution.getResolution().name()));
return true;
}
@@ -136,7 +129,7 @@ public class VspMergeHandler implements ItemMergeHandler {
throw getConflictNotExistException(itemId, version, conflictId);
}
if (conflict.getType() == VspModel) {
- vspMergeDao.updateVspModelConflictResolution(itemId, version,
+ vspMergeDao.updateConflictResolution(itemId, version,
com.amdocs.zusammen.datatypes.item.Resolution.valueOf(resolution.getResolution().name()));
conflictsDao.resolveConflict(itemId, version, conflictId, new ConflictResolution(
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);
}
}