diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib')
3 files changed, 16 insertions, 75 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml index ee59b5bf77..a1337f6c95 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml @@ -24,11 +24,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.openecomp.sdc.core</groupId> <artifactId>openecomp-facade-api</artifactId> <version>${project.version}</version> 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 35c07cbee0..694c35ebbe 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 @@ -15,11 +15,10 @@ import com.amdocs.zusammen.datatypes.item.ItemVersion; import com.amdocs.zusammen.datatypes.item.ItemVersionData; import com.amdocs.zusammen.datatypes.item.ItemVersionStatus; import com.amdocs.zusammen.datatypes.item.Resolution; +import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions; import com.amdocs.zusammen.datatypes.itemversion.Tag; -import org.openecomp.sdc.versioning.dao.types.Revision; import java.util.Collection; -import java.util.List; import java.util.Optional; public interface ZusammenAdaptor { @@ -95,11 +94,11 @@ public interface ZusammenAdaptor { void resolveElementConflict(SessionContext context, ElementContext elementContext, ZusammenElement element, Resolution resolution); - Collection<HealthInfo> checkHealth(SessionContext context); + void revert(SessionContext context, Id itemId, Id versionId, Id revisionId); - String getVersion(SessionContext context); + ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId); - void revert(SessionContext sessionContext, String itemId, String versionId, String revisionId); + Collection<HealthInfo> checkHealth(SessionContext context); - List<Revision> listRevisions(SessionContext sessionContext, String itemId, String versionId); + String getVersion(SessionContext context); } 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 9bdbfd681c..6f4352b10e 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 @@ -20,11 +20,9 @@ import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions; import com.amdocs.zusammen.datatypes.itemversion.Tag; import org.openecomp.core.zusammen.api.ZusammenAdaptor; import org.openecomp.core.zusammen.db.ZusammenConnector; -import org.openecomp.sdc.versioning.dao.types.Revision; import java.util.ArrayList; import java.util.Collection; -import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.function.Predicate; @@ -108,7 +106,8 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor { } @Override - public Optional<ElementConflict> getElementConflict(SessionContext context, ElementContext elementContext, + public Optional<ElementConflict> getElementConflict(SessionContext context, + ElementContext elementContext, Id elementId) { return Optional.ofNullable(connector.getElementConflict(context, elementContext, elementId)); } @@ -184,7 +183,7 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor { @Override public Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId) { Collection<ItemVersion> versions = connector.listPublicVersions(context, itemId); - if (versions == null || versions.size() == 0) { + if (versions == null || versions.isEmpty()) { return Optional.empty(); } List<ItemVersion> itemVersions = new ArrayList<>(versions); @@ -242,18 +241,6 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor { connector.resetVersionHistory(context, itemId, versionId, changeRef); } - /*@Override - public void revertVersionToRevision(SessionContext context, Id itemId, Id versionId, - Id revisionId) { - connector.resetVersionRevision(context, itemId, versionId, revisionId); - }*/ - - /*@Override - public ItemVersionRevisions listVersionRevisions(SessionContext context, Id itemId, Id - versionId) { - return connector.listVersionRevisions(context, itemId, versionId); - }*/ - @Override public void publishVersion(SessionContext context, Id itemId, Id versionId, String message) { connector.publishVersion(context, itemId, versionId, message); @@ -270,63 +257,23 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor { } @Override - public Collection<HealthInfo> checkHealth(SessionContext context) { - return connector.checkHealth(context); + public void revert(SessionContext context, Id itemId, Id versionId, Id revisionId) { + connector.revertVersionRevision(context, itemId, versionId, revisionId); } @Override - public String getVersion(SessionContext sessionContext) { - return connector.getVersion(sessionContext); + public ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId) { + return connector.listVersionRevisions(context, itemId, versionId); } @Override - public void revert(SessionContext sessionContext, String itemId, String versionId, - String revisionId) { - connector.revertVersionRevision(sessionContext, new Id(itemId), new Id(versionId), - new Id(revisionId)); + public Collection<HealthInfo> checkHealth(SessionContext context) { + return connector.checkHealth(context); } @Override - public List<Revision> listRevisions(SessionContext sessionContext, String itemId, - String versionId) { - List<Revision> revisions = new ArrayList<>(); - ItemVersionRevisions itemVersionRevisions = - connector.listVersionRevisions(sessionContext, new Id(itemId), new Id - (versionId)); - if(itemVersionRevisions == null || itemVersionRevisions.getItemVersionRevisions()==null || - itemVersionRevisions.getItemVersionRevisions().size()==0) { - return revisions; - } - else{ - revisions = itemVersionRevisions.getItemVersionRevisions().stream().map - (revision -> { - Revision rev = new Revision(); - rev.setId(revision.getRevisionId().getValue()); - rev.setTime(revision.getTime()); - rev.setUser(revision.getUser()); - rev.setMessage(revision.getMessage()); - return rev; - }).collect(Collectors.toList()); - revisions.sort(new Comparator<Revision>() { - @Override - public int compare(Revision o1, Revision o2) { - if(o1.getTime().before(o2.getTime())) return 1; - else return -1; - } - }); - // when creating a new item an initial version is created with - // invalid data. this revision is not an applicable revision. - //the logic of identifying this revision is: - //1- only the first version of item has this issue - //2- only in the first item version there are 2 revisions created - //3- the second revision is in format "Initial {vlm/vsp}: {name of the vlm/vsp} - //4- only if a revision in this format exists we remove the first revision. - if(revisions.size()>1 && revisions.get(revisions.size()-2).getMessage().matches("Initial " + - ".*:.*")){ - revisions.remove(revisions.size()-1); - } - return revisions; - } + public String getVersion(SessionContext context) { + return connector.getVersion(context); } private static void sortItemVersionListByModificationTimeDescOrder( |