diff options
Diffstat (limited to 'common-be/src/main/java/org/openecomp')
19 files changed, 744 insertions, 369 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoArtifactType.java b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoArtifactType.java index 62e11bba00..8f35b60bf8 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoArtifactType.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoArtifactType.java @@ -19,11 +19,12 @@ package org.openecomp.sdc.be.config; -import java.util.Arrays; -import java.util.Optional; import lombok.AllArgsConstructor; import lombok.Getter; +import java.util.Arrays; +import java.util.Optional; + /** * Stores non mano artifact types. */ diff --git a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfiguration.java b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfiguration.java index 9471fed0fe..93d09a2e7a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfiguration.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfiguration.java @@ -19,10 +19,10 @@ package org.openecomp.sdc.be.config; -import java.util.Map; - import lombok.Data; +import java.util.Map; + /** * Represents the non-mano configuration yaml. */ diff --git a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java index 028f16ab6e..12813f231d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java @@ -19,13 +19,14 @@ package org.openecomp.sdc.be.config; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.onap.sdc.tosca.parser.utils.YamlToObjectConverter; import org.openecomp.sdc.be.config.exception.LoadConfigurationException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + /** * Singleton that loads and stores the Non Mano configuration */ @@ -47,7 +48,7 @@ public class NonManoConfigurationManager { } final String data; try { - data = IOUtils.toString(configYamlAsStream, StandardCharsets.UTF_8); + data = IOUtils.toString(configYamlAsStream, String.valueOf(StandardCharsets.UTF_8)); } catch (final IOException e) { throw new LoadConfigurationException("Could not parse non-mano configuration file 'config/nonManoConfig.yaml' to string", e); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/PnfSoftwareInformation.java b/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/PnfSoftwareInformation.java index d714faaa23..cb3ef1486e 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/PnfSoftwareInformation.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/PnfSoftwareInformation.java @@ -19,14 +19,15 @@ package org.openecomp.sdc.be.csar.pnf; -import java.util.LinkedHashSet; -import java.util.Set; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import org.apache.commons.collections.CollectionUtils; +import java.util.LinkedHashSet; +import java.util.Set; + /** * Represents the Pnf software information non-mano yaml */ diff --git a/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParser.java b/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParser.java index e5696afaed..ad67962de4 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParser.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParser.java @@ -19,11 +19,6 @@ package org.openecomp.sdc.be.csar.pnf; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Optional; import org.apache.commons.collections.CollectionUtils; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.be.csar.pnf.PnfSoftwareInformation.PnfSoftwareInformationField; @@ -32,6 +27,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.error.YAMLException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; + /** * Handles the parsing of the non-mano software information file. */ diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java index 4cee3ff49d..4feb026fd6 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.datatypes.components; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.log.wrappers.Logger; @@ -203,6 +204,33 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio this.archiveTime = other.getArchiveTime(); } + public ComponentMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ + this.uniqueId = extractor.getUniqueId(); + this.name = extractor.getName(); + this.version = extractor.getVersion(); + this.isHighestVersion = extractor.isHighestVersion(); + this.creationDate = extractor.getCreationDate(); + this.lastUpdateDate = extractor.getLastUpdateDate(); + this.description = extractor.getDescription(); + this.state = extractor.getState(); + this.tags = extractor.getTags(); + this.icon = extractor.getIcon(); + this.contactId = extractor.getContactId(); + this.UUID = extractor.getUUID(); + this.normalizedName = extractor.getNormalizedName(); + this.systemName = extractor.getSystemName(); + this.isDeleted = extractor.isDeleted(); + this.projectCode = extractor.getProjectCode(); + this.csarUUID = extractor.getCsarUuid(); + this.csarVersion = extractor.getCsarVersion(); + this.importedToscaChecksum = extractor.getImportedToscaChecksum(); + this.invariantUUID = extractor.getInvariantUuid(); + this.isArchived = extractor.isArchived(); + this.isVspArchived = extractor.isVspArchived(); + this.archiveTime = extractor.getArchiveTime(); + } + + public String getUniqueId() { return uniqueId; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java index 3a48286280..8b78450358 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java @@ -20,8 +20,10 @@ package org.openecomp.sdc.be.datatypes.components; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; + public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition { private String vendorName; @@ -48,6 +50,16 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit this.isAbstract = other.isHighestVersion(); this.resourceType = other.getResourceType(); this.toscaResourceName = other.getToscaResourceName(); + } + + public ResourceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ + super(extractor); + this.vendorName = extractor.getVendorName(); + this.vendorRelease = extractor.getVendorRelease(); + this.resourceVendorModelNumber = extractor.getResourceVendorModelNumber(); + this.isAbstract = extractor.isAbstract(); + this.resourceType = extractor.getResourceType(); + this.toscaResourceName = extractor.getToscaResourceName(); } public String getVendorName() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java index 0ef10d4c95..483c6fcabc 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java @@ -20,6 +20,10 @@ package org.openecomp.sdc.be.datatypes.components; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; + + + public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition { private static final String EMPTY_STR = ""; @@ -27,6 +31,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti private String serviceType; private String serviceRole; private String instantiationType = EMPTY_STR; + private String serviceFunction; private Boolean ecompGeneratedNaming = true; @@ -38,12 +43,22 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti super(); serviceType = ""; serviceRole = ""; + serviceFunction = ""; } + public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) { super(other); serviceType = other.getServiceType(); serviceRole = other.getServiceRole(); + serviceFunction = other.getServiceFunction(); + } + + public ServiceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ + super(extractor); + serviceType = extractor.getServiceType(); + serviceRole = extractor.getServiceRole(); + serviceFunction = extractor.getServiceFunction(); } public String getDistributionStatus() { @@ -82,6 +97,10 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti return ecompGeneratedNaming; } + public Boolean getEcompGeneratedNaming() { + return ecompGeneratedNaming; + } + public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) { this.ecompGeneratedNaming = ecompGeneratedNaming; } @@ -102,18 +121,27 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti this.environmentContext = environmentContext; } - @Override - public String toString() { - return "ServiceMetadataDataDefinition{" - + "distributionStatus='" + distributionStatus + '\'' - + ", serviceType='" + serviceType + '\'' - + ", serviceRole='" + serviceRole + '\'' - + ", ecompGeneratedNaming=" + ecompGeneratedNaming - + ", namingPolicy='" + namingPolicy + '\'' - + ", environmentContext='" + environmentContext + '\'' - + ", instantiationType='" + instantiationType + '\'' - + '}'; - } + public String getServiceFunction() { + return serviceFunction; + } + + public void setServiceFunction(String serviceFunction) { + this.serviceFunction = serviceFunction; + } + + @Override + public String toString() { + return "ServiceMetadataDataDefinition{" + + "distributionStatus='" + distributionStatus + '\'' + + ", serviceType='" + serviceType + '\'' + + ", serviceRole='" + serviceRole + '\'' + + ", serviceFunction='" + serviceFunction + '\'' + + ", ecompGeneratedNaming=" + ecompGeneratedNaming + + ", namingPolicy='" + namingPolicy + '\'' + + ", environmentContext='" + environmentContext + '\'' + + ", instantiationType='" + instantiationType + '\'' + + '}'; + } @Override public int hashCode() { @@ -124,6 +152,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode()); result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode()); + result = prime * result + ((serviceFunction == null) ? 0 : serviceFunction.hashCode()); result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode()); result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode()); return result; @@ -196,6 +225,12 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti } else if (!instantiationType.equals(other.instantiationType)) { return false; } + if (serviceFunction == null){ + if (other.serviceFunction != null) { + return false; + } else if (!serviceFunction.equals(other.serviceFunction)) + return false; + } return super.equals(obj); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java index 3790849ecf..4832e8b690 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java @@ -1,334 +1,348 @@ -/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.datatypes.elements;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.stream.Collectors;
-import org.apache.commons.collections.CollectionUtils;
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
-import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.common.util.ValidationUtils;
-
-public class ComponentInstanceDataDefinition extends ToscaDataDefinition {
-
- public ComponentInstanceDataDefinition() {
- setPropertyValueCounter(1);
- setAttributeValueCounter(1);
- setInputValueCounter(1);
- setIsProxy(false);
- }
-
- public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) {
- setIcon(dataDefinition.getIcon());
- setUniqueId(dataDefinition.getUniqueId());
- setName(dataDefinition.getName());
- setComponentUid(dataDefinition.getComponentUid());
- setCreationTime(dataDefinition.getCreationTime());
- setModificationTime(dataDefinition.getModificationTime());
- setDescription(dataDefinition.getDescription());
- setPosX(dataDefinition.getPosX());
- setPosY(dataDefinition.getPosY());
- setPropertyValueCounter(dataDefinition.getPropertyValueCounter());
- setNormalizedName(dataDefinition.getNormalizedName());
- setOriginType(dataDefinition.getOriginType());
- setCustomizationUUID(dataDefinition.getCustomizationUUID());
- setComponentName(dataDefinition.getComponentName());
- setComponentVersion(dataDefinition.getComponentVersion());
- setToscaComponentName(dataDefinition.getToscaComponentName());
- setInvariantName(dataDefinition.getInvariantName());
- setSourceModelInvariant(dataDefinition.getSourceModelInvariant());
- setSourceModelName(dataDefinition.getSourceModelName());
- setSourceModelUuid(dataDefinition.getSourceModelUuid());
- setSourceModelUid(dataDefinition.getSourceModelUid());
- setIsProxy(dataDefinition.getIsProxy());
- setDirectives(dataDefinition.getDirectives());
- setOriginArchived(dataDefinition.isOriginArchived());
- setToscaArtifacts(dataDefinition.getToscaArtifacts());
- }
-
- public String getIcon() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_ICON);
- }
-
- public void setIcon(String icon) {
- setToscaPresentationValue(JsonPresentationFields.CI_ICON, icon);
- }
-
- public String getUniqueId() {
- return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID);
- }
-
- public void setUniqueId(String uniqueId) {
- setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId);
- }
-
- public Long getCreationTime() {
- return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME);
- }
-
- public void setCreationTime(Long creationTime) {
- setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime);
- }
-
- public Long getModificationTime() {
- return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME);
- }
-
- public void setModificationTime(Long modificationTime) {
- setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime);
- }
-
- public String getDescription() {
- return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
- }
-
- public void setDescription(String description) {
- setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description);
- }
-
- public String getPosX() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_X);
- }
-
- public void setPosX(String posX) {
- setToscaPresentationValue(JsonPresentationFields.CI_POS_X, posX);
- }
-
- public String getPosY() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_Y);
- }
-
- public void setPosY(String posY) {
- setToscaPresentationValue(JsonPresentationFields.CI_POS_Y, posY);
- }
-
- public String getComponentUid() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID);
- }
-
- public void setComponentUid(String resourceUid) {
- setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, resourceUid);
- }
-
- public String getName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
- }
-
- public void setName(String name) {
- if (this.getInvariantName() == null && name != null) {
- this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name));
- }
- setToscaPresentationValue(JsonPresentationFields.NAME, name);
- }
-
- public String getInvariantName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME);
- }
-
- public void setInvariantName(String invariantName) {
- setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName);
- }
-
- public Integer getPropertyValueCounter() {
- return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER);
- }
-
- public void setPropertyValueCounter(Integer propertyValueCounter) {
- setToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER, propertyValueCounter);
- }
-
- public String getNormalizedName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME);
- }
-
- public void setNormalizedName(String normalizedName) {
- setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName);
- }
-
- public OriginTypeEnum getOriginType() {
- OriginTypeEnum originType = null;
- String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE);
- if (origType != null && !origType.isEmpty()) {
-
- originType = OriginTypeEnum.findByValue(origType);
- }
- return originType;
- }
-
- public void setOriginType(OriginTypeEnum originType) {
- if (originType != null) {
- setToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE, originType.getValue());
- }
- }
-
- public Integer getAttributeValueCounter() {
- return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER);
- }
-
- public void setAttributeValueCounter(Integer attributeValueCounter) {
- setToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER, attributeValueCounter);
- }
-
- public Integer getInputValueCounter() {
- return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER);
- }
-
- public void setInputValueCounter(Integer inputValueCounter) {
- setToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER, inputValueCounter);
- }
-
- public String getCustomizationUUID() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID);
- }
-
- public void setCustomizationUUID(String customizationUUID) {
- setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID);
- }
-
- public String getComponentName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME);
- }
-
- public void setComponentName(String resourceName) {
- setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME, resourceName);
- }
-
- public String getComponentVersion() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION);
- }
-
- public String getToscaComponentName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME);
- }
-
- public void setToscaComponentName(String toscaComponentName) {
- setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName);
- }
-
- public void setComponentVersion(String resourceVersion) {
- setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion);
- }
-
- public void setSourceModelUuid(String targetModelUuid) {
- setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid);
- }
-
- public void setSourceModelUid(String targetModelUid) {
- setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid);
- }
-
- public void setSourceModelName(String targetModelName) {
- setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName);
- }
-
- public void setSourceModelInvariant(String targetModelInvariant) {
- setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant);
- }
-
- public String getSourceModelUuid() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID);
- }
-
- public String getSourceModelUid() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID);
- }
-
- public String getSourceModelName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME);
- }
-
- public String getSourceModelInvariant() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT);
- }
-
- public void setIsProxy(Boolean isProxy) {
- if (isProxy == null) {
- setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, false);
- } else {
- setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, isProxy);
- }
- }
-
- public Boolean getIsProxy() {
- Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY);
- return (isProxy != null) ? isProxy : false;
- }
-
- public void setOriginArchived(Boolean originArchived) {
- if (originArchived == null) {
- setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, false);
- } else {
- setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, originArchived);
- }
- }
-
- public List<String> getDirectives() {
- return (List<String>) getToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES);
- }
-
- public void setDirectives(List<String> directives) {
- if (directives == null) {
- directives = new ArrayList<>();
- }
- setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives);
- }
-
- public Map<String, ToscaArtifactDataDefinition> getToscaArtifacts() {
- return ( Map<String, ToscaArtifactDataDefinition>) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS);
- }
-
- public void setToscaArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) {
- if (artifacts == null){
- artifacts = new HashMap<>();
- }
- setToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS, artifacts);
- }
-
- public Boolean isOriginArchived() {
- Boolean originArchived = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED);
- return (originArchived != null) ? originArchived : false;
- }
-
- private String getDirectivesString() {
- if (CollectionUtils.isEmpty(getDirectives())) {
- return "";
- }
- return getDirectives().stream().collect(Collectors.joining(","));
- }
-
- @Override
- public String toString() {
- return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name="
- + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid()
- + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime()
- + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY()
- + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter="
- + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType="
- + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName="
- + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName="
- + getToscaComponentName() + ", directives =" + getDirectivesString() + "]";
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import org.apache.commons.collections.CollectionUtils; +import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import org.openecomp.sdc.common.util.ValidationUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +public class ComponentInstanceDataDefinition extends ToscaDataDefinition { + + public ComponentInstanceDataDefinition() { + setPropertyValueCounter(1); + setAttributeValueCounter(1); + setInputValueCounter(1); + setIsProxy(false); + } + + public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) { + setIcon(dataDefinition.getIcon()); + setUniqueId(dataDefinition.getUniqueId()); + setName(dataDefinition.getName()); + setComponentUid(dataDefinition.getComponentUid()); + setCreationTime(dataDefinition.getCreationTime()); + setModificationTime(dataDefinition.getModificationTime()); + setDescription(dataDefinition.getDescription()); + setPosX(dataDefinition.getPosX()); + setPosY(dataDefinition.getPosY()); + setPropertyValueCounter(dataDefinition.getPropertyValueCounter()); + setNormalizedName(dataDefinition.getNormalizedName()); + setOriginType(dataDefinition.getOriginType()); + setCustomizationUUID(dataDefinition.getCustomizationUUID()); + setComponentName(dataDefinition.getComponentName()); + setComponentVersion(dataDefinition.getComponentVersion()); + setToscaComponentName(dataDefinition.getToscaComponentName()); + setInvariantName(dataDefinition.getInvariantName()); + setSourceModelInvariant(dataDefinition.getSourceModelInvariant()); + setSourceModelName(dataDefinition.getSourceModelName()); + setSourceModelUuid(dataDefinition.getSourceModelUuid()); + setSourceModelUid(dataDefinition.getSourceModelUid()); + setIsProxy(dataDefinition.getIsProxy()); + setDirectives(dataDefinition.getDirectives()); + setOriginArchived(dataDefinition.isOriginArchived()); + setToscaArtifacts(dataDefinition.getToscaArtifacts()); + } + + public String getIcon() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_ICON); + } + + public void setIcon(String icon) { + setToscaPresentationValue(JsonPresentationFields.CI_ICON, icon); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + public CreatedFrom getCreatedFrom() { + String createdFrom = (String) getToscaPresentationValue(JsonPresentationFields.CREATED_FROM); + return Objects.nonNull(createdFrom) ? CreatedFrom.valueOf(createdFrom) : null; + } + + public void setCreatedFrom(CreatedFrom createdFrom) { + if (Objects.nonNull(createdFrom)){ + setToscaPresentationValue(JsonPresentationFields.CREATED_FROM, createdFrom.name()); + } + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public String getPosX() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_X); + } + + public void setPosX(String posX) { + setToscaPresentationValue(JsonPresentationFields.CI_POS_X, posX); + } + + public String getPosY() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_Y); + } + + public void setPosY(String posY) { + setToscaPresentationValue(JsonPresentationFields.CI_POS_Y, posY); + } + + public String getComponentUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID); + } + + public void setComponentUid(String resourceUid) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, resourceUid); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + if (this.getInvariantName() == null && name != null) { + this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name)); + } + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getInvariantName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); + } + + public void setInvariantName(String invariantName) { + setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); + } + + public Integer getPropertyValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER); + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + setToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER, propertyValueCounter); + } + + public String getNormalizedName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); + } + + public void setNormalizedName(String normalizedName) { + setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName); + } + + public OriginTypeEnum getOriginType() { + OriginTypeEnum originType = null; + String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE); + if (origType != null && !origType.isEmpty()) { + + originType = OriginTypeEnum.findByValue(origType); + } + return originType; + } + + public void setOriginType(OriginTypeEnum originType) { + if (originType != null) { + setToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE, originType.getValue()); + } + } + + public Integer getAttributeValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER); + } + + public void setAttributeValueCounter(Integer attributeValueCounter) { + setToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER, attributeValueCounter); + } + + public Integer getInputValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER); + } + + public void setInputValueCounter(Integer inputValueCounter) { + setToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER, inputValueCounter); + } + + public String getCustomizationUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID); + } + + public void setCustomizationUUID(String customizationUUID) { + setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID); + } + + public String getComponentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME); + } + + public void setComponentName(String resourceName) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME, resourceName); + } + + public String getComponentVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION); + } + + public String getToscaComponentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME); + } + + public void setToscaComponentName(String toscaComponentName) { + setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName); + } + + public void setComponentVersion(String resourceVersion) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); + } + + public void setSourceModelUuid(String targetModelUuid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid); + } + + public void setSourceModelUid(String targetModelUid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); + } + + public void setSourceModelName(String targetModelName) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); + } + + public void setSourceModelInvariant(String targetModelInvariant) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); + } + + public String getSourceModelUuid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); + } + + public String getSourceModelUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); + } + + public String getSourceModelName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); + } + + public String getSourceModelInvariant() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); + } + + public void setIsProxy(Boolean isProxy) { + if (isProxy == null) { + setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, false); + } else { + setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, isProxy); + } + } + + public Boolean getIsProxy() { + Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); + return (isProxy != null) ? isProxy : false; + } + + public void setOriginArchived(Boolean originArchived) { + if (originArchived == null) { + setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, false); + } else { + setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, originArchived); + } + } + + public List<String> getDirectives() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES); + } + + public void setDirectives(List<String> directives) { + if (directives == null) { + directives = new ArrayList<>(); + } + setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives); + } + + public Map<String, ToscaArtifactDataDefinition> getToscaArtifacts() { + return ( Map<String, ToscaArtifactDataDefinition>) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS); + } + + public void setToscaArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) { + if (artifacts == null){ + artifacts = new HashMap<>(); + } + setToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS, artifacts); + } + + public Boolean isOriginArchived() { + Boolean originArchived = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED); + return (originArchived != null) ? originArchived : false; + } + + private String getDirectivesString() { + if (CollectionUtils.isEmpty(getDirectives())) { + return ""; + } + return getDirectives().stream().collect(Collectors.joining(",")); + } + + @Override + public String toString() { + return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() + + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime() + + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" + + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType=" + + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + + getToscaComponentName() + ", directives =" + getDirectivesString() + "]"; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java index bf8b868847..ad61426583 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.be.datatypes.elements; +import com.fasterxml.jackson.annotation.JsonInclude; import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -33,9 +34,9 @@ import static java.util.Collections.emptyMap; public class GroupDataDefinition extends ToscaDataDefinition { - + @JsonInclude private String typeUid; - + @JsonInclude private Integer propertyValueCounter = 0; public GroupDataDefinition() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java index 97107dbbf2..2d8350b9ef 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; import java.util.ArrayList; import java.util.List; @@ -39,6 +40,10 @@ public class ProductMetadataDataDefinition extends ComponentMetadataDataDefiniti public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) { super(other); + } + + public ProductMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ + super(extractor); } public Boolean getIsActive() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index af29a2f424..c138617f42 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -79,13 +79,14 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private List<GetPolicyValueDataDefinition> getPolicyValues; + private List<String> propertyConstraints; + public PropertyDataDefinition() { super(); } public PropertyDataDefinition(Map<String, Object> pr) { super(pr); - } public PropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { @@ -93,6 +94,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.setUniqueId(propertyDataDefinition.getUniqueId()); this.setRequired(propertyDataDefinition.isRequired()); this.setDefaultValue(propertyDataDefinition.getDefaultValue()); + this.setDefinition(propertyDataDefinition.getDefinition()); this.setDescription(propertyDataDefinition.getDescription()); this.setSchema(propertyDataDefinition.getSchema()); this.setPassword(propertyDataDefinition.isPassword()); @@ -117,6 +119,9 @@ public class PropertyDataDefinition extends ToscaDataDefinition { if (isNotEmpty(propertyDataDefinition.annotations)) { this.setAnnotations(propertyDataDefinition.annotations); } + if(isNotEmpty(propertyDataDefinition.getPropertyConstraints())){ + setPropertyConstraints(new ArrayList<>(propertyDataDefinition.getPropertyConstraints())); + } this.setIsDeclaredListInput(propertyDataDefinition.getIsDeclaredListInput()); } @@ -169,6 +174,10 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.definition = definition; } + public boolean getDefinition() { + return definition; + } + public String getType() { return type; } @@ -575,4 +584,11 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return (List<Annotation>) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); } + public List<String> getPropertyConstraints() { + return propertyConstraints; + } + + public void setPropertyConstraints(List<String> constraints) { + this.propertyConstraints = constraints; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java index 058bcac046..09e1de6c7b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java @@ -55,10 +55,14 @@ public enum GraphPropertyEnum { IS_ARCHIVED("isArchived", Boolean.class, false, true), IS_VSP_ARCHIVED("isVspArchived", Boolean.class, false, true), ARCHIVE_TIME("archiveTime", Long.class, false, true), + PREV_CATALOG_UPDATE_TIME ("previousUpdateTime", Long.class, false, true), + CURRENT_CATALOG_UPDATE_TIME ("currentUpdateTime", Long.class, false, true), //Healing HEALING_VERSION("healVersion", Integer.class, false, true); + + private String property; private Class clazz; private boolean unique; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java index 3a824d52f8..b84baff861 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java @@ -58,6 +58,7 @@ public enum JsonPresentationFields { DISTRIBUTION_STATUS("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS), DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null), DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null), + SERVICE_FUNCTION("serviceFunction", null), ////Inputs ANNOTATIONS("annotations", null), @@ -221,9 +222,18 @@ public enum JsonPresentationFields { IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED), CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null), - //Interface Operation - IO_WORKFLOW_ID("workflowId", null), - IO_WORKFLOW_VERSION_ID("workflowVersionId", null), + //Interface Operation + IO_OPERATION_TYPE("operationType",null), + IO_INPUT_PARAMETERS("inputParams",null), + IO_OUTPUT_PARAMETERS("outputParams",null), + IO_PARAM_NAME("paramName", null), + IO_PARAM_ID("paramId", null), + IO_NAME("name", null), + IO_MANDATORY("mandatory", null), + IO_TYPE("type", null), + IO_PROPERTY("property", null), + IO_WORKFLOW_ID("workflowId", null), + IO_WORKFLOW_VERSION_ID("workflowVersionId", null), IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null), //Interface diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java new file mode 100644 index 0000000000..5f20c58a84 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2019 Nokia + * ================================================================================ + */ + +package org.openecomp.sdc.be.datatypes.enums; + +import java.util.List; +import java.util.Map; + +public class JsonPresentationFieldsExtractor { + + private Map<String, Object> properties; + + public JsonPresentationFieldsExtractor(Map<String, Object> properties) { + this.properties = properties; + } + + public String getUniqueId() { + return (String) properties.get(JsonPresentationFields.UNIQUE_ID.getPresentation()); + } + + public String getName() { + return (String) properties.get(JsonPresentationFields.NAME.getPresentation()); + } + + public String getVersion() { + return (String) properties.get(JsonPresentationFields.VERSION.getPresentation()); + } + + public Boolean isHighestVersion() { + return (Boolean) properties.get(JsonPresentationFields.HIGHEST_VERSION.getPresentation()); + } + + public Long getCreationDate() { + return (Long) properties.get(JsonPresentationFields.CREATION_DATE.getPresentation()); + } + + public Long getLastUpdateDate() { + return (Long) properties.get(JsonPresentationFields.LAST_UPDATE_DATE.getPresentation()); + } + + public String getDescription() { + return (String) properties.get(JsonPresentationFields.DESCRIPTION.getPresentation()); + } + + public String getState() { + return (String) properties.get(JsonPresentationFields.LIFECYCLE_STATE.getPresentation()); + } + + @SuppressWarnings("unchecked") + public List<String> getTags() { + return (List<String>) properties.get(JsonPresentationFields.TAGS.getPresentation()); + } + + public String getIcon() { + return (String) properties.get(JsonPresentationFields.ICON.getPresentation()); + } + + public String getContactId() { + return (String) properties.get(JsonPresentationFields.CONTACT_ID.getPresentation()); + } + + public String getUUID() { + return (String) properties.get(JsonPresentationFields.UUID.getPresentation()); + } + + public String getNormalizedName() { + return (String) properties.get(JsonPresentationFields.NORMALIZED_NAME.getPresentation()); + } + + public String getSystemName() { + return (String) properties.get(JsonPresentationFields.SYSTEM_NAME.getPresentation()); + } + + public Boolean isDeleted() { + return (Boolean) properties.get(JsonPresentationFields.IS_DELETED.getPresentation()); + } + + public String getProjectCode() { + return (String) properties.get(JsonPresentationFields.PROJECT_CODE.getPresentation()); + } + + public String getCsarUuid() { + return (String) properties.get(JsonPresentationFields.CSAR_UUID.getPresentation()); + } + + public String getCsarVersion() { + return (String) properties.get(JsonPresentationFields.CSAR_VERSION.getPresentation()); + } + + public String getImportedToscaChecksum() { + return (String) properties.get(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM.getPresentation()); + } + + public String getInvariantUuid() { + return (String) properties.get(JsonPresentationFields.INVARIANT_UUID.getPresentation()); + } + + public Boolean isArchived() { + return (Boolean) properties.get(JsonPresentationFields.IS_ARCHIVED.getPresentation()); + } + + public Boolean isVspArchived() { + return (Boolean) properties.get(JsonPresentationFields.IS_VSP_ARCHIVED.getPresentation()); + } + + public Long getArchiveTime() { + Object archiveTimeObject = properties.get(JsonPresentationFields.ARCHIVE_TIME.getPresentation()); + if (archiveTimeObject instanceof Integer) { + return Long.valueOf((Integer) archiveTimeObject); + } else { + return (Long) archiveTimeObject; + } + } + + public String getVendorName() { + return (String) properties.get(JsonPresentationFields.VENDOR_NAME.getPresentation()); + } + + public String getVendorRelease() { + return (String) properties.get(JsonPresentationFields.VENDOR_RELEASE.getPresentation()); + } + + public String getResourceVendorModelNumber() { + return (String) properties.get(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER.getPresentation()); + } + + public Boolean isAbstract() { + return (Boolean) properties.get(JsonPresentationFields.IS_ABSTRACT.getPresentation()); + } + + public ResourceTypeEnum getResourceType() { + return ResourceTypeEnum.valueOf((String)properties.get(JsonPresentationFields.RESOURCE_TYPE.getPresentation())); + } + + public String getToscaResourceName() { + return (String) properties.get(JsonPresentationFields.TOSCA_RESOURCE_NAME.getPresentation()); + } + + public String getServiceType() { + return (String) properties.get(JsonPresentationFields.SERVICE_TYPE.getPresentation()); + } + + public String getServiceRole() { + return (String) properties.get(JsonPresentationFields.SERVICE_ROLE.getPresentation()); + } + + public String getServiceFunction() { + return (String) properties.get(JsonPresentationFields.SERVICE_FUNCTION.getPresentation()); + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java index c7c576d95a..48394013de 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java @@ -33,12 +33,14 @@ public enum OriginTypeEnum { private String displayValue; private String instanceType; private ComponentTypeEnum componentType; + private boolean isAtomicType; OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType, boolean isAtomicType) { this.value = value; this.displayValue = displayValue; this.instanceType = instanceType; this.componentType = componentType; + this.isAtomicType = isAtomicType; } public String getValue() { @@ -57,6 +59,10 @@ public enum OriginTypeEnum { return componentType; } + public boolean isAtomicType() { + return isAtomicType; + } + public static OriginTypeEnum findByValue(String value) { OriginTypeEnum ret = null; for (OriginTypeEnum curr : OriginTypeEnum.values()) { @@ -67,4 +73,5 @@ public enum OriginTypeEnum { } return ret; } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PortMirroringEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PortMirroringEnum.java new file mode 100644 index 0000000000..305ae79821 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PortMirroringEnum.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2019 Nokia + * ================================================================================ + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum PortMirroringEnum { + CISCO_VENDOR_NAME("CISCO"), + CISCO_VENDOR_MODEL_NUMBER("4500x"); + + private String value; + + public String getValue() { + return value; + } + + PortMirroringEnum(String value) { + this.value = value; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PromoteVersionEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PromoteVersionEnum.java new file mode 100644 index 0000000000..3ad423927a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PromoteVersionEnum.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2019 Nokia + * ================================================================================ + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum PromoteVersionEnum { + + NONE, + MINOR, + MAJOR + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java index 21d4e5ca53..bd32ace9e5 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java @@ -30,8 +30,8 @@ public enum ResourceTypeEnum { CVFC("CVFC"/* Complex Virtual Function Component*/, false), VL("VL"/* (Virtual Link)"*/, true), VFCMT("VFCMT"/* (VFC Monitoring Template)"*/, true), - Configuration("Configuration ()", true), - ServiceProxy("ServiceProxy ()", true), + Configuration("Configuration", true), + ServiceProxy("ServiceProxy", true), ABSTRACT("Abstract (Generic VFC/VF/PNF/Service Type)", true); private String value; |