summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/convertor/ElementConvertor.java36
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java100
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptorFactory.java11
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenUtil.java64
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/AsdcElement.java226
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/ElementPropertyName.java3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java81
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java11
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java20
-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.java594
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java18
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java23
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java17
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java452
14 files changed, 764 insertions, 892 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/convertor/ElementConvertor.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/convertor/ElementConvertor.java
index 2da562f4ea..932adbfe59 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/convertor/ElementConvertor.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/convertor/ElementConvertor.java
@@ -28,29 +28,25 @@ import org.openecomp.types.ElementPropertyName;
public abstract class ElementConvertor<T> {
- public static ElementType getElementType(Element element) {
- return ElementType
- .valueOf(element.getInfo().getProperty(ElementPropertyName.elementType.name()));
- }
+ public static ElementType getElementType(Element element) {
+ return ElementType.valueOf(element.getInfo().getProperty(ElementPropertyName.elementType.name()));
+ }
- public static String getElementName(Element element) {
- return element.getInfo().getName();
- }
+ public static String getElementName(Element element) {
+ return element.getInfo().getName();
+ }
+ abstract public T convert(Element element);
- abstract public T convert(Element element);
+ public T convert(ElementInfo elementInfo) {
+ throw new UnsupportedOperationException("convert elementInfo item is not supported ");
+ }
- public T convert( ElementInfo elementInfo) {
- throw new UnsupportedOperationException("convert elementInfo item is not supported ");
- }
+ public T convert(Item item) {
+ throw new UnsupportedOperationException("convert from item is not supported ");
+ }
-
- public T convert( Item item) {
- throw new UnsupportedOperationException("convert from item is not supported ");
- }
-
-
- public T convert( ItemVersion itemVersion) {
- throw new UnsupportedOperationException("convert from itemVersion is not supported ");
- }
+ public T convert(ItemVersion itemVersion) {
+ throw new UnsupportedOperationException("convert from itemVersion is not supported ");
+ }
}
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 32630df115..0583bed12f 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
@@ -13,99 +13,95 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.core.zusammen.api;
-import com.amdocs.zusammen.adaptor.inbound.api.types.item.*;
+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;
import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.*;
+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.item.ItemVersionStatus;
+import com.amdocs.zusammen.datatypes.item.Resolution;
import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions;
import com.amdocs.zusammen.datatypes.itemversion.Tag;
-
import java.util.Collection;
import java.util.Optional;
public interface ZusammenAdaptor {
- Collection<Item> listItems(SessionContext context);
+ Collection<Item> listItems(SessionContext context);
- Item getItem(SessionContext context, Id itemId);
+ Item getItem(SessionContext context, Id itemId);
- void deleteItem(SessionContext context, Id itemId);
+ void deleteItem(SessionContext context, Id itemId);
- Id createItem(SessionContext context, Info info);
+ Id createItem(SessionContext context, Info info);
- void updateItem(SessionContext context, Id itemId, Info info);
+ void updateItem(SessionContext context, Id itemId, Info info);
- Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId);
+ Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId);
- ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId);
+ ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId);
- Id createVersion(SessionContext context, Id itemId, Id baseVersionId,
- ItemVersionData itemVersionData);
+ Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData itemVersionData);
- void updateVersion(SessionContext context, Id itemId, Id versionId,
- ItemVersionData itemVersionData);
+ void updateVersion(SessionContext context, Id itemId, Id versionId, ItemVersionData itemVersionData);
- ItemVersion getVersion(SessionContext context, Id itemId, Id versionId);
+ ItemVersion getVersion(SessionContext context, Id itemId, Id versionId);
- ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId);
+ ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId);
- ItemVersionConflict getVersionConflict(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 tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag);
- void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String version);
+ void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String version);
- void publishVersion(SessionContext context, Id itemId, Id versionId, String message);
+ void publishVersion(SessionContext context, Id itemId, Id versionId, String message);
- void syncVersion(SessionContext context, Id itemId, Id versionId);
+ void syncVersion(SessionContext context, Id itemId, Id versionId);
- void forceSyncVersion(SessionContext context, Id itemId, Id versionId);
+ void forceSyncVersion(SessionContext context, Id itemId, Id versionId);
- void cleanVersion(SessionContext context, Id itemId, Id versionId);
+ void cleanVersion(SessionContext context, Id itemId, Id versionId);
- Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext,
- Id elementId);
+ 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> 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,
- Id parentElementId);
+ Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext, Id parentElementId);
- Collection<Element> listElementData(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
- */
- Collection<ElementInfo> listElementsByName(SessionContext context, ElementContext elementContext,
- Id parentElementId, String elementName);
+ /**
+ * 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);
- 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<ElementConflict> getElementConflict(SessionContext context, ElementContext elementContext, Id elementId);
- 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);
+ void resolveElementConflict(SessionContext context, ElementContext elementContext, ZusammenElement element, Resolution resolution);
- void revert(SessionContext context, Id itemId, Id versionId, Id revisionId);
+ void revert(SessionContext context, Id itemId, Id versionId, Id revisionId);
- ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId);
+ ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId);
- Collection<HealthInfo> checkHealth(SessionContext context);
+ Collection<HealthInfo> checkHealth(SessionContext context);
- String getVersion(SessionContext context);
+ String getVersion(SessionContext context);
}
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
index 53981ba478..1f0bbe58ec 100644
--- 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.core.zusammen.api;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class ZusammenAdaptorFactory extends AbstractComponentFactory<ZusammenAdaptor> {
- public static ZusammenAdaptorFactory getInstance() {
- return AbstractFactory.getInstance(ZusammenAdaptorFactory.class);
- }
+ 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
index f6f8b2b5d9..a6595699f5 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
@@ -31,43 +31,39 @@ import org.openecomp.types.ElementPropertyName;
public class ZusammenUtil {
- private ZusammenUtil() {
- throw new IllegalStateException("Utility class");
- }
+ private ZusammenUtil() {
+ throw new IllegalStateException("Utility class");
+ }
- public static SessionContext createSessionContext() {
- org.openecomp.sdc.common.session.SessionContext asdcSessionContext =
- SessionContextProviderFactory.getInstance().createInterface().get();
+ public static SessionContext createSessionContext() {
+ org.openecomp.sdc.common.session.SessionContext asdcSessionContext = SessionContextProviderFactory.getInstance().createInterface().get();
+ return createSessionContext(asdcSessionContext.getUser().getUserId(), asdcSessionContext.getTenant());
+ }
- return createSessionContext(asdcSessionContext.getUser().getUserId(), asdcSessionContext
- .getTenant());
- }
+ private static SessionContext createSessionContext(String user, String tenant) {
+ SessionContext sessionContext = new SessionContext();
+ sessionContext.setUser(new UserInfo(user));
+ sessionContext.setTenant(tenant);
+ return sessionContext;
+ }
- private static SessionContext createSessionContext(String user, String tenant) {
- SessionContext sessionContext = new SessionContext();
- sessionContext.setUser(new UserInfo(user));
- sessionContext.setTenant(tenant);
- return sessionContext;
- }
+ public static ZusammenElement buildStructuralElement(ElementType elementType, Action action) {
+ return buildStructuralElement(elementType.name(), action);
+ }
- public static ZusammenElement buildStructuralElement(ElementType elementType, Action action) {
- return buildStructuralElement(elementType.name(), action);
- }
+ public static ZusammenElement buildStructuralElement(String elementType, Action action) {
+ ZusammenElement element = buildElement(null, action);
+ Info info = new Info();
+ info.setName(elementType);
+ info.addProperty(ElementPropertyName.elementType.name(), elementType);
+ element.setInfo(info);
+ return element;
+ }
-
- public static ZusammenElement buildStructuralElement(String elementType, Action action) {
- ZusammenElement element = buildElement(null, action);
- Info info = new Info();
- info.setName(elementType);
- info.addProperty(ElementPropertyName.elementType.name(), elementType);
- element.setInfo(info);
- return element;
- }
-
- public static ZusammenElement buildElement(Id elementId, Action action) {
- ZusammenElement element = new ZusammenElement();
- element.setElementId(elementId);
- element.setAction(action);
- return element;
- }
+ public static ZusammenElement buildElement(Id elementId, Action action) {
+ ZusammenElement element = new ZusammenElement();
+ element.setElementId(elementId);
+ element.setAction(action);
+ return element;
+ }
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/AsdcElement.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/AsdcElement.java
index 557226377e..6a3caa0210 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/AsdcElement.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/AsdcElement.java
@@ -25,7 +25,6 @@ import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
import com.amdocs.zusammen.utils.fileutils.FileUtils;
-
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
@@ -33,118 +32,115 @@ import java.util.Map;
public class AsdcElement implements Element {
- private String type;
- private String name;
- private String description;
-
- private Map<String, Object> properties;
- private byte[] data;
- private Collection<Relation> relations;
- private Collection<Element> subElements = new ArrayList<>();
- private Action action;
- private Id elementId;
-
- @Override
- public Action getAction() {
- return this.action;
- }
-
- @Override
- public Id getElementId() {
- return this.elementId;
- }
-
- @Override
- public Info getInfo() {
- Info info = new Info();
- info.setProperties(this.properties);
- info.addProperty(ElementPropertyName.elementType.name(), this.type != null ? this.type : this.name);
- info.setName(this.name);
- info.setDescription(this.description);
-
- return info;
- }
-
- @Override
- public Collection<Relation> getRelations() {
- return this.relations;
- }
-
- @Override
- public InputStream getData() {
- return FileUtils.toInputStream(this.data);
- }
-
- @Override
- public InputStream getSearchableData() {
- return null;
- }
-
- @Override
- public InputStream getVisualization() {
- return null;
- }
-
-
- @Override
- public Collection<Element> getSubElements() {
- return this.subElements;
- }
-
- public void setElementId(Id elementId) {
- this.elementId = elementId;
- }
-
- public void setData(InputStream data) {
- this.data = FileUtils.toByteArray(data);
- }
-
- public void setRelations(Collection<Relation> relations) {
- this.relations = relations;
- }
-
- public void setSubElements(Collection<Element> subElements) {
- this.subElements = subElements;
- }
-
- public void setAction(Action action) {
- this.action = action;
- }
-
- public AsdcElement addSubElement(Element element) {
- this.subElements.add(element);
- return this;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
+ private String type;
+ private String name;
+ private String description;
+ private Map<String, Object> properties;
+ private byte[] data;
+ private Collection<Relation> relations;
+ private Collection<Element> subElements = new ArrayList<>();
+ private Action action;
+ private Id elementId;
+
+ @Override
+ public Action getAction() {
+ return this.action;
+ }
+
+ public void setAction(Action action) {
+ this.action = action;
+ }
+
+ @Override
+ public Id getElementId() {
+ return this.elementId;
+ }
+
+ public void setElementId(Id elementId) {
+ this.elementId = elementId;
+ }
+
+ @Override
+ public Info getInfo() {
+ Info info = new Info();
+ info.setProperties(this.properties);
+ info.addProperty(ElementPropertyName.elementType.name(), this.type != null ? this.type : this.name);
+ info.setName(this.name);
+ info.setDescription(this.description);
+ return info;
+ }
+
+ @Override
+ public Collection<Relation> getRelations() {
+ return this.relations;
+ }
+
+ public void setRelations(Collection<Relation> relations) {
+ this.relations = relations;
+ }
+
+ @Override
+ public InputStream getData() {
+ return FileUtils.toInputStream(this.data);
+ }
+
+ public void setData(InputStream data) {
+ this.data = FileUtils.toByteArray(data);
+ }
+
+ @Override
+ public InputStream getSearchableData() {
+ return null;
+ }
+
+ @Override
+ public InputStream getVisualization() {
+ return null;
+ }
+
+ @Override
+ public Collection<Element> getSubElements() {
+ return this.subElements;
+ }
+
+ public void setSubElements(Collection<Element> subElements) {
+ this.subElements = subElements;
+ }
+
+ public AsdcElement addSubElement(Element element) {
+ this.subElements.add(element);
+ return this;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/ElementPropertyName.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/ElementPropertyName.java
index 6dad2a8316..895726c08f 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/ElementPropertyName.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/types/ElementPropertyName.java
@@ -20,6 +20,5 @@
package org.openecomp.types;
public enum ElementPropertyName {
- elementType,
- compositionData
+ elementType, compositionData
}
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 7932902dad..b65051cc52 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
@@ -13,84 +13,83 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.core.zusammen.db;
-import com.amdocs.zusammen.adaptor.inbound.api.types.item.*;
+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.commons.health.data.HealthInfo;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.*;
+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.item.ItemVersionStatus;
+import com.amdocs.zusammen.datatypes.item.Resolution;
import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions;
import com.amdocs.zusammen.datatypes.itemversion.Tag;
-
import java.util.Collection;
public interface ZusammenConnector {
- Collection<HealthInfo> checkHealth(SessionContext sessionContext);
-
- String getVersion(SessionContext sessionContext);
-
- Collection<Item> listItems(SessionContext context);
+ Collection<HealthInfo> checkHealth(SessionContext sessionContext);
- Item getItem(SessionContext context, Id itemId);
+ String getVersion(SessionContext sessionContext);
- Id createItem(SessionContext context, Info info);
+ Collection<Item> listItems(SessionContext context);
- void deleteItem(SessionContext context, Id itemId);
+ Item getItem(SessionContext context, Id itemId);
- void updateItem(SessionContext context, Id itemId, Info info);
+ Id createItem(SessionContext context, Info info);
+ void deleteItem(SessionContext context, Id itemId);
- Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId);
+ void updateItem(SessionContext context, Id itemId, Info info);
- ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId);
+ Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId);
- Id createVersion(SessionContext context, Id itemId, Id baseVersionId,
- ItemVersionData itemVersionData);
+ ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId);
- void updateVersion(SessionContext context, Id itemId, Id versionId,
- ItemVersionData itemVersionData);
+ Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData itemVersionData);
- ItemVersion getVersion(SessionContext context, Id itemId, Id versionId);
+ void updateVersion(SessionContext context, Id itemId, Id versionId, ItemVersionData itemVersionData);
- ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId);
+ ItemVersion getVersion(SessionContext context, Id itemId, Id versionId);
- void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag);
+ ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId);
- void resetVersionRevision(SessionContext context, Id itemId, Id versionId, Id revisionId);
+ void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag);
- void revertVersionRevision(SessionContext context, Id itemId, Id versionId, Id revisionId);
+ void resetVersionRevision(SessionContext context, Id itemId, Id versionId, Id revisionId);
- ItemVersionRevisions listVersionRevisions(SessionContext context, Id itemId, Id versionId);
+ void revertVersionRevision(SessionContext context, Id itemId, Id versionId, Id revisionId);
- void publishVersion(SessionContext context, Id itemId, Id versionId, String message);
+ ItemVersionRevisions listVersionRevisions(SessionContext context, Id itemId, Id versionId);
- void syncVersion(SessionContext context, Id itemId, Id versionId);
+ void publishVersion(SessionContext context, Id itemId, Id versionId, String message);
- void forceSyncVersion(SessionContext context, Id itemId, Id versionId);
+ void syncVersion(SessionContext context, Id itemId, Id versionId);
- void cleanVersion(SessionContext context, Id itemId, Id versionId);
+ void forceSyncVersion(SessionContext context, Id itemId, Id versionId);
- ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId);
+ void cleanVersion(SessionContext context, Id itemId, Id versionId);
+ ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId);
- Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext,
- Id parentElementId);
+ Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext, Id parentElementId);
- ElementInfo getElementInfo(SessionContext context, ElementContext elementContext, Id elementId);
+ ElementInfo getElementInfo(SessionContext context, ElementContext elementContext, Id elementId);
- Element getElement(SessionContext context, ElementContext elementContext, Id elementId);
+ Element getElement(SessionContext context, ElementContext elementContext, Id elementId);
- ElementConflict getElementConflict(SessionContext context, ElementContext elementContext,
- Id elementId);
+ ElementConflict getElementConflict(SessionContext context, ElementContext elementContext, Id elementId);
- Element saveElement(SessionContext context, ElementContext elementContext,
- Element element, String message);
+ Element saveElement(SessionContext context, ElementContext elementContext, Element element, String message);
- void resolveElementConflict(SessionContext context, ElementContext elementContext,
- Element element, Resolution resolution);
+ void resolveElementConflict(SessionContext context, ElementContext elementContext, Element element, Resolution resolution);
- void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef);
+ void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef);
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java
index 31a8bf598d..4f72386345 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnectorFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.core.zusammen.db;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class ZusammenConnectorFactory extends AbstractComponentFactory<ZusammenConnector> {
- public static ZusammenConnectorFactory getInstance() {
- return AbstractFactory.getInstance(ZusammenConnectorFactory.class);
- }
+ public static ZusammenConnectorFactory getInstance() {
+ return AbstractFactory.getInstance(ZusammenConnectorFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
index e6f9380c2b..d27475f73a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.core.zusammen.db.impl;
import com.amdocs.zusammen.adaptor.inbound.api.health.HealthAdaptorFactory;
@@ -28,13 +27,12 @@ import org.openecomp.core.zusammen.db.ZusammenConnector;
import org.openecomp.core.zusammen.db.ZusammenConnectorFactory;
public class ZusammenConnectorFactoryImpl extends ZusammenConnectorFactory {
- private static final ZusammenConnector INSTANCE =
- new ZusammenConnectorImpl(ItemAdaptorFactory.getInstance(),
- ItemVersionAdaptorFactory.getInstance(),
- ElementAdaptorFactory.getInstance(), HealthAdaptorFactory.getInstance());
- @Override
- public ZusammenConnector createInterface() {
- return INSTANCE;
- }
+ private static final ZusammenConnector INSTANCE = new ZusammenConnectorImpl(ItemAdaptorFactory.getInstance(),
+ ItemVersionAdaptorFactory.getInstance(), ElementAdaptorFactory.getInstance(), HealthAdaptorFactory.getInstance());
+
+ @Override
+ public ZusammenConnector createInterface() {
+ return INSTANCE;
+ }
}
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 474b7303ab..f604d45287 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
@@ -45,364 +45,302 @@ import org.openecomp.sdc.common.errors.SdcRuntimeException;
public class ZusammenConnectorImpl implements ZusammenConnector {
- private static final String GET_ELEMENT_ERR_MSG =
- "Failed to get element. Item Id: %s, version Id: %s, element Id: %s message: %s";
- private static final String GET_ELEMENT_IN_REV_ERR_MSG =
- "Failed to get element. Item Id: %s, version Id: %s, revision Id: %s, element Id: %s message: %s";
- private final ItemAdaptorFactory itemAdaptorFactory;
- private final ItemVersionAdaptorFactory versionAdaptorFactory;
- private final ElementAdaptorFactory elementAdaptorFactory;
- private final HealthAdaptorFactory healthAdaptorFactory;
-
- public ZusammenConnectorImpl(
- ItemAdaptorFactory itemAdaptorFactory,
- ItemVersionAdaptorFactory versionAdaptorFactory,
- ElementAdaptorFactory elementAdaptorFactory,
- HealthAdaptorFactory healthAdaptorFactory) {
- this.itemAdaptorFactory = itemAdaptorFactory;
- this.versionAdaptorFactory = versionAdaptorFactory;
- this.elementAdaptorFactory = elementAdaptorFactory;
- this.healthAdaptorFactory = healthAdaptorFactory;
- CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
- }
-
- @Override
- public Collection<HealthInfo> checkHealth(SessionContext sessionContext) {
- return healthAdaptorFactory.createInterface(sessionContext).getHealthStatus(sessionContext);
- }
-
- @Override
- public String getVersion(SessionContext sessionContext) {
- return healthAdaptorFactory.createInterface(sessionContext).getVersion();
- }
-
- @Override
- public Collection<Item> listItems(SessionContext context) {
- Response<Collection<Item>> response = itemAdaptorFactory.createInterface(context).list(context);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- "Failed to list Items. message:" + response.getReturnCode().toString());
+ private static final String GET_ELEMENT_ERR_MSG = "Failed to get element. Item Id: %s, version Id: %s, element Id: %s message: %s";
+ private static final String GET_ELEMENT_IN_REV_ERR_MSG = "Failed to get element. Item Id: %s, version Id: %s, revision Id: %s, element Id: %s message: %s";
+ private final ItemAdaptorFactory itemAdaptorFactory;
+ private final ItemVersionAdaptorFactory versionAdaptorFactory;
+ private final ElementAdaptorFactory elementAdaptorFactory;
+ private final HealthAdaptorFactory healthAdaptorFactory;
+
+ public ZusammenConnectorImpl(ItemAdaptorFactory itemAdaptorFactory, ItemVersionAdaptorFactory versionAdaptorFactory,
+ ElementAdaptorFactory elementAdaptorFactory, HealthAdaptorFactory healthAdaptorFactory) {
+ this.itemAdaptorFactory = itemAdaptorFactory;
+ this.versionAdaptorFactory = versionAdaptorFactory;
+ this.elementAdaptorFactory = elementAdaptorFactory;
+ this.healthAdaptorFactory = healthAdaptorFactory;
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
}
- return response.getValue();
- }
-
- @Override
- public Item getItem(SessionContext context, Id itemId) {
- Response<Item> response = itemAdaptorFactory.createInterface(context).get(context, itemId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- "Failed to get Item. message:" + response.getReturnCode().toString());
+
+ @Override
+ public Collection<HealthInfo> checkHealth(SessionContext sessionContext) {
+ return healthAdaptorFactory.createInterface(sessionContext).getHealthStatus(sessionContext);
}
- return response.getValue();
- }
-
- @Override
- public Id createItem(SessionContext context, Info info) {
- Response<Id> response = itemAdaptorFactory.createInterface(context).create(context, info);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- "Failed to create Item. message:" + response.getReturnCode().toString());
+
+ @Override
+ public String getVersion(SessionContext sessionContext) {
+ return healthAdaptorFactory.createInterface(sessionContext).getVersion();
}
- return response.getValue();
- }
-
- @Override
- public void deleteItem(SessionContext context, Id itemId){
- Response<Void> response = itemAdaptorFactory.createInterface(context).delete(context, itemId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- "Failed to delete Item. message:" + response.getReturnCode().toString());
+
+ @Override
+ public Collection<Item> listItems(SessionContext context) {
+ Response<Collection<Item>> response = itemAdaptorFactory.createInterface(context).list(context);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException("Failed to list Items. message:" + response.getReturnCode().toString());
+ }
+ return response.getValue();
}
- }
- @Override
- public void updateItem(SessionContext context, Id itemId, Info info) {
- Response<Void> response =
- itemAdaptorFactory.createInterface(context).update(context, itemId, info);
+ @Override
+ public Item getItem(SessionContext context, Id itemId) {
+ Response<Item> response = itemAdaptorFactory.createInterface(context).get(context, itemId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException("Failed to get Item. message:" + response.getReturnCode().toString());
+ }
+ return response.getValue();
+ }
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException("failed to update Item . ItemId:" + itemId + "" +
- " message:" + response.getReturnCode().toString());
+ @Override
+ public Id createItem(SessionContext context, Info info) {
+ Response<Id> response = itemAdaptorFactory.createInterface(context).create(context, info);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException("Failed to create Item. message:" + response.getReturnCode().toString());
+ }
+ return response.getValue();
}
- }
-
- @Override
- public Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId) {
- Response<Collection<ItemVersion>> versions =
- versionAdaptorFactory.createInterface(context).list(context, Space.PUBLIC, itemId);
- if (!versions.isSuccessful()) {
- throw new SdcRuntimeException("failed to list public versions. message: " +
- versions.getReturnCode().toString());
+
+ @Override
+ public void deleteItem(SessionContext context, Id itemId) {
+ Response<Void> response = itemAdaptorFactory.createInterface(context).delete(context, itemId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException("Failed to delete Item. message:" + response.getReturnCode().toString());
+ }
}
- return versions.getValue();
- }
-
- @Override
- public ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId) {
- Response<ItemVersion> response = versionAdaptorFactory.createInterface(context)
- .get(context, Space.PUBLIC, itemId, versionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- String.format("failed to get public Item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void updateItem(SessionContext context, Id itemId, Info info) {
+ Response<Void> response = itemAdaptorFactory.createInterface(context).update(context, itemId, info);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException("failed to update Item . ItemId:" + itemId + "" + " message:" + response.getReturnCode().toString());
+ }
}
- return response.getValue();
- }
-
- @Override
- public Id createVersion(SessionContext context, Id itemId, Id baseVersionId,
- ItemVersionData itemVersionData) {
- Response<Id> response = versionAdaptorFactory.createInterface(context).create(context, itemId,
- baseVersionId, itemVersionData);
- if (response.isSuccessful()) {
- return response.getValue();
- } else {
- throw new SdcRuntimeException(String.format(
- "failed to create Item Version. ItemId: %s, base versionId: %s, message: %s",
- itemId.getValue(), baseVersionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId) {
+ Response<Collection<ItemVersion>> versions = versionAdaptorFactory.createInterface(context).list(context, Space.PUBLIC, itemId);
+ if (!versions.isSuccessful()) {
+ throw new SdcRuntimeException("failed to list public versions. message: " + versions.getReturnCode().toString());
+ }
+ return versions.getValue();
}
- }
-
- @Override
- public void updateVersion(SessionContext context, Id itemId, Id versionId,
- ItemVersionData itemVersionData) {
- Response<Void> response = versionAdaptorFactory.createInterface(context)
- .update(context, itemId, versionId, itemVersionData);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- String.format("failed to update Item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId) {
+ Response<ItemVersion> response = versionAdaptorFactory.createInterface(context).get(context, Space.PUBLIC, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to get public Item Version. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- }
-
- @Override
- public ItemVersion getVersion(SessionContext context, Id itemId, Id versionId) {
- Response<ItemVersion> response = versionAdaptorFactory.createInterface(context)
- .get(context, Space.PRIVATE, itemId, versionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- String.format("failed to get Item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData itemVersionData) {
+ Response<Id> response = versionAdaptorFactory.createInterface(context).create(context, itemId, baseVersionId, itemVersionData);
+ if (response.isSuccessful()) {
+ return response.getValue();
+ } else {
+ throw new SdcRuntimeException(String
+ .format("failed to create Item Version. ItemId: %s, base versionId: %s, message: %s", itemId.getValue(), baseVersionId.getValue(),
+ response.getReturnCode().toString()));
+ }
}
- return response.getValue();
- }
-
- @Override
- public ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId) {
- Response<ItemVersionStatus> response =
- versionAdaptorFactory.createInterface(context).getStatus(context, itemId, versionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- String.format("failed to get Item Version status. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void updateVersion(SessionContext context, Id itemId, Id versionId, ItemVersionData itemVersionData) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context).update(context, itemId, versionId, itemVersionData);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to update Item Version. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
}
- return response.getValue();
- }
-
- @Override
- public void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag) {
- Response<Void> response = versionAdaptorFactory.createInterface(context)
- .tag(context, itemId, versionId, null, tag);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to tag Item Version with tag %s. ItemId: %s, versionId: %s, message: %s",
- tag.getName(), itemId.getValue(), versionId.getValue(),
- response.getReturnCode().toString()));
+
+ @Override
+ public ItemVersion getVersion(SessionContext context, Id itemId, Id versionId) {
+ Response<ItemVersion> response = versionAdaptorFactory.createInterface(context).get(context, Space.PRIVATE, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to get Item Version. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- }
-
- @Override
- public void resetVersionRevision(SessionContext context, Id itemId, Id versionId,
- Id revisionId) {
- Response<Void> response = versionAdaptorFactory.createInterface(context)
- .resetRevision(context, itemId, versionId, revisionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to reset Item Version back to revision: %s. ItemId: %s, versionId: %s, message:" +
- " %s",
- revisionId.getValue(), itemId.getValue(), versionId.getValue(),
- response.getReturnCode().toString()));
+
+ @Override
+ public ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId) {
+ Response<ItemVersionStatus> response = versionAdaptorFactory.createInterface(context).getStatus(context, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to get Item Version status. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- }
-
- @Override
- public void revertVersionRevision(SessionContext context, Id itemId, Id versionId,
- Id revisionId) {
- Response<Void> response = versionAdaptorFactory.createInterface(context)
- .revertRevision(context, itemId, versionId, revisionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to revert Item Version back to revision: %s. ItemId: %s, versionId: %s, " +
- "message: %s",
- revisionId.getValue(), itemId.getValue(), versionId.getValue(),
- response.getReturnCode().toString()));
+
+ @Override
+ public void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context).tag(context, itemId, versionId, null, tag);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to tag Item Version with tag %s. ItemId: %s, versionId: %s, message: %s", tag.getName(), itemId.getValue(),
+ versionId.getValue(), response.getReturnCode().toString()));
+ }
}
- }
-
- @Override
- public ItemVersionRevisions listVersionRevisions(SessionContext context, Id itemId,
- Id versionId) {
- Response<ItemVersionRevisions> response =
- versionAdaptorFactory.createInterface(context)
- .listRevisions(context, itemId, versionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to list revisions of Item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void resetVersionRevision(SessionContext context, Id itemId, Id versionId, Id revisionId) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context).resetRevision(context, itemId, versionId, revisionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to reset Item Version back to revision: %s. ItemId: %s, versionId: %s, message:" + " %s", revisionId.getValue(),
+ itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+ }
}
- return response.getValue();
- }
-
-
- @Override
- public void publishVersion(SessionContext context, Id itemId, Id versionId, String message) {
- Response<Void> response =
- versionAdaptorFactory.createInterface(context).publish(context, itemId, versionId, message);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to publish item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void revertVersionRevision(SessionContext context, Id itemId, Id versionId, Id revisionId) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context).revertRevision(context, itemId, versionId, revisionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to revert Item Version back to revision: %s. ItemId: %s, versionId: %s, " + "message: %s", revisionId.getValue(),
+ itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+ }
}
- }
-
- @Override
- public void syncVersion(SessionContext context, Id itemId, Id versionId) {
- Response<MergeResult> response =
- versionAdaptorFactory.createInterface(context).sync(context, itemId, versionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to sync item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public ItemVersionRevisions listVersionRevisions(SessionContext context, Id itemId, Id versionId) {
+ Response<ItemVersionRevisions> response = versionAdaptorFactory.createInterface(context).listRevisions(context, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to list revisions of Item Version. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- }
-
- @Override
- public void forceSyncVersion(SessionContext context, Id itemId, Id versionId) {
- Response<MergeResult> response =
- versionAdaptorFactory.createInterface(context).forceSync(context, itemId, versionId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "failed to force sync item Version. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void publishVersion(SessionContext context, Id itemId, Id versionId, String message) {
+ Response<Void> response = versionAdaptorFactory.createInterface(context).publish(context, itemId, versionId, message);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to publish item Version. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
}
- }
-
- @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 void syncVersion(SessionContext context, Id itemId, Id versionId) {
+ Response<MergeResult> response = versionAdaptorFactory.createInterface(context).sync(context, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to sync 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);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String
- .format("failed to get Item Version conflict. ItemId: %s, versionId: %s, message: %s",
- itemId.getValue(), versionId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void forceSyncVersion(SessionContext context, Id itemId, Id versionId) {
+ Response<MergeResult> response = versionAdaptorFactory.createInterface(context).forceSync(context, itemId, versionId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to force sync item Version. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
}
- return response.getValue();
- }
-
- @Override
- public Collection<ElementInfo> listElements(SessionContext context,
- ElementContext elementContext,
- Id parentElementId) {
- Response<Collection<ElementInfo>> response = elementAdaptorFactory
- .createInterface(context).list(context, elementContext, parentElementId);
- if (response.isSuccessful()) {
- return response.getValue();
- } else {
- throw new SdcRuntimeException(response.getReturnCode().toString());
+
+ @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);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("failed to get Item Version conflict. ItemId: %s, versionId: %s, message: %s", itemId.getValue(), versionId.getValue(),
+ response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- }
+ @Override
+ public Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext, Id parentElementId) {
+ Response<Collection<ElementInfo>> response = elementAdaptorFactory.createInterface(context).list(context, elementContext, parentElementId);
+ if (response.isSuccessful()) {
+ return response.getValue();
+ } else {
+ throw new SdcRuntimeException(response.getReturnCode().toString());
+ }
+ }
- @Override
- public ElementInfo getElementInfo(SessionContext context, ElementContext elementContext,
- Id elementId) {
- Response<ElementInfo> response =
- elementAdaptorFactory.createInterface(context).getInfo(context, elementContext, elementId);
- if (!response.isSuccessful()) {
- throw buildGetElementException(elementContext, elementId,
- response.getReturnCode().toString());
+ @Override
+ public ElementInfo getElementInfo(SessionContext context, ElementContext elementContext, Id elementId) {
+ Response<ElementInfo> response = elementAdaptorFactory.createInterface(context).getInfo(context, elementContext, elementId);
+ if (!response.isSuccessful()) {
+ throw buildGetElementException(elementContext, elementId, response.getReturnCode().toString());
+ }
+ return response.getValue();
+ }
+ @Override
+ public Element getElement(SessionContext context, ElementContext elementContext, Id elementId) {
+ Response<Element> response = elementAdaptorFactory.createInterface(context).get(context, elementContext, elementId);
+ if (!response.isSuccessful()) {
+ throw buildGetElementException(elementContext, elementId, response.getReturnCode().toString());
+ }
+ return response.getValue();
}
- return response.getValue();
- }
-
- @Override
- public Element getElement(SessionContext context, ElementContext elementContext,
- Id elementId) {
- Response<Element> response =
- elementAdaptorFactory.createInterface(context).get(context, elementContext, elementId);
- if (!response.isSuccessful()) {
- throw buildGetElementException(elementContext, elementId,
- response.getReturnCode().toString());
+
+ @Override
+ public ElementConflict getElementConflict(SessionContext context, ElementContext elementContext, Id elementId) {
+ Response<ElementConflict> response = elementAdaptorFactory.createInterface(context).getConflict(context, elementContext, elementId);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String.format("Failed to get element conflict. Item Id: %s, version Id: %s, element Id: %s message: %s",
+ elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(), elementId.getValue(),
+ response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- return response.getValue();
- }
-
- @Override
- public ElementConflict getElementConflict(SessionContext context, ElementContext elementContext,
- Id elementId) {
- Response<ElementConflict> response = elementAdaptorFactory.createInterface(context)
- .getConflict(context, elementContext, elementId);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String.format(
- "Failed to get element conflict. Item Id: %s, version Id: %s, element Id: %s message: %s",
- elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(),
- elementId.getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public Element saveElement(SessionContext context, ElementContext elementContext, Element element, String message) {
+ Response<Element> response = elementAdaptorFactory.createInterface(context).save(context, elementContext, element, message);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException(String
+ .format("Failed to create element %s. ItemId: %s, versionId: %s, message: %s", element.getElementId().getValue(),
+ elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(), response.getReturnCode().toString()));
+ }
+ return response.getValue();
}
- return response.getValue();
- }
-
- @Override
- public Element saveElement(SessionContext context, ElementContext elementContext, Element element, String message) {
- Response<Element> response = elementAdaptorFactory.createInterface(context)
- .save(context, elementContext, element, message);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(String
- .format("Failed to create element %s. ItemId: %s, versionId: %s, message: %s",
- element.getElementId().getValue(), elementContext.getItemId().getValue(),
- elementContext.getVersionId().getValue(), response.getReturnCode().toString()));
+
+ @Override
+ public void resolveElementConflict(SessionContext context, ElementContext elementContext, Element element, Resolution resolution) {
+ Response<Void> response = elementAdaptorFactory.createInterface(context).resolveConflict(context, elementContext, element, resolution);
+ if (!response.isSuccessful()) {
+ throw new SdcRuntimeException("Failed to resolve conflict. message:" + response.getReturnCode().toString());
+ }
}
- return response.getValue();
- }
-
- @Override
- public void resolveElementConflict(SessionContext context, ElementContext elementContext, Element element,
- Resolution resolution) {
- Response<Void> response = elementAdaptorFactory.createInterface(context)
- .resolveConflict(context, elementContext, element, resolution);
- if (!response.isSuccessful()) {
- throw new SdcRuntimeException(
- "Failed to resolve conflict. message:" + response.getReturnCode().toString());
+
+ @Override
+ public void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String revisionId) {
+ // no-op, required by the interface
}
- }
-
- @Override
- public void resetVersionHistory(SessionContext context, Id itemId, Id versionId,
- String revisionId) {
- // no-op, required by the interface
- }
-
- private SdcRuntimeException buildGetElementException(ElementContext elementContext, Id elementId,
- String zusammenErrorMessage) {
- if (elementContext.getRevisionId() == null) {
- return new SdcRuntimeException(String.format(GET_ELEMENT_ERR_MSG,
- elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(),
- elementId.getValue(), zusammenErrorMessage));
+
+ private SdcRuntimeException buildGetElementException(ElementContext elementContext, Id elementId, String zusammenErrorMessage) {
+ if (elementContext.getRevisionId() == null) {
+ return new SdcRuntimeException(String
+ .format(GET_ELEMENT_ERR_MSG, elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(), elementId.getValue(),
+ zusammenErrorMessage));
+ }
+ return new SdcRuntimeException(String
+ .format(GET_ELEMENT_IN_REV_ERR_MSG, elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(),
+ elementContext.getRevisionId().getValue(), elementId.getValue(), zusammenErrorMessage));
}
- return new SdcRuntimeException(String.format(GET_ELEMENT_IN_REV_ERR_MSG,
- elementContext.getItemId().getValue(), elementContext.getVersionId().getValue(),
- elementContext.getRevisionId().getValue(),
- elementId.getValue(), zusammenErrorMessage));
- }
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java
index 05c7a1a72a..3d4af282b5 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.core.zusammen.impl;
import java.util.function.Supplier;
@@ -24,16 +23,14 @@ public class CassandraConnectionInitializer {
private static final String CASSANDRA_PREFIX = "cassandra.";
private static final String DATA_CENTER_PROPERTY_NAME = CASSANDRA_PREFIX + "datacenter";
- private static final String CONSISTENCY_LEVEL_PROPERTY_NAME =
- CASSANDRA_PREFIX + "consistency.level";
+ private static final String CONSISTENCY_LEVEL_PROPERTY_NAME = CASSANDRA_PREFIX + "consistency.level";
private static final String CASSANDRA_RECONNECT_TIMEOUT = CASSANDRA_PREFIX + "reconnection.delay";
private static final String NODES_PROPERTY_NAME = CASSANDRA_PREFIX + "nodes";
private static final String CASSANDRA_PORT_PROPERTY_NAME = CASSANDRA_PREFIX + "port";
private static final String AUTHENTICATE_PROPERTY_NAME = CASSANDRA_PREFIX + "authenticate";
private static final String SSL_PROPERTY_NAME = CASSANDRA_PREFIX + "ssl";
private static final String TRUSTSTORE_PROPERTY_NAME = CASSANDRA_PREFIX + "truststore";
- private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME =
- CASSANDRA_PREFIX + "truststore.password";
+ private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = CASSANDRA_PREFIX + "truststore.password";
private static final String USER_PROPERTY_NAME = CASSANDRA_PREFIX + "user";
private static final String PASSWORD_PROPERTY_NAME = CASSANDRA_PREFIX + "password";
private static final String KEYSPACE_PROPERTY_NAME = CASSANDRA_PREFIX + "keyspace";
@@ -50,8 +47,7 @@ public class CassandraConnectionInitializer {
private static class DeferredInitializer {
static {
- setSystemProperty(NODES_PROPERTY_NAME, () ->
- StringUtils.join(CassandraUtils.getAddresses(), ','));
+ setSystemProperty(NODES_PROPERTY_NAME, () -> StringUtils.join(CassandraUtils.getAddresses(), ','));
setSystemProperty(CASSANDRA_PORT_PROPERTY_NAME, () -> Integer.toString(CassandraUtils.getCassandraPort()));
setBooleanSystemProperty(AUTHENTICATE_PROPERTY_NAME, CassandraUtils::isAuthenticate);
setBooleanSystemProperty(SSL_PROPERTY_NAME, CassandraUtils::isSsl);
@@ -61,12 +57,12 @@ public class CassandraConnectionInitializer {
setSystemProperty(PASSWORD_PROPERTY_NAME, CassandraUtils::getPassword);
setSystemProperty(KEYSPACE_PROPERTY_NAME, () -> ZUSAMMEN);
setNullableSystemProperty(DATA_CENTER_PROPERTY_NAME, CassandraUtils::getLocalDataCenter);
- setNullableSystemProperty(CONSISTENCY_LEVEL_PROPERTY_NAME,
- CassandraUtils::getConsistencyLevel);
+ setNullableSystemProperty(CONSISTENCY_LEVEL_PROPERTY_NAME, CassandraUtils::getConsistencyLevel);
setSystemProperty(CASSANDRA_RECONNECT_TIMEOUT, () -> Long.toString(CassandraUtils.getReconnectTimeout()));
}
- private DeferredInitializer() { }
+ private DeferredInitializer() {
+ }
@SuppressWarnings("EmptyMethod")
static void init() {
@@ -74,7 +70,6 @@ public class CassandraConnectionInitializer {
}
private static void setSystemProperty(String name, Supplier<String> valueSupplier) {
-
if (System.getProperty(name) == null) {
System.setProperty(name, valueSupplier.get());
}
@@ -85,7 +80,6 @@ public class CassandraConnectionInitializer {
}
private static void setNullableSystemProperty(String name, Supplier<String> valueSupplier) {
-
if ((System.getProperty(name) == null) && (valueSupplier.get() != null)) {
System.setProperty(name, valueSupplier.get());
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java
index 9ac46fda8b..b93e110768 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ItemElementLoggerTargetServiceName.java
@@ -21,15 +21,16 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ItemElementLoggerTargetServiceName {
- ITEM_CREATION("Item Creation"),
- ITEM_VERSION_CREATION("Item Version Creation"),
- ELEMENT_CREATION("Element Creation"),
- ELEMENT_UPDATE("Element Update"),
- ELEMENT_LIST("Element List"),
- ELEMENT_GET("Element Get"),
- ELEMENT_GET_BY_PROPERTY("Element Get By Property"),
- ITEM_RETRIEVAL("Item retrieval"),
- ITEM_VERSION_RETRIEVAL("Item version retrieval)");
-
- private final String description;
+ // @formatter:off
+ ITEM_CREATION("Item Creation"),
+ ITEM_VERSION_CREATION("Item Version Creation"),
+ ELEMENT_CREATION("Element Creation"),
+ ELEMENT_UPDATE("Element Update"),
+ ELEMENT_LIST("Element List"),
+ ELEMENT_GET("Element Get"),
+ ELEMENT_GET_BY_PROPERTY("Element Get By Property"),
+ ITEM_RETRIEVAL("Item retrieval"),
+ ITEM_VERSION_RETRIEVAL("Item version retrieval)");
+ // @formatter:on
+ private final String description;
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java
index edc1abf108..982f7869fc 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.core.zusammen.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
@@ -25,11 +24,11 @@ import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.core.zusammen.db.ZusammenConnectorFactory;
public class ZusammenAdaptorFactoryImpl extends ZusammenAdaptorFactory {
- private static final ZusammenAdaptor INSTANCE =
- new ZusammenAdaptorImpl(ZusammenConnectorFactory.getInstance().createInterface());
- @Override
- public ZusammenAdaptor createInterface() {
- return INSTANCE;
- }
+ private static final ZusammenAdaptor INSTANCE = new ZusammenAdaptorImpl(ZusammenConnectorFactory.getInstance().createInterface());
+
+ @Override
+ public ZusammenAdaptor createInterface() {
+ return INSTANCE;
+ }
}
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 4efa2486a2..a5d61f4189 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
@@ -43,249 +43,211 @@ import org.openecomp.core.zusammen.db.ZusammenConnector;
public class ZusammenAdaptorImpl implements ZusammenAdaptor {
- private ZusammenConnector connector;
-
- public ZusammenAdaptorImpl(ZusammenConnector connector) {
- this.connector = connector;
- }
-
- @Override
- public Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext,
- Id elementId) {
- return Optional.ofNullable(connector.getElementInfo(context, elementContext, elementId));
- }
-
- @Override
- public Optional<Element> getElement(SessionContext context, ElementContext elementContext,
- String elementId) {
- return Optional.ofNullable(connector.getElement(context, elementContext, new Id(elementId)));
- }
-
- @Override
- public Optional<Element> getElementByName(
- SessionContext context, ElementContext elementContext, Id parentElementId,
- String elementName) {
- Collection<ElementInfo> elementInfos =
- connector.listElements(context, elementContext, parentElementId);
- Predicate<ElementInfo> elementInfoPredicate = elementInfo -> elementInfo.getInfo() != null
- && elementName.equals(elementInfo.getInfo().getName());
- return getFirstElementInfo(elementInfos, elementInfoPredicate)
- .flatMap(elementInfo -> getElement(context, elementContext,
- elementInfo.getId().getValue()));
- }
-
- @Override
- public Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext,
- Id parentElementId) {
- return connector.listElements(context, elementContext, parentElementId);
- }
-
- @Override
- public Collection<Element> listElementData(SessionContext context,
- ElementContext elementContext,
- Id parentElementId) {
- Collection<ElementInfo> elementInfoList = connector.listElements(context, elementContext,
- parentElementId);
-
- return elementInfoList == null
- ? new ArrayList<>()
- : elementInfoList.stream()
- .map(elementInfo -> connector.getElement(context, elementContext, elementInfo.getId()))
- .collect(Collectors.toList());
- }
-
-
- @Override
- public Collection<ElementInfo> listElementsByName(
- SessionContext context, ElementContext elementContext, Id parentElementId,
- String elementName) {
- Optional<ElementInfo> elementInfoByName =
- getElementInfoByName(context, elementContext, parentElementId, elementName);
-
- return elementInfoByName.isPresent()
- ? connector.listElements(context, elementContext, elementInfoByName.get().getId())
- : new ArrayList<>();
- }
-
- @Override
- public Optional<ElementInfo> getElementInfoByName(
- SessionContext context, ElementContext elementContext, Id parentElementId,
- String elementName) {
- Collection<ElementInfo> elementInfos =
- connector.listElements(context, elementContext, parentElementId);
- return getFirstElementInfo(elementInfos,
- elementInfo -> elementInfo.getInfo() != null
- && elementName.equals(elementInfo.getInfo().getName()));
- }
-
- @Override
- public Optional<ElementConflict> getElementConflict(SessionContext context,
- ElementContext elementContext,
- Id elementId) {
- return Optional.ofNullable(connector.getElementConflict(context, elementContext, elementId));
- }
-
- @Override
- public Element saveElement(SessionContext context, ElementContext elementContext,
- ZusammenElement element, String message) {
- enrichElementHierarchyRec(context, elementContext, null, element);
- return connector.saveElement(context, elementContext, element, message);
- }
-
- @Override
- public void resolveElementConflict(SessionContext context, ElementContext elementContext,
- ZusammenElement element, Resolution resolution) {
- connector.resolveElementConflict(context, elementContext, element, resolution);
- }
-
- private void enrichElementHierarchyRec(SessionContext context, ElementContext
- elementContext, Id parentElementId, ZusammenElement element) {
- if (element.getAction() == Action.CREATE) {
- return;
- }
- locateElementAndUpdateAction(context, elementContext, parentElementId, element);
- element.getSubElements().forEach(subElement -> enrichElementHierarchyRec(
- context, elementContext, element.getElementId(), (ZusammenElement) subElement));
- }
-
- // should be applied only for structural elements
- private void locateElementAndUpdateAction(SessionContext context, ElementContext elementContext,
- Id parentElementId, ZusammenElement element) {
- if (element.getElementId() != null) {
- return;
- }
- if (element.getInfo() == null || element.getInfo().getName() == null) {
- throw new IllegalArgumentException("When saving element to zusammen - its Id or name must be supplied");
- }
- Optional<ElementInfo> elementInfo =
- getElementInfoByName(context, elementContext, parentElementId, element.getInfo().getName());
- if (elementInfo.isPresent()) {
- element.setElementId(elementInfo.get().getId());
- if (element.getAction() == null) {
- element.setAction(Action.IGNORE);
- }
- } else {
- element.setAction(Action.CREATE);
- }
- }
-
- private Optional<ElementInfo> getFirstElementInfo(Collection<ElementInfo> elementInfos,
- Predicate<ElementInfo> elementInfoPredicate) {
- return elementInfos.stream()
- .filter(elementInfoPredicate)
- .findFirst();
- }
-
- @Override
- public Collection<Item> listItems(SessionContext context) {
- return connector.listItems(context);
- }
-
- @Override
- public Item getItem(SessionContext context, Id itemId) {
- return connector.getItem(context, itemId);
- }
-
- @Override
- public Id createItem(SessionContext context, Info info) {
- return connector.createItem(context, info);
- }
-
- @Override
- public void deleteItem(SessionContext context, Id itemId){
- connector.deleteItem(context,itemId);
- }
-
- @Override
- public void updateItem(SessionContext context, Id itemId, Info info) {
- connector.updateItem(context, itemId, info);
- }
-
- @Override
- public Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId) {
- return connector.listPublicVersions(context, itemId);
- }
-
- @Override
- public ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId) {
- return connector.getPublicVersion(context, itemId, versionId);
- }
-
- @Override
- public ItemVersion getVersion(SessionContext context, Id itemId, Id versionId) {
- return connector.getVersion(context, itemId, versionId);
- }
-
- @Override
- public ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId) {
- return connector.getVersionStatus(context, itemId, versionId);
- }
-
- @Override
- public ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId) {
- return connector.getVersionConflict(context, itemId, versionId);
- }
-
- @Override
- public Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData
- itemVersionData) {
- return connector.createVersion(context, itemId, baseVersionId, itemVersionData);
- }
-
- @Override
- public void updateVersion(SessionContext context, Id itemId, Id versionId,
- ItemVersionData itemVersionData) {
- connector.updateVersion(context, itemId, versionId, itemVersionData);
- }
-
- @Override
- public void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag) {
- connector.tagVersion(context, itemId, versionId, tag);
- }
-
- @Override
- public void resetVersionHistory(SessionContext context, Id itemId, Id versionId,
- String changeRef) {
- connector.resetVersionHistory(context, itemId, versionId, changeRef);
- }
-
- @Override
- public void publishVersion(SessionContext context, Id itemId, Id versionId, String message) {
- connector.publishVersion(context, itemId, versionId, message);
- }
-
- @Override
- public void syncVersion(SessionContext context, Id itemId, Id versionId) {
- connector.syncVersion(context, itemId, versionId);
- }
-
- @Override
- public void forceSyncVersion(SessionContext context, Id itemId, Id versionId) {
- connector.forceSyncVersion(context, itemId, versionId);
- }
-
- @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);
- }
-
- @Override
- public ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId) {
- return connector.listVersionRevisions(context, itemId, versionId);
- }
-
- @Override
- public Collection<HealthInfo> checkHealth(SessionContext context) {
- return connector.checkHealth(context);
- }
-
- @Override
- public String getVersion(SessionContext context) {
- return connector.getVersion(context);
- }
+ private ZusammenConnector connector;
+
+ public ZusammenAdaptorImpl(ZusammenConnector connector) {
+ this.connector = connector;
+ }
+
+ @Override
+ public Optional<ElementInfo> getElementInfo(SessionContext context, ElementContext elementContext, Id elementId) {
+ return Optional.ofNullable(connector.getElementInfo(context, elementContext, elementId));
+ }
+
+ @Override
+ public Optional<Element> getElement(SessionContext context, ElementContext elementContext, String elementId) {
+ return Optional.ofNullable(connector.getElement(context, elementContext, new Id(elementId)));
+ }
+
+ @Override
+ public Optional<Element> getElementByName(SessionContext context, ElementContext elementContext, Id parentElementId, String elementName) {
+ Collection<ElementInfo> elementInfos = connector.listElements(context, elementContext, parentElementId);
+ Predicate<ElementInfo> elementInfoPredicate = elementInfo -> elementInfo.getInfo() != null && elementName
+ .equals(elementInfo.getInfo().getName());
+ return getFirstElementInfo(elementInfos, elementInfoPredicate)
+ .flatMap(elementInfo -> getElement(context, elementContext, elementInfo.getId().getValue()));
+ }
+
+ @Override
+ public Collection<ElementInfo> listElements(SessionContext context, ElementContext elementContext, Id parentElementId) {
+ return connector.listElements(context, elementContext, parentElementId);
+ }
+
+ @Override
+ public Collection<Element> listElementData(SessionContext context, ElementContext elementContext, Id parentElementId) {
+ Collection<ElementInfo> elementInfoList = connector.listElements(context, elementContext, parentElementId);
+ return elementInfoList == null ? new ArrayList<>()
+ : elementInfoList.stream().map(elementInfo -> connector.getElement(context, elementContext, elementInfo.getId()))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public Collection<ElementInfo> listElementsByName(SessionContext context, ElementContext elementContext, Id parentElementId, String elementName) {
+ Optional<ElementInfo> elementInfoByName = getElementInfoByName(context, elementContext, parentElementId, elementName);
+ return elementInfoByName.isPresent() ? connector.listElements(context, elementContext, elementInfoByName.get().getId()) : new ArrayList<>();
+ }
+
+ @Override
+ public Optional<ElementInfo> getElementInfoByName(SessionContext context, ElementContext elementContext, Id parentElementId, String elementName) {
+ Collection<ElementInfo> elementInfos = connector.listElements(context, elementContext, parentElementId);
+ return getFirstElementInfo(elementInfos, elementInfo -> elementInfo.getInfo() != null && elementName.equals(elementInfo.getInfo().getName()));
+ }
+
+ @Override
+ public Optional<ElementConflict> getElementConflict(SessionContext context, ElementContext elementContext, Id elementId) {
+ return Optional.ofNullable(connector.getElementConflict(context, elementContext, elementId));
+ }
+
+ @Override
+ public Element saveElement(SessionContext context, ElementContext elementContext, ZusammenElement element, String message) {
+ enrichElementHierarchyRec(context, elementContext, null, element);
+ return connector.saveElement(context, elementContext, element, message);
+ }
+
+ @Override
+ public void resolveElementConflict(SessionContext context, ElementContext elementContext, ZusammenElement element, Resolution resolution) {
+ connector.resolveElementConflict(context, elementContext, element, resolution);
+ }
+
+ private void enrichElementHierarchyRec(SessionContext context, ElementContext elementContext, Id parentElementId, ZusammenElement element) {
+ if (element.getAction() == Action.CREATE) {
+ return;
+ }
+ locateElementAndUpdateAction(context, elementContext, parentElementId, element);
+ element.getSubElements()
+ .forEach(subElement -> enrichElementHierarchyRec(context, elementContext, element.getElementId(), (ZusammenElement) subElement));
+ }
+
+ // should be applied only for structural elements
+ private void locateElementAndUpdateAction(SessionContext context, ElementContext elementContext, Id parentElementId, ZusammenElement element) {
+ if (element.getElementId() != null) {
+ return;
+ }
+ if (element.getInfo() == null || element.getInfo().getName() == null) {
+ throw new IllegalArgumentException("When saving element to zusammen - its Id or name must be supplied");
+ }
+ Optional<ElementInfo> elementInfo = getElementInfoByName(context, elementContext, parentElementId, element.getInfo().getName());
+ if (elementInfo.isPresent()) {
+ element.setElementId(elementInfo.get().getId());
+ if (element.getAction() == null) {
+ element.setAction(Action.IGNORE);
+ }
+ } else {
+ element.setAction(Action.CREATE);
+ }
+ }
+
+ private Optional<ElementInfo> getFirstElementInfo(Collection<ElementInfo> elementInfos, Predicate<ElementInfo> elementInfoPredicate) {
+ return elementInfos.stream().filter(elementInfoPredicate).findFirst();
+ }
+
+ @Override
+ public Collection<Item> listItems(SessionContext context) {
+ return connector.listItems(context);
+ }
+
+ @Override
+ public Item getItem(SessionContext context, Id itemId) {
+ return connector.getItem(context, itemId);
+ }
+
+ @Override
+ public Id createItem(SessionContext context, Info info) {
+ return connector.createItem(context, info);
+ }
+
+ @Override
+ public void deleteItem(SessionContext context, Id itemId) {
+ connector.deleteItem(context, itemId);
+ }
+
+ @Override
+ public void updateItem(SessionContext context, Id itemId, Info info) {
+ connector.updateItem(context, itemId, info);
+ }
+
+ @Override
+ public Collection<ItemVersion> listPublicVersions(SessionContext context, Id itemId) {
+ return connector.listPublicVersions(context, itemId);
+ }
+
+ @Override
+ public ItemVersion getPublicVersion(SessionContext context, Id itemId, Id versionId) {
+ return connector.getPublicVersion(context, itemId, versionId);
+ }
+
+ @Override
+ public ItemVersion getVersion(SessionContext context, Id itemId, Id versionId) {
+ return connector.getVersion(context, itemId, versionId);
+ }
+
+ @Override
+ public ItemVersionStatus getVersionStatus(SessionContext context, Id itemId, Id versionId) {
+ return connector.getVersionStatus(context, itemId, versionId);
+ }
+
+ @Override
+ public ItemVersionConflict getVersionConflict(SessionContext context, Id itemId, Id versionId) {
+ return connector.getVersionConflict(context, itemId, versionId);
+ }
+
+ @Override
+ public Id createVersion(SessionContext context, Id itemId, Id baseVersionId, ItemVersionData itemVersionData) {
+ return connector.createVersion(context, itemId, baseVersionId, itemVersionData);
+ }
+
+ @Override
+ public void updateVersion(SessionContext context, Id itemId, Id versionId, ItemVersionData itemVersionData) {
+ connector.updateVersion(context, itemId, versionId, itemVersionData);
+ }
+
+ @Override
+ public void tagVersion(SessionContext context, Id itemId, Id versionId, Tag tag) {
+ connector.tagVersion(context, itemId, versionId, tag);
+ }
+
+ @Override
+ public void resetVersionHistory(SessionContext context, Id itemId, Id versionId, String changeRef) {
+ connector.resetVersionHistory(context, itemId, versionId, changeRef);
+ }
+
+ @Override
+ public void publishVersion(SessionContext context, Id itemId, Id versionId, String message) {
+ connector.publishVersion(context, itemId, versionId, message);
+ }
+
+ @Override
+ public void syncVersion(SessionContext context, Id itemId, Id versionId) {
+ connector.syncVersion(context, itemId, versionId);
+ }
+
+ @Override
+ public void forceSyncVersion(SessionContext context, Id itemId, Id versionId) {
+ connector.forceSyncVersion(context, itemId, versionId);
+ }
+
+ @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);
+ }
+
+ @Override
+ public ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId) {
+ return connector.listVersionRevisions(context, itemId, versionId);
+ }
+
+ @Override
+ public Collection<HealthInfo> checkHealth(SessionContext context) {
+ return connector.checkHealth(context);
+ }
+
+ @Override
+ public String getVersion(SessionContext context) {
+ return connector.getVersion(context);
+ }
}