summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2018-07-08 14:43:18 +0300
committertalig <talig@amdocs.com>2018-07-08 14:43:18 +0300
commitfbb1e44c2e189569bffdc23504b643257808397d (patch)
tree6dcd81ada2a9c3798d66fdf7794cc16ca22402a9 /openecomp-be/lib
parentc108dee7bd25a976dc4fa88eef3ec859facdf5d2 (diff)
Add commands to clean zusammen data
Expose REST to clean item version data of specific user. Add 2 commands to zusammen tool: 1. clean item data of specific user 2. delete public version Change-Id: I8630142bf34846359153eacc1556b10acecefa05 Issue-ID: SDC-1444 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java2
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java5
9 files changed, 47 insertions, 10 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
index 23eddadbf7..ca37b2200a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java
@@ -62,6 +62,8 @@ public interface ZusammenAdaptor {
void forceSyncVersion(SessionContext context, Id itemId, Id versionId);
+ void cleanVersion(SessionContext context, Id itemId, Id versionId);
+
Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext,
Id elementId);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
index 1589c1a25b..fd44073bb9 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java
@@ -65,6 +65,8 @@ public interface ZusammenConnector {
void forceSyncVersion(SessionContext context, Id itemId, Id versionId);
+ void cleanVersion(SessionContext context, Id itemId, Id versionId);
+
ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
index 83bbc5b49a..f8b048ce92 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java
@@ -290,6 +290,17 @@ public class ZusammenConnectorImpl implements ZusammenConnector {
}
@Override
+ public void cleanVersion(SessionContext context, Id itemId, Id versionId) {
+ Response<Void> response =
+ versionAdaptorFactory.createInterface(context).delete(context, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String.format(
+ "failed to clean item Version. ItemId: %s, versionId: %s, message: %s",
+ itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+ }
+ }
+
+ @Override
public ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId) {
Response<ItemVersionConflict> response =
versionAdaptorFactory.createInterface(context).getConflict(context, itemId, versionId);
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
index 968ff28963..1c63ff8e2e 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java
@@ -277,6 +277,11 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor {
}
@Override
+ public void cleanVersion(SessionContext context, Id itemId, Id versionId) {
+ connector.cleanVersion(context, itemId, versionId);
+ }
+
+ @Override
public void revert(SessionContext context, Id itemId, Id versionId, Id revisionId) {
connector.revertVersionRevision(context, itemId, versionId, revisionId);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
index dbf5ad9bf9..21d447e8de 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
@@ -367,6 +367,11 @@ public class ServiceModelDaoFactoryTest {
}
@Override
+ public void cleanVersion(SessionContext sessionContext, Id itemId, Id versionId) {
+
+ }
+
+ @Override
public Optional<ElementInfo> getElementInfo(SessionContext context,
ElementContext elementContext,
Id elementId) {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
index cbb234e3e2..06382b2ef6 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
@@ -43,4 +43,6 @@ public interface VersioningManager {
List<Revision> listRevisions(String itemId, Version version);
void updateVersion(String itemId, Version version);
+
+ void clean(String itemId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java
index f557e4d4ec..978ab435e0 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java
@@ -1,10 +1,9 @@
package org.openecomp.sdc.versioning.dao;
-import org.openecomp.sdc.versioning.dao.types.Revision;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
import java.util.List;
import java.util.Optional;
+import org.openecomp.sdc.versioning.dao.types.Revision;
+import org.openecomp.sdc.versioning.dao.types.Version;
public interface VersionDao {
List<Version> list(String itemId);
@@ -23,6 +22,8 @@ public interface VersionDao {
void forceSync(String itemId, Version version);
+ void clean(String itemId, Version version);
+
void revert(String itemId, Version version, String revisionId);
List<Revision> listRevisions(String itemId, Version version);
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
index 32c17dbfce..3b783d5d25 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
@@ -1,5 +1,7 @@
package org.openecomp.sdc.versioning.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Info;
@@ -8,6 +10,10 @@ import com.amdocs.zusammen.datatypes.item.ItemVersionData;
import com.amdocs.zusammen.datatypes.item.ItemVersionStatus;
import com.amdocs.zusammen.datatypes.item.SynchronizationStatus;
import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -19,13 +25,6 @@ import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionState;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
-
public class VersionZusammenDaoImpl implements VersionDao {
public static final class ZusammenProperty {
@@ -111,6 +110,11 @@ public class VersionZusammenDaoImpl implements VersionDao {
}
@Override
+ public void clean(String itemId, Version version) {
+ zusammenAdaptor.cleanVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
+ }
+
+ @Override
public void revert(String itemId, Version version, String revisionId) {
zusammenAdaptor.revert(createSessionContext(), new Id(itemId), new Id(version.getId()),
new Id(revisionId));
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
index 091def645d..21b738746d 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
@@ -183,4 +183,9 @@ public class VersioningManagerImpl implements VersioningManager {
versionDao.update(itemId, version);
}
+ @Override
+ public void clean(String itemId, Version version) {
+ versionDao.clean(itemId, version);
+ }
+
}