diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-22 15:33:06 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-24 06:59:47 +0000 |
commit | d378c37fbd1ecec7b43394926f1ca32a695e07de (patch) | |
tree | 5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api | |
parent | a6ae7294ecd336d7e88f915710b08e2658eaee00 (diff) |
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3449
Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api')
6 files changed, 211 insertions, 229 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 } |