* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.config;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
import java.util.Arrays;
import java.util.Optional;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
/**
* Stores non mano artifact types.
@Getter
@AllArgsConstructor
public enum NonManoArtifactType {
+ // @formatter:off
ONAP_VES_EVENTS("onap_ves_events"),
ONAP_PM_DICTIONARY("onap_pm_dictionary"),
ONAP_YANG_MODULES("onap_yang_modules"),
ONAP_OTHERS("onap_others"),
ONAP_SW_INFORMATION("onap_pnf_sw_information"),
ONAP_CNF_HELM("onap_cnf_helm");
+ // @formatter:on
private final String type;
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.config;
import java.util.Collections;
+import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import lombok.Data;
-
-import java.util.Map;
import org.apache.commons.collections.MapUtils;
/**
*/
@Data
public class NonManoConfiguration {
+
private Map<String, NonManoFolderType> nonManoKeyFolderMapping;
/**
* Gets the non mano folder type based on the non mano artifact type.
+ *
* @param nonManoArtifactType the artifact type
- * @return
- * The NonManoType for the artifact type
+ * @return The NonManoType for the artifact type
*/
public NonManoFolderType getNonManoType(final NonManoArtifactType nonManoArtifactType) {
return nonManoKeyFolderMapping.get(nonManoArtifactType.getType());
if (MapUtils.isEmpty(nonManoKeyFolderMapping)) {
return Collections.emptyMap();
}
-
- return nonManoKeyFolderMapping.entrySet().stream()
- .filter(entry -> entry.getValue().isValid())
+ return nonManoKeyFolderMapping.entrySet().stream().filter(entry -> entry.getValue().isValid())
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
}
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.config;
import java.io.IOException;
* Singleton that loads and stores the Non Mano configuration
*/
public class NonManoConfigurationManager {
+
private static NonManoConfigurationManager nonManoConfigurationManager = null;
private NonManoConfiguration nonManoConfiguration;
loadConfiguration();
}
+ public static NonManoConfigurationManager getInstance() {
+ if (nonManoConfigurationManager == null) {
+ nonManoConfigurationManager = new NonManoConfigurationManager();
+ }
+ return nonManoConfigurationManager;
+ }
+
/**
* Loads the configuration yaml from the resources.
*/
nonManoConfiguration = convertFromString(data, NonManoConfiguration.class);
}
- public static NonManoConfigurationManager getInstance() {
- if (nonManoConfigurationManager == null) {
- nonManoConfigurationManager = new NonManoConfigurationManager();
- }
-
- return nonManoConfigurationManager;
- }
-
public NonManoConfiguration getNonManoConfiguration() {
return nonManoConfiguration;
}
try {
return (new Yaml()).loadAs(yamlContents, className);
} catch (final Exception e) {
- throw new
- LoadConfigurationException(String.format("Failed to convert YAML %s to object.", yamlContents), e);
+ throw new LoadConfigurationException(String.format("Failed to convert YAML %s to object.", yamlContents), e);
}
}
-
}
@Data
public class NonManoFolderType {
+
private String location;
private String type;
/**
* Gets the expected folder path
+ *
* @return
*/
public String getPath() {
return String.format("Artifacts/%s/%s", type, location);
}
-
public boolean isValid() {
return StringUtils.isNotBlank(location) && StringUtils.isNotBlank(type);
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.config.exception;
public class LoadConfigurationException extends RuntimeException {
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
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
*/
/**
* Adds a {@link PnfSoftwareVersion} instance to the software version set
+ *
* @param softwareVersion the pnf software version to add
*/
public void addToSoftwareVersionSet(final PnfSoftwareVersion softwareVersion) {
return new LinkedHashSet<>(softwareVersionSet);
}
+ public boolean isValid() {
+ if (CollectionUtils.isEmpty(softwareVersionSet)) {
+ return false;
+ }
+ return softwareVersionSet.stream().allMatch(PnfSoftwareVersion::isValid);
+ }
+
/**
* Stores the software information yaml field names.
*/
@AllArgsConstructor
@Getter
public enum PnfSoftwareInformationField {
- DESCRIPTION("description"),
- PROVIDER("provider"),
- VERSION("version"),
- PNF_SOFTWARE_INFORMATION("pnf_software_information");
-
+ DESCRIPTION("description"), PROVIDER("provider"), VERSION("version"), PNF_SOFTWARE_INFORMATION("pnf_software_information");
private final String fieldName;
-
}
-
- public boolean isValid() {
- if(CollectionUtils.isEmpty(softwareVersionSet)) {
- return false;
- }
-
- return softwareVersionSet.stream().allMatch(PnfSoftwareVersion::isValid);
- }
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.pnf;
import lombok.AllArgsConstructor;
private final String version;
private final String description;
+ public boolean isValid() {
+ return StringUtils.isNotEmpty(version);
+ }
+
/**
* Stores the pnf software version yaml fields.
*/
@Getter
@AllArgsConstructor
public enum PnfSoftwareVersionField {
- DESCRIPTION("description"),
- PNF_SOFTWARE_VERSION("pnf_software_version");
-
+ DESCRIPTION("description"), PNF_SOFTWARE_VERSION("pnf_software_version");
private final String fieldName;
}
-
- public boolean isValid() {
- return StringUtils.isNotEmpty(version);
- }
-}
\ No newline at end of file
+}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
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;
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.
*/
public class SoftwareInformationArtifactYamlParser {
+
private static final Logger LOGGER = LoggerFactory.getLogger(SoftwareInformationArtifactYamlParser.class);
private SoftwareInformationArtifactYamlParser() {
-
}
/**
* Parses the non-mano software information yaml file.
*
* @param softwareInformationYamlFileBytes the file byte array
- * @return an {@code Optional<PnfSoftwareInformation>} if the file was successful parsed, otherwise {@code
- * Optional.empty()}
+ * @return an {@code Optional<PnfSoftwareInformation>} if the file was successful parsed, otherwise {@code Optional.empty()}
*/
@SuppressWarnings("unchecked")
public static Optional<PnfSoftwareInformation> parse(final byte[] softwareInformationYamlFileBytes) {
if (!(yaml instanceof Map)) {
return Optional.empty();
}
-
softwareVersionYamlObject = (Map<String, Object>) yaml; // unchecked warning suppressed
} catch (final IOException | YAMLException e) {
LOGGER.warn("Could not parse the software information yaml file", e);
return Optional.empty();
}
-
final PnfSoftwareInformation pnfSoftwareInformation = new PnfSoftwareInformation();
- pnfSoftwareInformation.setDescription(
- (String) softwareVersionYamlObject.get(PnfSoftwareInformationField.DESCRIPTION.getFieldName()));
- pnfSoftwareInformation.setProvider(
- (String) softwareVersionYamlObject.get(PnfSoftwareInformationField.PROVIDER.getFieldName()));
- pnfSoftwareInformation.setVersion(
- (String) softwareVersionYamlObject.get(PnfSoftwareInformationField.VERSION.getFieldName()));
+ pnfSoftwareInformation.setDescription((String) softwareVersionYamlObject.get(PnfSoftwareInformationField.DESCRIPTION.getFieldName()));
+ pnfSoftwareInformation.setProvider((String) softwareVersionYamlObject.get(PnfSoftwareInformationField.PROVIDER.getFieldName()));
+ pnfSoftwareInformation.setVersion((String) softwareVersionYamlObject.get(PnfSoftwareInformationField.VERSION.getFieldName()));
final List<Map<String, String>> pnfSoftwareInformationYaml = (List<Map<String, String>>) softwareVersionYamlObject
.get(PnfSoftwareInformationField.PNF_SOFTWARE_INFORMATION.getFieldName()); // unchecked warning suppressed
-
if (CollectionUtils.isNotEmpty(pnfSoftwareInformationYaml)) {
pnfSoftwareInformationYaml.forEach(stringStringMap -> {
final String description = stringStringMap.get(PnfSoftwareVersionField.DESCRIPTION.getFieldName());
pnfSoftwareInformation.addToSoftwareVersionSet(new PnfSoftwareVersion(version, description));
});
}
-
return Optional.of(pnfSoftwareInformation);
}
-
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security;
import java.io.File;
@Component
public class CertificateManagerImpl implements CertificateManager {
+ public static final String CERT_DIR_ENV_VARIABLE = "SDC_CERT_DIR";
private static final Logger LOGGER = LoggerFactory.getLogger(CertificateManagerImpl.class);
-
private final PrivateKeyReader privateKeyReader;
private final CertificateReader certificateReader;
private final Environment environment;
-
+ private final Map<String, CertificateInfo> certificateMap = new HashMap<>();
private Path certificateDirectoryPath;
private File certificateDirectory;
- private final Map<String, CertificateInfo> certificateMap = new HashMap<>();
- public static final String CERT_DIR_ENV_VARIABLE = "SDC_CERT_DIR";
-
- public CertificateManagerImpl(final PrivateKeyReader privateKeyReader,
- final CertificateReader certificateReader,
- final Environment environment) {
+ public CertificateManagerImpl(final PrivateKeyReader privateKeyReader, final CertificateReader certificateReader, final Environment environment) {
this.certificateReader = certificateReader;
this.privateKeyReader = privateKeyReader;
this.environment = environment;
if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
Security.addProvider(new BouncyCastleProvider());
}
-
final String certificateDir = environment.getProperty(CERT_DIR_ENV_VARIABLE);
if (certificateDir == null) {
LOGGER.warn("Environment variable '{}' was not provided. Could not load certificates.", CERT_DIR_ENV_VARIABLE);
try {
this.certificateDirectoryPath = Paths.get(certificateDir);
} catch (final Exception e) {
- LOGGER.error("Invalid path '{}' provided in the environment variable '{}'. Could not load certificates.",
- certificateDir, CERT_DIR_ENV_VARIABLE, e);
+ LOGGER.error("Invalid path '{}' provided in the environment variable '{}'. Could not load certificates.", certificateDir,
+ CERT_DIR_ENV_VARIABLE, e);
return;
}
try {
LOGGER.warn("Certificate directory is empty. No trusted certificate found.");
return;
}
-
- final List<File> certFileList = Arrays.stream(files)
- .filter(file -> "cert".equals(FilenameUtils.getExtension(file.getName())))
+ final List<File> certFileList = Arrays.stream(files).filter(file -> "cert".equals(FilenameUtils.getExtension(file.getName())))
.collect(Collectors.toList());
- final List<File> keyFileList = Arrays.stream(files)
- .filter(file -> "key".equals(FilenameUtils.getExtension(file.getName())))
+ final List<File> keyFileList = Arrays.stream(files).filter(file -> "key".equals(FilenameUtils.getExtension(file.getName())))
.collect(Collectors.toList());
-
if (certFileList.isEmpty()) {
LOGGER.error("Certificate directory is empty. No trusted certificate found.");
return;
}
-
certFileList.forEach(certFile -> {
final String baseFileName = FilenameUtils.getBaseName(certFile.getName());
final Certificate certificate = loadCertificate(certFile);
- final Optional<File> keyFileOptional = keyFileList.stream().filter(
- keyFile1 -> FilenameUtils.getBaseName(keyFile1.getName())
- .equals(baseFileName)).findFirst();
- keyFileOptional.ifPresentOrElse(
- keyFile -> {
- final CertificateInfoImpl certificateInfo =
- new CertificateInfoImpl(certFile, certificate, keyFile, loadPrivateKey(keyFile));
- if (certificateInfo.isValid()) {
- certificateMap.put(baseFileName, certificateInfo);
- }
- },
- () -> {
- final CertificateInfoImpl certificateInfo = new CertificateInfoImpl(certFile, certificate);
- if (certificateInfo.isValid()) {
- certificateMap.put(baseFileName, new CertificateInfoImpl(certFile, certificate));
- }
+ final Optional<File> keyFileOptional = keyFileList.stream()
+ .filter(keyFile1 -> FilenameUtils.getBaseName(keyFile1.getName()).equals(baseFileName)).findFirst();
+ keyFileOptional.ifPresentOrElse(keyFile -> {
+ final CertificateInfoImpl certificateInfo = new CertificateInfoImpl(certFile, certificate, keyFile, loadPrivateKey(keyFile));
+ if (certificateInfo.isValid()) {
+ certificateMap.put(baseFileName, certificateInfo);
+ }
+ }, () -> {
+ final CertificateInfoImpl certificateInfo = new CertificateInfoImpl(certFile, certificate);
+ if (certificateInfo.isValid()) {
+ certificateMap.put(baseFileName, new CertificateInfoImpl(certFile, certificate));
}
- );
+ });
});
}
private void loadCertificateDirectory() {
final File file = certificateDirectoryPath.toFile();
if (!file.exists() || !file.isDirectory()) {
- final String errorMsg =
- String.format("Provided certificate path '%s' is not a directory or does not exist",
- certificateDirectoryPath);
+ final String errorMsg = String.format("Provided certificate path '%s' is not a directory or does not exist", certificateDirectoryPath);
throw new CertificateNotFoundException(errorMsg);
}
this.certificateDirectory = file;
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security;
import java.io.File;
final String errorMsg = "Could not load the private key from given file '%s'. Unsupported format.";
throw new UnsupportedKeyFormatException(String.format(errorMsg, privateKeyFile));
}
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security;
import java.io.IOException;
public class Sha256WithRsaCmsContentSigner implements CmsContentSigner {
@Override
- public byte[] signData(final byte[] data, final Certificate signingCertificate, final Key signingKey)
- throws CmsSignatureException {
-
+ public byte[] signData(final byte[] data, final Certificate signingCertificate, final Key signingKey) throws CmsSignatureException {
final CMSTypedData cmsData = new CMSProcessableByteArray(data);
final JcaCertStore certStore = createCertificateStore(signingCertificate);
try {
- final ContentSigner contentSigner
- = new JcaContentSignerBuilder("SHA256withRSA")
- .setProvider(BouncyCastleProvider.PROVIDER_NAME).build((PrivateKey) signingKey);
-
+ final ContentSigner contentSigner = new JcaContentSignerBuilder("SHA256withRSA").setProvider(BouncyCastleProvider.PROVIDER_NAME)
+ .build((PrivateKey) signingKey);
final CMSSignedDataGenerator cmsGenerator = new CMSSignedDataGenerator();
cmsGenerator.addSignerInfoGenerator(
- new JcaSignerInfoGeneratorBuilder(
- new JcaDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build()
- ).build(contentSigner, (X509Certificate) signingCertificate)
- );
+ new JcaSignerInfoGeneratorBuilder(new JcaDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build())
+ .build(contentSigner, (X509Certificate) signingCertificate));
cmsGenerator.addCertificates(certStore);
-
final CMSSignedData cms = cmsGenerator.generate(cmsData, false);
return cms.getEncoded();
} catch (final Exception e) {
try {
return new JcaCertStore(Collections.singletonList(signingCertificate));
} catch (final CertificateEncodingException e) {
- final String errorMsg = String
- .format("Could not create certificate store from certificate '%s'", signingCertificate);
+ final String errorMsg = String.format("Could not create certificate store from certificate '%s'", signingCertificate);
throw new CmsSignatureException(errorMsg, e);
}
}
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security;
import java.io.File;
final CertificateFactory factory = CertificateFactory.getInstance("X.509");
return factory.generateCertificate(certificateInputStream);
}
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.api;
import java.util.Optional;
public interface CertificateManager {
Optional<CertificateInfo> getCertificate(String certName);
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.api;
import java.io.File;
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.api;
import java.security.Key;
public interface CmsContentSigner {
- byte[] signData(byte[] data, Certificate signingCertificate, Key signingKey)
- throws CmsSignatureException;
+ byte[] signData(byte[] data, Certificate signingCertificate, Key signingKey) throws CmsSignatureException;
String formatToPemSignature(byte[] signedData) throws CmsSignatureException;
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.api;
import java.io.File;
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.api.model;
import java.io.File;
* @throws UnsupportedOperationException when the certificate is not supported
*/
boolean isValid();
-
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.exception;
public class CertificateNotFoundException extends RuntimeException {
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.exception;
public class CmsSignatureException extends Exception {
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.exception;
public class LoadCertificateException extends RuntimeException {
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.exception;
public class LoadPrivateKeyException extends RuntimeException {
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.exception;
public class UnsupportedKeyFormatException extends RuntimeException {
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.csar.security.model;
import java.io.File;
public class CertificateInfoImpl implements CertificateInfo {
private static final Logger LOGGER = LoggerFactory.getLogger(CertificateInfoImpl.class);
-
private final String name;
private final File certificateFile;
private final Certificate certificate;
this.name = FilenameUtils.getBaseName(certificateFile.getName());
}
- public CertificateInfoImpl(final File certificateFile, final Certificate certificate,
- final File privateKeyFile, final Key privateKey) {
+ public CertificateInfoImpl(final File certificateFile, final Certificate certificate, final File privateKeyFile, final Key privateKey) {
this(certificateFile, certificate);
this.privateKeyFile = privateKeyFile;
this.privateKey = privateKey;
@Override
public boolean isValid() {
- if("X.509".equals(certificate.getType())) {
+ if ("X.509".equals(certificate.getType())) {
try {
((X509Certificate) certificate).checkValidity();
return true;
}
throw new UnsupportedOperationException(String.format("Certificate type '%s' not supported", certificate.getType()));
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.category;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
-import lombok.NoArgsConstructor;
-import java.util.List;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
@Getter
@Setter
this.useServiceSubstitutionForNestedServices = c.useServiceSubstitutionForNestedServices;
this.metadataKeys = c.metadataKeys;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.category;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
private String uniqueId;
public GroupingDataDefinition() {
-
}
public GroupingDataDefinition(GroupingDataDefinition c) {
@Override
public String toString() {
- return "GroupingDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId
- + "]";
+ return "GroupingDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId + "]";
}
-
}
package org.openecomp.sdc.be.datatypes.category;
import java.util.List;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
@Getter
@Setter
@ToString
@NoArgsConstructor
public class MetadataKeyDataDefinition extends ToscaDataDefinition {
+
private String name;
private List<String> validValues;
private boolean mandatory;
private String defaultValue;
-
+
public MetadataKeyDataDefinition(MetadataKeyDataDefinition metadataKeyDataDefinition) {
this.name = metadataKeyDataDefinition.name;
this.validValues = metadataKeyDataDefinition.validValues;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.category;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
-import java.util.List;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
@Getter
@Setter
this.icons = c.icons;
this.metadataKeys = c.metadataKeys;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.components;
import java.util.ArrayList;
public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition {
private static final Logger LOGGER = Logger.getLogger(ComponentMetadataDataDefinition.class.getName());
-
@Getter
private String uniqueId;
@Getter
public void setInvariantUUID(String invariantUUID) {
if (this.invariantUUID != null && !this.invariantUUID.equals(invariantUUID)) {
- LOGGER.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID,
- invariantUUID);
+ LOGGER.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID, invariantUUID);
}
this.invariantUUID = invariantUUID;
}
* @return
*/
public abstract String getActualComponentType();
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.components;
import lombok.EqualsAndHashCode;
private String vendorRelease;
private String resourceVendorModelNumber;
private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC
+
// is
+
// default
private Boolean isAbstract;
private String cost;
@Override
public String toString() {
- return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease
- + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType
- + ", isAbstract=" + isAbstract + super.toString() + "]";
+ return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease + ", resourceVendorModelNumber="
+ + resourceVendorModelNumber + ", resourceType=" + resourceType + ", isAbstract=" + isAbstract + super.toString() + "]";
}
@Override
public String getActualComponentType() {
return getResourceType().getValue();
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.components;
import lombok.Data;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-
@Data
@NoArgsConstructor
public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition {
private static final String EMPTY_STR = "";
-
private String distributionStatus;
-
-
private String serviceType = EMPTY_STR;
-
-
private String serviceRole = EMPTY_STR;
-
-
private String instantiationType = EMPTY_STR;
-
-
private String serviceFunction = EMPTY_STR;
-
-
private Boolean ecompGeneratedNaming = true;
-
-
private String namingPolicy = EMPTY_STR;
-
-
private String environmentContext;
-
private String serviceVendorModelNumber;
public Boolean isAbstract;
private ResourceTypeEnum importServiceType = ResourceTypeEnum.SERVICE;
}
public Boolean isEcompGeneratedNaming() {
- return getEcompGeneratedNaming();
+ return getEcompGeneratedNaming();
}
@Override
public String getActualComponentType() {
-
return componentType != null ? componentType.getValue() : "";
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
private Long creationTime;
private Long modificationTime;
private Integer lastCreatedCounter = 0;
-
@ToString.Exclude
private List<AdditionalInfoParameterInfo> parameters;
this.lastCreatedCounter = p.lastCreatedCounter;
this.parameters = p.parameters;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.AllArgsConstructor;
this.key = key;
this.value = value;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
@EqualsAndHashCode.Include
private String name;
-
private String type;
private String description;
private List<PropertyDataDefinition> properties;
public static void setAnnotationsName(Map<String, Annotation> annotations) {
annotations.forEach((name, annotation) -> annotation.setName(name));
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.Getter;
public class AnnotationTypeDataDefinition extends ToscaDataDefinition {
protected String uniqueId;
-
@ToString.Exclude
protected String type;
-
protected String description;
-
protected Long creationTime;
protected Long modificationTime;
-
protected String version;
protected boolean highestVersion;
modificationTime = other.modificationTime;
highestVersion = other.highestVersion;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.ArrayList;
}
this.setGeneratedFromId(a.getGeneratedFromId());
this.setIsFromCsar(a.getIsFromCsar());
-
-
}
public String getArtifactName() {
return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
-
}
public void setArtifactName(String artifactName) {
setToscaPresentationValue(JsonPresentationFields.NAME, artifactName);
-
}
public String getArtifactType() {
public void setArtifactType(String artifactType) {
setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE, artifactType);
-
}
public boolean isHeatEnvType() {
public String getArtifactRef() {
return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF);
-
}
public void setArtifactRef(String artifactRef) {
public String getArtifactRepository() {
return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY);
-
}
public void setArtifactRepository(String artifactRepository) {
}
public String getUserIdCreator() {
-
return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR);
}
return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef()
+ ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum="
+ getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName="
- + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate()
- + ", lastUpdateDate=" + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator="
- + getArtifactCreator() + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName="
- + getArtifactDisplayName() + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType="
- + getArtifactGroupType() + ", timeout=" + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID="
- + getArtifactUUID()
- + ", payloadUpdateDate=" + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts="
- + getRequiredArtifacts() + "]";
+ + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate() + ", lastUpdateDate="
+ + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator()
+ + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName=" + getArtifactDisplayName()
+ + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout="
+ + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID() + ", payloadUpdateDate="
+ + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
-
String apiUrl = getApiUrl();
String artifactChecksum = getArtifactChecksum();
String artifactCreator = getArtifactCreator();
String artifactRef = getArtifactRef();
String artifactRepository = getArtifactRepository();
String artifactType = getArtifactType();
-
String artifactUUID = getArtifactUUID();
String artifactVersion = getArtifactVersion();
String userIdCreator = getUserIdCreator();
String userIdLastUpdater = getUserIdLastUpdater();
Long creationDate = getCreationDate();
-
String creatorFullName = getCreatorFullName();
String description = getDescription();
String esId = getEsId();
Long heatParamsUpdateDate = getHeatParamsUpdateDate();
Long lastUpdateDate = getLastUpdateDate();
Boolean mandatory = getMandatory();
-
Long payloadUpdateDate = getPayloadUpdateDate();
List<String> requiredArtifacts = getRequiredArtifacts();
Boolean serviceApi = getServiceApi();
Integer timeout = getTimeout();
String uniqueId = getUniqueId();
String updaterFullName = getUpdaterFullName();
-
result = prime * result + ((apiUrl == null) ? 0 : apiUrl.hashCode());
result = prime * result + ((artifactChecksum == null) ? 0 : artifactChecksum.hashCode());
result = prime * result + ((artifactCreator == null) ? 0 : artifactCreator.hashCode());
if (CollectionUtils.isNotEmpty(attributeDataDefinition.getGetOutputValues())) {
this.getOutputValues = new ArrayList<>(attributeDataDefinition.getGetOutputValues());
}
-
}
public String getUniqueId() {
public String getParentUniqueId() {
return getOwnerId();
}
-
}
}
public ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> getProperties() {
- return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(
- JsonPresentationFields.PROPERTIES);
+ return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES);
}
public void setProperties(ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties) {
public void setID(String name) {
setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, name);
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.google.common.collect.Lists;
this.setName(other.getName());
this.setParentName(other.getParentName());
this.setPreviousName(other.getPreviousName());
-
if (other.getValidSourceTypes() == null) {
this.setValidSourceTypes(Lists.newArrayList());
} else {
this.setValidSourceTypes(Lists.newArrayList(other.getValidSourceTypes()));
}
-
if (other.getCapabilitySources() == null) {
this.setCapabilitySources(Lists.newArrayList());
} else {
this.setCapabilitySources(Lists.newArrayList(other.getCapabilitySources()));
}
-
this.setOwnerId(other.getOwnerId());
this.setOwnerName(other.getOwnerName());
this.setOwnerType(other.getOwnerType());
this.setMinOccurrences(other.getMinOccurrences());
this.setMaxOccurrences(other.getMaxOccurrences());
this.setLeftOccurrences(other.getLeftOccurrences());
-
if (other.getPath() == null) {
this.setPath(Lists.newArrayList());
} else {
this.setPath(Lists.newArrayList(other.getPath()));
}
-
this.setSource(other.getSource());
this.setOwnerType(other.getOwnerType());
}
setPath(path);
}
-
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
-
String uniqueId = this.getUniqueId();
String description = this.getDescription();
String name = this.getName();
List<String> validSourceTypes = this.getValidSourceTypes();
List<String> capabilitySources = this.getCapabilitySources();
List<String> path = this.getPath();
-
String ownerId = this.getOwnerId();
String ownerName = this.getOwnerName();
String minOccurrences = this.getMinOccurrences();
String maxOccurrences = this.getMaxOccurrences();
String leftOccurrences = getLeftOccurrences();
String source = getSource();
-
result = prime * result + ((capabilitySources == null) ? 0 : capabilitySources.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode());
result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode());
-
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
result = prime * result + ((validSourceTypes == null) ? 0 : validSourceTypes.hashCode());
@Override
public boolean equals(Object obj) {
-
String uniqueId = this.getUniqueId();
String description = this.getDescription();
String name = this.getName();
String leftOccurrences = getLeftOccurrences();
List<String> path = this.getPath();
String source = getSource();
-
if (this == obj) {
return true;
}
String minOccurrences = this.getMinOccurrences();
String maxOccurrences = this.getMaxOccurrences();
String source = this.getSource();
-
- return "CapabilityDefinition [uniqueId=" + uniqueId + ", description=" + description + ", name=" + name
- + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources="
- + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName
- + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + source + "]";
+ return "CapabilityDefinition [uniqueId=" + uniqueId + ", description=" + description + ", name=" + name + ", type=" + type
+ + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" + capabilitySources + ", ownerId=" + ownerId + ", ownerName="
+ + ownerName + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + source + "]";
}
public enum OwnerType {
- GROUP("group"),
- COMPONENT_INSTANCE("component instance"),
- RESOURCE("resource");
-
+ GROUP("group"), COMPONENT_INSTANCE("component instance"), RESOURCE("resource");
private String value;
OwnerType(String value) {
public String getValue() {
return value;
}
-
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
String version = getVersion();
Long creationTime = getCreationTime();
Long modificationTime = getModificationTime();
-
- return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type
- + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime
- + ", modificationTime=" + modificationTime + "]";
+ return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes="
+ + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]";
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.ArrayList;
OriginTypeEnum originType = null;
String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE);
if (origType != null && !origType.isEmpty()) {
-
originType = OriginTypeEnum.findByValue(origType);
}
return originType;
@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() + "]";
+ 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() + "]";
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.HashMap;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.EqualsAndHashCode;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
public class DataTypeDataDefinition extends ToscaDataDefinition {
private String name;
-
private String uniqueId;
-
// "boolean", "string", "float", "integer", "version" })
private String derivedFromName;
-
private String description;
-
/**
* Timestamp of data type creation
*/
private Long creationTime;
-
/**
* Timestamp of the data type last update
*/
private Long modificationTime;
-
private List<PropertyDataDefinition> propertiesData;
public DataTypeDataDefinition(DataTypeDataDefinition p) {
this.creationTime = p.creationTime;
this.modificationTime = p.modificationTime;
}
-
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.DESCRIPTION;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
return false;
}
ForwardingPathElementDataDefinition that = (ForwardingPathElementDataDefinition) o;
- return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode())
- && Objects.equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId());
+ return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode()) && Objects
+ .equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId());
}
@Override
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("fromNode", getFromNode()).add("toNode", getToNode())
- .add("fromCPOriginId", getFromCPOriginId()).add("toCPOriginId", getToCPOriginId())
- .add("fromCPName", getFromCP()).add("toCPName", getToCP()).toString();
+ return MoreObjects.toStringHelper(this).add("fromNode", getFromNode()).add("toNode", getToNode()).add("fromCPOriginId", getFromCPOriginId())
+ .add("toCPOriginId", getToCPOriginId()).add("fromCPName", getFromCP()).add("toCPName", getToCP()).toString();
}
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.Map;
private String propName;
private String inputName;
-
@EqualsAndHashCode.Exclude
@ToString.Exclude
private String inputId;
-
private Integer indexValue;
private GetInputValueDataDefinition getInputIndex;
-
private boolean isList = false;
public GetInputValueDataDefinition(Map<String, Object> pr) {
this.setGetInputIndex(p.getGetInputIndex());
this.setList(p.isList());
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.Map;
this.setGetOutputIndex(p.getGetOutputIndex());
this.setList(p.isList());
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Setter;
-
@Getter
@Setter
@NoArgsConstructor
private String policyId;
private String propertyName;
private String origPropertyValue;
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import static java.util.Collections.emptyMap;
this.setGroupUUID(other.getGroupUUID());
this.setInvariantName(other.getInvariantName());
this.setCreatedFrom(other.getCreatedFrom());
-
if (other.getMembers() != null) {
this.setMembers(new HashMap<>(other.getMembers()));
}
if (other.getArtifacts() != null) {
this.setArtifacts(new ArrayList<>(other.getArtifacts()));
}
-
if (other.getArtifactsUuid() != null) {
this.setArtifactsUuid(new ArrayList<>(other.getArtifactsUuid()));
}
return members;
}
return emptyMap();
-
}
public List<String> getArtifacts() {
@Override
public String toString() {
return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()="
- + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()="
- + getVersion() + ", getInvariantUUID()=" + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()="
- + getPropertyValueCounter() + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()="
- + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" + getArtifactsUuid() + ", getClass()=" + getClass()
- + ", hashCode()=" + hashCode() + ", toString()="
- + super.toString() + "]";
+ + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()=" + getVersion() + ", getInvariantUUID()="
+ + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter()
+ + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()=" + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()="
+ + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]";
}
public boolean containsInstanceAsMember(String instanceId) {
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.ArrayList;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
private Map<String, String> metadata;
private String description;
private boolean highestVersion;
-
/**
* Timestamp of data type creation
*/
private Long creationTime;
-
/**
* Timestamp of the data type last update
*/
this.highestVersion = other.highestVersion;
this.derivedFrom = other.derivedFrom;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.EqualsAndHashCode;
public class HeatParameterDataDefinition extends ToscaDataDefinition {
private String uniqueId;
-
private String name;
private String type;
private String description;
-
private String currentValue;
private String defaultValue;
this.currentValue = hp.currentValue;
this.defaultValue = hp.defaultValue;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.Map;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.Getter;
this.name = name;
this.value = value;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.io.Serializable;
public class InterfaceInstanceDataDefinition extends ToscaDataDefinition implements Serializable {
- public InterfaceInstanceDataDefinition(
- InterfaceInstanceDataDefinition inter) {
+ public InterfaceInstanceDataDefinition(InterfaceInstanceDataDefinition inter) {
this.toscaPresentation = null;
setInputs(inter.getInputs() == null ? new HashMap<String, Object>() : new HashMap<>(inter.getInputs()));
setOperations(new HashMap<>(inter.getOperations()));
@Override
public int hashCode() {
-
return Objects.hash(this.getInputs());
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
public ListCapabilityDataDefinition(ListCapabilityDataDefinition cdt) {
super(cdt);
-
}
@JsonCreator
return listToscaDataDefinition;
}
-
public void setListToscaDataDefinition(List<CapabilityDataDefinition> listToscaDataDefinition) {
this.listToscaDataDefinition = listToscaDataDefinition;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
public ListDataDefinition(ListDataDefinition<T> cdt) {
listToscaDataDefinition = cdt.listToscaDataDefinition;
-
}
public ListDataDefinition(List<T> listToscaDataDefinition) {
public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
List<T> collect1 = (List<T>) listToscaDataDefinition.stream().filter(e -> ownerIdList.contains(e.getOwnerId())).collect(Collectors.toList());
ListDataDefinition listDef = new ListDataDefinition(collect1);
-
listToscaDataDefinition.removeIf(e -> ownerIdList.contains(e.getOwnerId()));
return (T) listDef;
}
@Override
public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
-
List<T> list = ((ListDataDefinition) other).getListToscaDataDefinition();
list.forEach(e -> {
String nameFromPrev = (String) e.getToscaPresentationValue(JsonPresentationFields.NAME);
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
public ListMapPropertiesDataDefinition(ListMapPropertiesDataDefinition cdt) {
super(cdt);
-
}
@JsonCreator
return listToscaDataDefinition;
}
-
public void setMapToscaDataDefinition(List<MapPropertiesDataDefinition> listToscaDataDefinition) {
this.listToscaDataDefinition = listToscaDataDefinition;
}
-
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
public ListRequirementDataDefinition(ListRequirementDataDefinition cdt) {
super(cdt);
-
}
@JsonCreator
return listToscaDataDefinition;
}
-
public void setListToscaDataDefinition(List<RequirementDataDefinition> listToscaDataDefinition) {
this.listToscaDataDefinition = listToscaDataDefinition;
}
-
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
return mapToscaDataDefinition;
}
-
public void setMapToscaDataDefinition(Map<String, ArtifactDataDefinition> mapToscaDataDefinition) {
this.mapToscaDataDefinition = mapToscaDataDefinition;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null
: new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition);
}
+
@JsonValue
@Override
public Map<String, AttributeDataDefinition> getMapToscaDataDefinition() {
public void setMapToscaDataDefinition(Map<String, AttributeDataDefinition> mapToscaDataDefinition) {
this.mapToscaDataDefinition = mapToscaDataDefinition;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Map;
public void setMapToscaDataDefinition(Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition) {
this.mapToscaDataDefinition = mapToscaDataDefinition;
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.ArrayList;
* @param ref to add
*/
public boolean addExternalRef(String objectType, String ref) {
-
List<String> refList = this.getExternalRefsByObjectType(objectType);
-
if (refList == null) {
//Create list if does not exist and add it to map
refList = new ArrayList<>();
this.getComponentInstanceExternalRefs().put(objectType, refList);
}
-
//Add reference to list if does not exist
if (!refList.contains(ref)) {
return refList.add(ref);
}
-
return false;
-
}
public boolean deleteExternalRef(String objectType, String ref) {
List<String> refList = this.getExternalRefsByObjectType(objectType);
-
if (refList != null) {
return refList.remove(ref);
} else {
public boolean replaceExternalRef(String objectType, String oldRef, String newRef) {
List<String> refList = this.getExternalRefsByObjectType(objectType);
-
if (refList != null && !refList.contains(newRef)) {
return Collections.replaceAll(refList, oldRef, newRef);
} else {
return false;
}
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
public MapDataDefinition(MapDataDefinition<T> cdt) {
super();
mapToscaDataDefinition = cdt.mapToscaDataDefinition;
-
}
@JsonCreator
if (null == mapToscaDataDefinition || uid == null) {
return null;
}
- Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e ->
- e.getValue().findUidMatch(uid))
- .findAny().orElse(null);
+ Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e -> e.getValue().findUidMatch(uid)).findAny().orElse(null);
if (null == entry) {
return null;
}
@Override
public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
if (mapToscaDataDefinition != null) {
- Map<String, T> collect = (Map<String, T>) mapToscaDataDefinition.entrySet()
- .stream()
+ Map<String, T> collect = (Map<String, T>) mapToscaDataDefinition.entrySet().stream()
.filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue)));
-
MapDataDefinition collectMap = new MapDataDefinition<>(collect);
-
mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId()));
return (T) collectMap;
}
@Override
public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
-
Map<String, T> map = ((MapDataDefinition) other).getMapToscaDataDefinition();
if (map != null) {
map.entrySet().forEach(e -> {
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Map;
return mapToscaDataDefinition;
}
-
public void setMapToscaDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) {
this.mapToscaDataDefinition = mapToscaDataDefinition;
}
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
public MapListCapabilityDataDefinition(MapListCapabilityDataDefinition cdt) {
super(cdt);
-
}
@JsonCreator
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
public MapListRequirementDataDefinition(MapListRequirementDataDefinition cdt) {
super(cdt);
-
}
@JsonCreator
}
}
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
public void setMapToscaDataDefinition(Map<String, PropertyDataDefinition> mapToscaDataDefinition) {
this.mapToscaDataDefinition = mapToscaDataDefinition;
}
-
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ASSOCIATION_TYPE;
}
public ListDataDefinition<OperationInputDefinition> getInputs() {
- return (ListDataDefinition<OperationInputDefinition>) getToscaPresentationValue(
- JsonPresentationFields.OPERATION_INPUTS);
+ return (ListDataDefinition<OperationInputDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUTS);
}
public void setInputs(ListDataDefinition<OperationInputDefinition> inputs) {
}
public ListDataDefinition<OperationOutputDefinition> getOutputs() {
- return (ListDataDefinition<OperationOutputDefinition>) getToscaPresentationValue(
- JsonPresentationFields.OPERATION_OUTPUTS);
+ return (ListDataDefinition<OperationOutputDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS);
}
public void setOutputs(ListDataDefinition<OperationOutputDefinition> outputs) {
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
private String primary;
private List<String> dependencies;
-
}
*/
package org.openecomp.sdc.be.datatypes.elements;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;
import lombok.Setter;
public void setLabel(String name) {
setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, name);
}
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.Map;
private OperationImplementation implementation;
private Map<String, Object> inputs;
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
public void setLabel(String name) {
setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, name);
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import static java.util.Collections.emptyList;
Map<PolicyTargetType, List<String>> targets = getTargets();
return targets == null || !targets.containsKey(targetType) ? emptyList() : targets.get(targetType);
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum PolicyTargetType {
-
- GROUPS("GROUPS"),
- COMPONENT_INSTANCES("COMPONENT_INSTANCES"),
- TYPE_DOES_NOT_EXIST("TYPE_DOES_NOT_EXIST");
-
+ GROUPS("GROUPS"), COMPONENT_INSTANCES("COMPONENT_INSTANCES"), TYPE_DOES_NOT_EXIST("TYPE_DOES_NOT_EXIST");
@Getter
private final String name;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
private List<String> targets;
private Map<String, String> metadata;
private String description;
-
/**
* Timestamp of data type creation
*/
private Long creationTime;
-
/**
* Timestamp of the data type last update
*/
@Override
public String toString() {
return "PolicyTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version="
- + version
- + ", targets=" + targets + ", metadata=" + metadata + ", description=" + description + ", creationTime="
- + creationTime + ", modificationTime=" + modificationTime + "]";
+ + version + ", targets=" + targets + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + creationTime
+ + ", modificationTime=" + modificationTime + "]";
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.ArrayList;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
public interface PropertiesOwner {
String getName();
String getNormalizedName();
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
private String label;
private Boolean immutable = Boolean.FALSE;
private Boolean mappedToComponentProperty = Boolean.TRUE;
-
private String inputPath;
private String status;
private String inputId;
private String propertyId;
private String parentPropertyType;
private String subPropertyInputPath;
-
private List<Annotation> annotations;
/**
* The resource id which this property belongs to
*/
private String parentUniqueId;
-
private List<GetInputValueDataDefinition> getInputValues;
-
private Boolean isDeclaredListInput = Boolean.FALSE;
-
private List<GetPolicyValueDataDefinition> getPolicyValues;
-
private List<String> propertyConstraints;
-
private Map<String, String> metadata;
public PropertyDataDefinition() {
if (schema != null) {
return schema.getProperty();
}
-
return null;
}
return immutable;
}
- public Boolean isMappedToComponentProperty() { return mappedToComponentProperty; }
+ public Boolean isMappedToComponentProperty() {
+ return mappedToComponentProperty;
+ }
public String getParentUniqueId() {
return getOwnerId();
@Override
public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) {
- if (this.getType() != null
- && this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE))
- && compareSchemaType(other)) {
+ if (this.getType() != null && this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(
+ other)) {
other.setOwnerId(getOwnerId());
- if (allowDefaultValueOverride
- && getDefaultValue() != null
- && !getDefaultValue().isEmpty()) {
+ if (allowDefaultValueOverride && getDefaultValue() != null && !getDefaultValue().isEmpty()) {
other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue());
}
return other;
if (this.annotations != null) {
annotationSet.addAll(this.annotations);
}
-
this.annotations = new ArrayList<>(annotationSet);
setToscaPresentationValue(JsonPresentationFields.ANNOTATIONS, this.annotations);
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonIgnore;
}
public String getToken(int tokenNumber) {
-
int index = tokenNumber - 1;
if (rule == null || index >= rule.size() || index < 0) {
return null;
}
-
return rule.get(index);
}
}
public boolean compareRule(PropertyRule comparedPropertyRule) {
-
if (comparedPropertyRule == null) {
return false;
}
-
List<String> comparedRule = comparedPropertyRule.getRule();
if (rule == null && comparedRule == null) {
return true;
}
-
if (rule != null && comparedRule != null) {
if (rule.size() != comparedRule.size()) {
return false;
} else {
return false;
}
-
}
public void replaceFirstToken(String token) {
-
if (rule != null && rule.size() > 0) {
rule.set(0, token);
}
-
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
public Long getCreationTime() {
return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME);
-
}
public void setCreationTime(Long creationTime) {
Boolean originUI = isOriginUI();
Long creationTime = getCreationTime();
Long modificationTime = getModificationTime();
-
return "RelationshipTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes="
- + validSourceTypes
- + ", version=" + version + ", originUI=" + originUI + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]";
+ + validSourceTypes + ", version=" + version + ", originUI=" + originUI + ", creationTime=" + creationTime + ", modificationTime="
+ + modificationTime + "]";
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import com.google.common.collect.Lists;
public static final String MIN_OCCURRENCES = "0";
public static final String MAX_OCCURRENCES = "UNBOUNDED";
public static final String MAX_DEFAULT_OCCURRENCES = "1";
-
@Getter
@Setter
public boolean external = false;
/**
* specify the capability type
*/
-
public String getCapability() {
return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY);
}
}
setPath(path);
}
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.io.Serializable;
public class RequirementNodeFilterCapabilityDataDefinition extends ToscaDataDefinition implements Serializable {
public ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> getProperties() {
- return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(
- JsonPresentationFields.PROPERTIES);
+ return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES);
}
public void setProperties(ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties) {
public class RequirementNodeFilterPropertyDataDefinition extends ToscaDataDefinition implements Serializable {
-
public List<String> getConstraints() {
return (List<String>) getToscaPresentationValue(JsonPresentationFields.PROPERTY_FILTER_CONSTRAINT);
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.io.Serializable;
public class RequirementSubstitutionFilterCapabilityDataDefinition extends ToscaDataDefinition implements Serializable {
public ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> getProperties() {
- return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(
- JsonPresentationFields.PROPERTIES);
+ return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES);
}
public void setProperties(final ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties) {
public class RequirementSubstitutionFilterPropertyDataDefinition extends ToscaDataDefinition implements Serializable {
-
public List<String> getConstraints() {
return (List<String>) getToscaPresentationValue(JsonPresentationFields.PROPERTY_FILTER_CONSTRAINT);
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
private Map<String, PropertyDataDefinition> properties;
private PropertyDataDefinition property;
- public SchemaDefinition(String derivedFrom, List<String> constraints,
- Map<String, PropertyDataDefinition> properties) {
+ public SchemaDefinition(String derivedFrom, List<String> constraints, Map<String, PropertyDataDefinition> properties) {
this.setDerivedFrom(derivedFrom);
this.setConstraints(constraints);
this.setProperties(properties);
-
}
public void addProperty(String key, PropertyDataDefinition property) {
@Override
public String toString() {
- return "SchemaDefinition [" + "derivedFrom='" + derivedFrom + ", constraints=" + constraints + ", properties="
- + properties + ", property=" + property + ']';
+ return "SchemaDefinition [" + "derivedFrom='" + derivedFrom + ", constraints=" + constraints + ", properties=" + properties + ", property="
+ + property + ']';
}
}
}
public ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition> getProperties() {
- return (ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition>) getToscaPresentationValue(
- JsonPresentationFields.PROPERTIES);
+ return (ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES);
}
public void setProperties(final ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition> properties) {
public void setID(final String name) {
setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, name);
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.Getter;
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.elements;
import lombok.Getter;
this.icon = other.icon;
this.type = other.type;
}
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum AssetTypeEnum {
RESOURCES("resources", "Resource"), SERVICES("services", "Service"), PRODUCTS("products", "Product");
-
private final String value;
private final String correspondingComponent;
return ComponentTypeEnum.findByValue(curr.correspondingComponent);
}
}
-
return ret;
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum ComponentFieldsEnum {
-
+ // @formatter:off
PROPERTIES("properties"),
INPUTS("inputs"),
OUTPUTS("outputs"),
SUBSTITUTION_FILTER("substitutionFilter"),
COMPONENT_INSTANCES_INTERFACES("componentInstancesInterfaces"),
DATA_TYPES("data_types");
+ // @formatter:on
private final String value;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum ComponentTypeEnum {
- RESOURCE("Resource"),
- SERVICE("Service"),
- RESOURCE_INSTANCE("Resource Instance"),
- PRODUCT("Product"),
- SERVICE_INSTANCE("Service Instance");
-
+ RESOURCE("Resource"), SERVICE("Service"), RESOURCE_INSTANCE("Resource Instance"), PRODUCT("Product"), SERVICE_INSTANCE("Service Instance");
// Those values cannot be another field in enum, because they are needed
+
// as constants for Swagger allowedValues param
public static final String RESOURCE_PARAM_NAME = "resources";
public static final String SERVICE_PARAM_NAME = "services";
if (type == null) {
return ret;
}
-
switch (type) {
case RESOURCE:
ret = RESOURCE_PARAM_NAME;
}
public NodeTypeEnum getNodeType() {
-
switch (this) {
case RESOURCE:
return NodeTypeEnum.Resource;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum ConnectionPointEnum {
-
CAPABILITY("capability"), REQUIREMENT("requirement");
-
private static List<ConnectionPointEnum> connectionPointEnums = Arrays.asList(values());
private final String data;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.Getter;
@Getter
-public enum CreatedFrom {
-
- UI,
- CSAR
-
-}
+public enum CreatedFrom {UI, CSAR}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.Getter;
@Getter
-public enum DeclarationTypeEnum {
- INPUT,
- OUTPUT,
- POLICY
-}
+public enum DeclarationTypeEnum {INPUT, OUTPUT, POLICY}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum EnvironmentStatusEnum {
- UNKNOWN("unknown"),
- IN_PROGRESS("in_progress"),
- FAILED("failed"),
- COMPLETED("completed");
-
+ UNKNOWN("unknown"), IN_PROGRESS("in_progress"), FAILED("failed"), COMPLETED("completed");
private final String name;
public static EnvironmentStatusEnum getByName(final String name) {
return UNKNOWN;
}
}
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum ExternalCategoryTypeEnum {
-
PARTNER_DOMAIN_SERVICE("Partner Domain Service", true);
-
private final String value;
private final boolean isAtomicType;
* @return
*/
public static boolean containsName(String type) {
-
for (ExternalCategoryTypeEnum e : ExternalCategoryTypeEnum.values()) {
if (e.getValue().equals(type)) {
return true;
* @return
*/
public static boolean containsIgnoreCase(String type) {
-
for (ExternalCategoryTypeEnum e : ExternalCategoryTypeEnum.values()) {
if (e.getValue().equalsIgnoreCase(type)) {
return true;
}
return false;
}
-
}
-
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import java.util.Arrays;
public enum FilterKeyEnum {
RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT(
"nameFragment");
-
private static final int NUMBER_OF_RESOURCES_FILTERED = 3;
private static final int NUMBER_OF_SERVICES_FILTERED = 4;
private final String name;
default:
return null;
}
-
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import java.util.ArrayList;
@AllArgsConstructor
@Getter
public enum GraphPropertyEnum {
-
+ // @formatter:off
// field name ,class type ,unique ,indexed
UNIQUE_ID("uid", String.class, true, true),
LABEL("nodeLabel", String.class, false, true),
DATA_TYPES("data_types", Map.class, false, false),
//Archive/Restore
- 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),
-
+ 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);
+ // @formatter:on
private final String property;
private final Class<?> clazz;
}
public static List<String> getAllProperties() {
-
List<String> arrayList = new ArrayList<>();
-
for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) {
arrayList.add(graphProperty.getProperty());
}
-
return arrayList;
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum GroupTypeEnum {
VF_MODULE("org.openecomp.groups.VfModule"), HEAT_STACK("org.openecomp.groups.HeatStack");
-
private final String groupTypeName;
-
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import java.util.stream.Stream;
@Getter
@AllArgsConstructor
public enum InstantiationTypes {
-
- A_LA_CARTE("A-la-carte"),
- MACRO("Macro");
-
+ A_LA_CARTE("A-la-carte"), MACRO("Macro");
private final String value;
/**
* @param type
* @return bool
*/
-
public static boolean containsName(String type) {
- return Stream.of(InstantiationTypes.values())
- .anyMatch(instType -> type.equals(instType.getValue()));
+ return Stream.of(InstantiationTypes.values()).anyMatch(instType -> type.equals(instType.getValue()));
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
@Getter
@ToString(onlyExplicitlyIncluded = true)
public enum JsonPresentationFields {
-
+ // @formatter:off
UNIQUE_ID("uniqueId", GraphPropertyEnum.UNIQUE_ID),
HIGHEST_VERSION("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION),
LIFECYCLE_STATE("lifecycleState", GraphPropertyEnum.STATE),
////Inputs
ANNOTATIONS("annotations", null),
-
////Artifact
ARTIFACT_TYPE("artifactType", null),
ARTIFACT_REF("artifactRef", null),
TOSCA_ID("tosca_id", null),
//Relation
- CAPABILTY_OWNER_ID("capabilityOwnerId", null),
- REQUIREMENT_OWNER_ID("requirementOwnerId", null),
- FROM_ID("fromId", null),
- TO_ID("toId", null),
- REQUIREMENT("requirement", null),
- ORIGIN_UI("originUI", null),
-
+ CAPABILTY_OWNER_ID("capabilityOwnerId", null), REQUIREMENT_OWNER_ID("requirementOwnerId", null), FROM_ID("fromId", null), TO_ID("toId",
+ null), REQUIREMENT("requirement", null), ORIGIN_UI("originUI", null),
//Groups
GROUP_INVARIANT_UUID("invariantUUID", null),
TARGETS("targets", null),
//External Refs
- EXTERNAL_REF("externalRef", null),
- CREATED_FROM("createdFrom", null),
-
+ EXTERNAL_REF("externalRef", null), CREATED_FROM("createdFrom", null),
//Archive
IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED),
ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME),
ATTRIBUTES("attributes", null),
TOSCA_DEFINITIONS_VERSION("tosca_definitions_version", null);
+ // @formatter:on
@ToString.Include
private final String presentation;
public String getPresentation() {
return presentation;
}
-
}
* Modifications copyright (c) 2019 Nokia
* ================================================================================
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import java.util.List;
public String getServiceFunction() {
return (String) properties.get(JsonPresentationFields.SERVICE_FUNCTION.getPresentation());
}
-
}
@Getter
@AllArgsConstructor
public enum MetadataKeyEnum {
- METADATA_KEYS("metadataKeys"),
- NAME("name"),
- MANDATORY("mandatory"),
- VALID_VALUES("validValues"),
- DEFAULT("default");
-
+ METADATA_KEYS("metadataKeys"), NAME("name"), MANDATORY("mandatory"), VALID_VALUES("validValues"), DEFAULT("default");
private final String name;
-
}
@Getter
@AllArgsConstructor
public enum NodeFilterConstraintType {
-
- PROPERTIES(NodeFilterConstraintType.PROPERTIES_PARAM_NAME),
- CAPABILITIES(NodeFilterConstraintType.CAPABILITIES_PARAM_NAME);
-
+ PROPERTIES(NodeFilterConstraintType.PROPERTIES_PARAM_NAME), CAPABILITIES(NodeFilterConstraintType.CAPABILITIES_PARAM_NAME);
// Those values are needed as constants for Swagger allowedValues param
public static final String PROPERTIES_PARAM_NAME = "properties";
public static final String CAPABILITIES_PARAM_NAME = "capabilities";
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum NodeTypeEnum {
+ // @formatter:off
User("user"),
Service("service"),
Resource("resource"),
GroupInstance("groupInstance"),
AnnotationType("annotationType"),
Component("component");
+ // @formatter:on
private final String name;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum OriginTypeEnum {
+ // @formatter:off
PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT, false),
SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE, false),
VF("VF", "VF (Virtual Function)", "resource instance", ComponentTypeEnum.RESOURCE, false),
CR("CR", "CR (Complex Resource)", "resource instance", ComponentTypeEnum.RESOURCE, false),
ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE, false),
ServiceSubstitution("Service Substitution", "Service Substitution", "service substitution", ComponentTypeEnum.RESOURCE, false);
+ // @formatter:on
private final String value;
private final String displayValue;
}
return ret;
}
-
}
* Modifications copyright (c) 2019 Nokia
* ================================================================================
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.AllArgsConstructor;
@Getter
@AllArgsConstructor
public enum PortMirroringEnum {
- CISCO_VENDOR_NAME("CISCO"),
- CISCO_VENDOR_MODEL_NUMBER("4500x");
-
+ CISCO_VENDOR_NAME("CISCO"), CISCO_VENDOR_MODEL_NUMBER("4500x");
private final String value;
-
}
* Modifications copyright (c) 2019 Nokia
* ================================================================================
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import lombok.Getter;
@Getter
-public enum PromoteVersionEnum {
-
- NONE,
- MINOR,
- MAJOR
-
-}
+public enum PromoteVersionEnum {NONE, MINOR, MAJOR}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.be.datatypes.enums;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum ResourceTypeEnum {
-
+ // @formatter:off
VFC("VFC"/* (Virtual Function Component)"*/, true),
VF("VF"/* (Virtual Function)" */, false),
+
CR("CR"/* (Complex Resource"*/, false),
CP("CP"/* (Connection Point)"*/, true),
+
PNF("PNF"/* (Physical Network Function)" */, false),
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),
//Generic VFC/VF/PNF/Service Type
ABSTRACT("Abstract", true),
SERVICE("Service"/*(Network Service)"*/, false);
+ // @formatter:on
private final String value;
private final boolean isAtomicType;
if (type == null) {
return null;
}
- return Arrays.stream(ResourceTypeEnum.values())
- .filter(resourceTypeEnum -> resourceTypeEnum.name().equalsIgnoreCase(type))
- .findFirst()
+ return Arrays.stream(ResourceTypeEnum.values()).filter(resourceTypeEnum -> resourceTypeEnum.name().equalsIgnoreCase(type)).findFirst()
.orElse(null);
}
if (type == null) {
return false;
}
- return Arrays.stream(ResourceTypeEnum.values())
- .anyMatch(resourceTypeEnum -> resourceTypeEnum.name().equals(type));
+ return Arrays.stream(ResourceTypeEnum.values()).anyMatch(resourceTypeEnum -> resourceTypeEnum.name().equals(type));
}
/**
if (type == null) {
return false;
}
- return Arrays.stream(ResourceTypeEnum.values())
- .anyMatch(resourceTypeEnum -> resourceTypeEnum.name().equalsIgnoreCase(type));
+ return Arrays.stream(ResourceTypeEnum.values()).anyMatch(resourceTypeEnum -> resourceTypeEnum.name().equalsIgnoreCase(type));
}
-
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.datatypes.tosca;
import com.fasterxml.jackson.annotation.JsonCreator;
toscaPresentation = art;
}
+ public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2) {
+ return mergeDataMaps(map1, map2, false);
+ }
+
+ // return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden)
+ public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2,
+ boolean allowDefaultValueOverride) {
+ for (Entry<String, T> entry : map2.entrySet()) {
+ map1.merge(entry.getKey(), entry.getValue(), (item1, item2) -> item1.mergeFunction(item2, allowDefaultValueOverride));
+ // validate merge success
+ if (!map1.containsKey(entry.getKey())) {
+ return Either.right(entry.getKey());
+ }
+ }
+ return Either.left(map1);
+ }
+
+ public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) {
+ return null == dataList ? new HashMap<>()
+ : dataList.stream().collect(Collectors.toMap(p -> (String) p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p));
+ }
+
+ public static <T extends ToscaDataDefinition> T removeAndCollectByOwnerId(T complexStructure, Set<String> ownerIdList) {
+ return complexStructure.removeByOwnerId(ownerIdList);
+ }
+
@JsonValue
public Object getToscaPresentationValue(JsonPresentationFields name) {
if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) {
}
public void setToscaPresentationValue(JsonPresentationFields name, Object value) {
- if(name !=null) {
+ if (name != null) {
if (toscaPresentation == null) {
toscaPresentation = new HashMap<>();
}
toscaPresentation.put(name.getPresentation(), value);
}
-
}
public void setOwnerIdIfEmpty(String ownerId) {
return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
}
- public String getVersion() {
- return (String) getToscaPresentationValue(JsonPresentationFields.VERSION);
- }
-
public void setType(String type) {
setToscaPresentationValue(JsonPresentationFields.TYPE, type);
}
- public void setOwnerId(String ownerId) {
- setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId);
+ public String getVersion() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.VERSION);
}
public String getOwnerId() {
return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID);
}
+ public void setOwnerId(String ownerId) {
+ setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId);
+ }
+
// default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2)
public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) {
other.setOwnerId(getOwnerId());
return other;
}
- public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2) {
- return mergeDataMaps(map1, map2, false);
- }
-
- // return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden)
- public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride) {
- for (Entry<String, T> entry : map2.entrySet()) {
- map1.merge(entry.getKey(), entry.getValue(), (item1, item2) -> item1.mergeFunction(item2, allowDefaultValueOverride));
- // validate merge success
- if (!map1.containsKey(entry.getKey())) {
- return Either.right(entry.getKey());
- }
- }
- return Either.left(map1);
- }
-
- public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) {
- return null == dataList ? new HashMap<>() : dataList.stream()
- .collect(Collectors.toMap(p -> (String) p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p));
- }
-
public boolean findUidMatch(String uid) {
return uid.equals(getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID));
-
}
public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
return (T) this;
}
- public static <T extends ToscaDataDefinition> T removeAndCollectByOwnerId(T complexStructure, Set<String> ownerIdList) {
- return complexStructure.removeByOwnerId(ownerIdList);
- }
-
public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
return other;
}
public boolean isEmpty() {
return false;
}
-
}
* 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.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.togglz;
import java.util.Arrays;
import org.togglz.core.context.FeatureContext;
public enum ToggleableFeature implements Feature {
- @Label("Default Feature")
- DEFAULT_FEATURE,
-
- @Label("Healing")
- HEALING;
+ @Label("Default Feature") DEFAULT_FEATURE, @Label("Healing") HEALING;
public static Feature getFeatureByName(String featureName) {
- return Arrays.stream(values()).
- filter(e -> e.name().equals(featureName))
- .findFirst()
- .orElse(null);
+ return Arrays.stream(values()).filter(e -> e.name().equals(featureName)).findFirst().orElse(null);
}
public boolean isActive() {
* 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.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.togglz;
+import java.io.File;
import org.togglz.core.Feature;
import org.togglz.core.manager.TogglzConfig;
import org.togglz.core.repository.StateRepository;
import org.togglz.core.user.SimpleFeatureUser;
import org.togglz.core.user.UserProvider;
-import java.io.File;
-
public class TogglzConfiguration implements TogglzConfig {
- private static final String TOGGLZ_FILE_LOCATION = "/tmp/features.properties";
+ private static final String TOGGLZ_FILE_LOCATION = "/tmp/features.properties";
- @Override
- public Class<? extends Feature> getFeatureClass() {
- return ToggleableFeature.class;
- }
+ @Override
+ public Class<? extends Feature> getFeatureClass() {
+ return ToggleableFeature.class;
+ }
- @Override
- public StateRepository getStateRepository() {
- return new FileBasedStateRepository(new File(TOGGLZ_FILE_LOCATION));
- }
+ @Override
+ public StateRepository getStateRepository() {
+ return new FileBasedStateRepository(new File(TOGGLZ_FILE_LOCATION));
+ }
- @Override
- public UserProvider getUserProvider() {
- return () -> new SimpleFeatureUser("admin", true);
- }
+ @Override
+ public UserProvider getUserProvider() {
+ return () -> new SimpleFeatureUser("admin", true);
+ }
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.utils;
import org.openecomp.sdc.common.api.Constants;
public class CommonBeUtils {
+
/**
* Compares two ASDC versions of a component. It's for internal usage, so the assumption is that the versions are in valid format.
*
* @param firstVersion - version in format major.minor or just major (e.g, 2.0 or 2)
* @param secondVersion - version in format major.minor or just major (e.g, 2.0 or 2)
- * @return Returns true iff:<br>
- * 1) first version's major number is higher than second's (e.g., firstVersion = 1.1, secondVersion = 0.3)<br>
- * 2) major version are equal, but first's minor version is higher than second's (e.g., firstVersion = 0.10, secondVersion = 0.9) <br>
+ * @return Returns true iff:<br> 1) first version's major number is higher than second's (e.g., firstVersion = 1.1, secondVersion = 0.3)<br> 2)
+ * major version are equal, but first's minor version is higher than second's (e.g., firstVersion = 0.10, secondVersion = 0.9) <br>
*/
public static boolean compareAsdcComponentVersions(String firstVersion, String secondVersion) {
String[] firstVersionNums = firstVersion.split("\\.");
}
}
-
/**
* Compares two version strings.
- *
- * Use this instead of String.compareTo() for a non-lexicographical
- * comparison that works for version strings. e.g. "1.10".compareTo("1.6").
+ * <p>
+ * Use this instead of String.compareTo() for a non-lexicographical comparison that works for version strings. e.g. "1.10".compareTo("1.6").
*
* @param str1 a string of ordinal numbers separated by decimal points.
* @param str2 a string of ordinal numbers separated by decimal points.
- * @return The result is a negative integer if str1 is _numerically_ less than str2.
- * The result is a positive integer if str1 is _numerically_ greater than str2.
- * The result is zero if the strings are _numerically_ equal.
+ * @return The result is a negative integer if str1 is _numerically_ less than str2. The result is a positive integer if str1 is _numerically_
+ * greater than str2. The result is zero if the strings are _numerically_ equal.
* @note It does not work if "1.10" is supposed to be equal to "1.10.0".
*/
public static int conformanceLevelCompare(String str1, String str2) {
return Integer.signum(diff);
}
// the strings are equal or one string is a substring of the other
+
// e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
return Integer.signum(vals1.length - vals2.length);
}
public static String generateToscaResourceName(String resourceType, String resourceSystemName) {
return Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + resourceType.toLowerCase() + "." + resourceSystemName;
}
-
}
*/
package org.openecomp.sdc.be.utils;
-import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import static java.util.Collections.emptyMap;
+import static java.util.stream.Collectors.toList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-
-import static java.util.Collections.emptyMap;
-import static java.util.stream.Collectors.toList;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
public class PropertyDefinitionUtils {
if (properties == null) {
return emptyMap();
}
- return properties.entrySet()
- .stream()
- .collect(Collectors.toMap(Map.Entry::getKey,
- entry -> filterGetInputProps(entry.getValue())));
+ return properties.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> filterGetInputProps(entry.getValue())));
}
private static <T extends PropertyDataDefinition> List<PropertyDataDefinition> filterGetInputProps(List<T> propDefinitions) {
- return propDefinitions
- .stream()
- .filter(PropertyDataDefinition::isGetInputProperty)
- .collect(Collectors.toList());
+ return propDefinitions.stream().filter(PropertyDataDefinition::isGetInputProperty).collect(Collectors.toList());
}
}
@Getter
@AllArgsConstructor
public enum ToscaTagNamesEnum {
+ // @formatter:off
DERIVED_FROM("derived_from"), IS_PASSWORD("is_password"),
// Properties
PROPERTIES("properties"), TYPE("type"), STATUS("status"),
// Heat env Validation
PARAMETERS("parameters"),
// Import Validations
- TOSCA_VERSION("tosca_definitions_version"), TOPOLOGY_TEMPLATE("topology_template"), OCCURRENCES("occurrences"), NODE_TEMPLATES("node_templates"), GROUPS("groups"), INPUTS("inputs"),
+ TOSCA_VERSION("tosca_definitions_version"), TOPOLOGY_TEMPLATE("topology_template"), OCCURRENCES("occurrences"), NODE_TEMPLATES(
+ "node_templates"), GROUPS("groups"), INPUTS("inputs"),
SUBSTITUTION_MAPPINGS("substitution_mappings"), NODE_TYPE("node_type"), DIRECTIVES("directives"),
// Attributes
ATTRIBUTES("attributes"), LABEL("label"), HIDDEN("hidden"), IMMUTABLE("immutable"), ANNOTATIONS("annotations"),
IMPLEMENTATION("implementation"),
DERIVED_FROM_NAME("derivedFromName");
+ // @formatter:om
private final String elementName;