diff options
author | 2017-12-20 14:30:43 +0200 | |
---|---|---|
committer | 2017-12-21 11:12:33 +0000 | |
commit | 8e9c0653dd6c6862123c9609ae34e1206d86456e (patch) | |
tree | 5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api | |
parent | 785ebcc95de3e064e843bec04ba7a209d854fc7c (diff) |
Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api')
2 files changed, 68 insertions, 43 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 2ba447fd6a..35c07cbee0 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 @@ -1,7 +1,9 @@ package org.openecomp.core.zusammen.api; import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementConflict; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ItemVersionConflict; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; @@ -11,31 +13,53 @@ import com.amdocs.zusammen.datatypes.item.Info; import com.amdocs.zusammen.datatypes.item.Item; 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.Tag; +import org.openecomp.sdc.versioning.dao.types.Revision; import java.util.Collection; +import java.util.List; import java.util.Optional; public interface ZusammenAdaptor { Collection<Item> listItems(SessionContext context); + Item getItem(SessionContext context, Id itemId); + Id createItem(SessionContext context, Info info); void updateItem(SessionContext context, Id itemId, Info info); - // TODO: 4/4/2017 fix this workaround when versionId will be recieved from UI + // TODO: 4/4/2017 remove this workaround when versionId will be recieved from UI Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId); + Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId); + + ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId); + Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData itemVersionData); void updateVersion(SessionContext context, Id itemId, Id versionId, ItemVersionData itemVersionData); + ItemVersion getVersion(SessionContext context, Id itemId, Id versionId); + + ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId); + + ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId); + void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag); - void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef); + void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String version); + + void publishVersion(SessionContext context, Id itemId, Id versionId, String message); + + void syncVersion(SessionContext context, Id itemId, Id versionId); + + void forceSyncVersion(SessionContext context, Id itemId, Id versionId); Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext, Id elementId); @@ -43,38 +67,39 @@ public interface ZusammenAdaptor { Optional<Element> getElement(SessionContext context, ElementContext elementContext, String elementId); // TODO: 4/3/2017 change to Id - Optional<Element> getElementByName( - SessionContext context, ElementContext elementContext, Id parentElementId, - String elementName); + Optional<Element> getElementByName(SessionContext context, ElementContext elementContext, + Id parentElementId, String elementName); - Collection<ElementInfo> listElements(SessionContext context, - ElementContext elementContext, + Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext, Id parentElementId); - Collection<Element> listElementData(SessionContext context, - ElementContext elementContext, + Collection<Element> listElementData(SessionContext context, ElementContext elementContext, Id parentElementId); /** - * Lists the sub elements of the element named <elementName> which is a sub element of <parentElementId> - * @param context - * @param elementContext - * @param parentElementId - * @param elementName - * @return + * Lists the sub elements of the element named elementName which is a sub element of + * parentElementId */ - Collection<ElementInfo> listElementsByName( - SessionContext context, ElementContext elementContext, Id parentElementId, - String elementName); + Collection<ElementInfo> listElementsByName(SessionContext context, ElementContext elementContext, + Id parentElementId, String elementName); + + Optional<ElementInfo> getElementInfoByName(SessionContext context, ElementContext elementContext, + Id parentElementId, String elementName); - Optional<ElementInfo> getElementInfoByName( - SessionContext context, ElementContext elementContext, Id parentElementId, - String elementName); + Optional<ElementConflict> getElementConflict(SessionContext context, + ElementContext elementContext, Id elementId); - Optional<Element> saveElement(SessionContext context, ElementContext elementContext, - ZusammenElement element, String message); + Element saveElement(SessionContext context, ElementContext elementContext, + ZusammenElement element, String message); + + void resolveElementConflict(SessionContext context, ElementContext elementContext, + ZusammenElement element, Resolution resolution); Collection<HealthInfo> checkHealth(SessionContext context); - String getVersion(SessionContext sessionContext); + String getVersion(SessionContext context); + + void revert(SessionContext sessionContext, String itemId, String versionId, String revisionId); + + List<Revision> listRevisions(SessionContext sessionContext, String itemId, String versionId); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java index 3df6151fae..623f958ceb 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java @@ -1,40 +1,40 @@ package org.openecomp.core.zusammen.api; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.UserInfo; import com.amdocs.zusammen.datatypes.item.Action; import com.amdocs.zusammen.datatypes.item.Info; -import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import org.openecomp.sdc.common.session.SessionContextProviderFactory; +import org.openecomp.sdc.datatypes.model.ElementType; +import org.openecomp.types.ElementPropertyName; public class ZusammenUtil { - // TODO: 3/19/2017 add user and tenant args + public static SessionContext createSessionContext() { + org.openecomp.sdc.common.session.SessionContext asdcSessionContext = + SessionContextProviderFactory.getInstance().createInterface().get(); + SessionContext sessionContext = new SessionContext(); - sessionContext.setUser(new UserInfo("GLOBAL_USER")); - sessionContext.setTenant("dox"); + sessionContext.setUser(new UserInfo(asdcSessionContext.getUser().getUserId())); + sessionContext.setTenant(asdcSessionContext.getTenant()); return sessionContext; } - public static ZusammenElement buildStructuralElement(String structureElementName, - Action action) { - ZusammenElement element = new ZusammenElement(); + public static ZusammenElement buildStructuralElement(ElementType elementType, Action action) { + ZusammenElement element = buildElement(null, action); Info info = new Info(); - info.setName(structureElementName); + info.setName(elementType.name()); + info.addProperty(ElementPropertyName.elementType.name(), elementType.name()); element.setInfo(info); - if (action != null) { - element.setAction(action); - } return element; } - // TODO: 4/24/2017 remove upon working with more than one single version - public static ItemVersionData createFirstVersionData() { - Info info = new Info(); - info.setName("main version"); - ItemVersionData itemVersionData = new ItemVersionData(); - itemVersionData.setInfo(info); - return itemVersionData; + public static ZusammenElement buildElement(Id elementId, Action action) { + ZusammenElement element = new ZusammenElement(); + element.setElementId(elementId); + element.setAction(action); + return element; } - } |