diff options
author | 2017-06-09 02:39:56 +0300 | |
---|---|---|
committer | 2017-06-09 02:39:56 +0300 | |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core')
3 files changed, 147 insertions, 0 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 new file mode 100644 index 0000000000..1495ed27a8 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java @@ -0,0 +1,76 @@ +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.ElementInfo; +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.item.ElementContext; +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.itemversion.Tag; +import org.apache.commons.lang3.tuple.ImmutablePair; + +import java.util.Collection; +import java.util.Optional; + +public interface ZusammenAdaptor { + + Collection<Item> listItems(SessionContext context); + + 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 + Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId); + + Id createVersion(SessionContext context, Id itemId, Id baseVersionId, + ItemVersionData itemVersionData); + + void updateVersion(SessionContext context, Id itemId, Id versionId, + ItemVersionData itemVersionData); + + void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag); + + void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef); + + Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext, + Id elementId); + + 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); + + Collection<ElementInfo> listElements(SessionContext context, + ElementContext elementContext, + Id parentElementId); + + 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 + */ + Collection<ElementInfo> listElementsByName( + SessionContext context, ElementContext elementContext, Id parentElementId, + String elementName); + + Optional<ElementInfo> getElementInfoByName( + SessionContext context, ElementContext elementContext, Id parentElementId, + String elementName); + + Optional<Element> saveElement(SessionContext context, ElementContext elementContext, + ZusammenElement element, String message); +} diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java new file mode 100644 index 0000000000..53981ba478 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.core.zusammen.api; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ZusammenAdaptorFactory extends AbstractComponentFactory<ZusammenAdaptor> { + + public static ZusammenAdaptorFactory getInstance() { + return AbstractFactory.getInstance(ZusammenAdaptorFactory.class); + } +} 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 new file mode 100644 index 0000000000..3df6151fae --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java @@ -0,0 +1,40 @@ +package org.openecomp.core.zusammen.api; + +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +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; + +public class ZusammenUtil { + // TODO: 3/19/2017 add user and tenant args + public static SessionContext createSessionContext() { + SessionContext sessionContext = new SessionContext(); + sessionContext.setUser(new UserInfo("GLOBAL_USER")); + sessionContext.setTenant("dox"); + return sessionContext; + } + + public static ZusammenElement buildStructuralElement(String structureElementName, + Action action) { + ZusammenElement element = new ZusammenElement(); + Info info = new Info(); + info.setName(structureElementName); + 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; + } + +} |