diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api')
5 files changed, 199 insertions, 0 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 new file mode 100644 index 0000000000..37930ff9b3 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml @@ -0,0 +1,49 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <name>openecomp-zusammen-api</name> + <artifactId>openecomp-zusammen-api</artifactId> + + + <parent> + <groupId>org.openecomp.core</groupId> + <artifactId>openecomp-zusammen-lib</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-logging-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.core</groupId> + <artifactId>openecomp-facade-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.core</groupId> + <artifactId>openecomp-facade-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.amdocs.zusammen</groupId> + <artifactId>zusammen-adaptor-inbound-api</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-datatypes-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.4</version> + </dependency> + </dependencies> + + +</project>
\ No newline at end of file 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; + } + +} diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..30abb9bfed --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/resources/factoryConfiguration.json @@ -0,0 +1,3 @@ +{ + "org.openecomp.core.zusammen.api.ZusammenAdaptorFactory": "org.openecomp.core.zusammen.impl.ZusammenAdaptorFactoryImpl" +}
\ No newline at end of file |