diff options
Diffstat (limited to 'catalog-model/src/main/java/org/openecomp')
11 files changed, 8 insertions, 287 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/CapabilityTypeDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/CapabilityTypeDefinition.java index f7627e76df..c15d1541d0 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/CapabilityTypeDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/CapabilityTypeDefinition.java @@ -28,7 +28,6 @@ import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; import org.openecomp.sdc.be.resources.data.CapabilityTypeData; import java.util.Map; -import java.util.stream.Collectors; /** * Specifies the capabilities that the Node Type exposes. @@ -47,14 +46,6 @@ public class CapabilityTypeDefinition extends CapabilityTypeDataDefinition { public CapabilityTypeDefinition(CapabilityTypeDataDefinition p) { super(p); } - - public CapabilityTypeDefinition(CapabilityDefinition cp) { - this.setUniqueId(cp.getUniqueId()); - this.setDescription ( cp.getDescription()); - this.setType(cp.getType()); - this.setValidSourceTypes( cp.getValidSourceTypes()); - this.setProperties(cp.getProperties().stream().collect(Collectors.toMap(ComponentInstanceProperty::getName, PropertyDefinition::new))); - } public CapabilityTypeDefinition(CapabilityTypeData ctd) { this.setUniqueId(ctd.getUniqueId()); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Combination.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Combination.java index b38e2ff04a..0ea79d975c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Combination.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Combination.java @@ -22,8 +22,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import java.util.List; import java.util.Map; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.ui.model.UiCombination; +@Getter +@Setter @JsonInclude(JsonInclude.Include.NON_NULL) public class Combination { @@ -36,75 +40,10 @@ public class Combination { private Map<String, List<ComponentInstanceProperty>> componentInstancesProperties; private Map<String, List<ComponentInstanceProperty>> componentInstancesAttributes; - public Combination() { - } // To form the combination object with the data received from UI public Combination(UiCombination UICombination) { name = UICombination.getName(); description = UICombination.getDescription(); } - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDesc() { - return description; - } - - public void setDesc(String description) { - this.description = description; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public List<ComponentInstance> getComponentInstances() { - return componentInstances; - } - - public void setComponentInstances(List<ComponentInstance> componentInstances) { - this.componentInstances = componentInstances; - } - - public List<RequirementCapabilityRelDef> getComponentInstancesRelations() { - return componentInstancesRelations; - } - - public void setComponentInstancesRelations(List<RequirementCapabilityRelDef> componentInstancesRelations) { - this.componentInstancesRelations = componentInstancesRelations; - } - - public Map<String, List<ComponentInstanceInput>> getComponentInstancesInputs() { - return componentInstancesInputs; - } - - public void setComponentInstancesInputs(Map<String, List<ComponentInstanceInput>> componentInstancesInputs) { - this.componentInstancesInputs = componentInstancesInputs; - } - - public Map<String, List<ComponentInstanceProperty>> getComponentInstancesProperties() { - return componentInstancesProperties; - } - - public void setComponentInstancesProperties(Map<String, List<ComponentInstanceProperty>> componentInstancesProperties) { - this.componentInstancesProperties = componentInstancesProperties; - } - - public Map<String, List<ComponentInstanceProperty>> getComponentInstancesAttributes() { - return componentInstancesAttributes; - } - - public void setComponentInstancesAttributes(Map<String, List<ComponentInstanceProperty>> componentInstancesAttributes) { - this.componentInstancesAttributes = componentInstancesAttributes; - } -}
\ No newline at end of file +} diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java index 30e76a8b79..baf1d22cb2 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java @@ -376,12 +376,6 @@ public class ArtifactsOperations extends BaseOperation { } } - // @TODO add implementation - - public Either<Map<String, ArtifactDefinition>, StorageOperationStatus> getArtifacts(String parentId, NodeTypeEnum parentType) { - return null; - } - public Either<ArtifactDefinition, StorageOperationStatus> addHeatEnvArtifact(ArtifactDefinition artifactHeatEnv, ArtifactDefinition artifactHeat, Component component, NodeTypeEnum parentType, boolean failIfExist, String instanceId) { artifactHeatEnv.setGeneratedFromId(artifactHeat.getUniqueId()); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java index 9e12e6e67d..1f2ef528cf 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java @@ -291,7 +291,6 @@ public abstract class BaseOperation { } protected Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex, EdgeLabelEnum label) { -// healingPipelineDao.setHealingVersion(dataVertex); Iterator<Edge> edges = dataVertex.getVertex().edges(Direction.IN, label.name()); int edgeCount = 0; Edge edgeToRemove = null; @@ -387,45 +386,6 @@ public abstract class BaseOperation { } /** - * Adds tosca data deep element to tosca element according received labels - * - * @param toscaElement - * @param edgeLabel - * @param vertexLabel - * @param toscaData - * @param pathKeys - * @param mapKeyField - * @return - */ - public <T extends ToscaDataDefinition> StorageOperationStatus addToscaDataDeepElementToToscaElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, T toscaData, List<String> pathKeys, - JsonPresentationFields mapKeyField) { - - List<T> toscaDataList = new ArrayList<>(); - toscaDataList.add(toscaData); - return addToscaDataDeepElementsToToscaElement(toscaElement, edgeLabel, vertexLabel, toscaDataList, pathKeys, mapKeyField); - } - - /** - * Converts recieved map of tosca data deep elements to list and adds it to tosca element according received labels - * - * @param toscaElement - * @param edgeLabel - * @param vertexLabel - * @param toscaDataMap - * @param pathKeys - * @param mapKeyField - * @return - */ - public <T extends ToscaDataDefinition> StorageOperationStatus addToscaDataDeepElementsToToscaElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel, Map<String, T> toscaDataMap, List<String> pathKeys, - JsonPresentationFields mapKeyField) { - - if (toscaDataMap != null) { - return addToscaDataDeepElementsToToscaElement(toscaElement, edgeLabel, vertexLabel, toscaDataMap.values().stream().collect(Collectors.toList()), pathKeys, mapKeyField); - } - return StorageOperationStatus.OK; - } - - /** * Adds list of tosca data deep elements to tosca element according received labels * * @param toscaElement diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java index 40fe5c8b4f..62f85e6b5f 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java @@ -197,10 +197,6 @@ public abstract class AbstractOperation { return value == null; } - public boolean isNullParam(String value) { - return value == null; - } - protected StorageOperationStatus validateAndUpdateComplexValue(IComplexDefaultValue propertyDefinition, String propertyType, String value, DataTypeDefinition dataTypeDefinition, Map<String, DataTypeDefinition> dataTypes) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java index f64f761873..102e896c38 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java @@ -77,22 +77,6 @@ public class ArtifactOperation { super(); } - public JanusGraphGenericDao getJanusGraphGenericDao() { - return janusGraphGenericDao; - } - - public void setJanusGraphGenericDao(JanusGraphGenericDao janusGraphGenericDao) { - this.janusGraphGenericDao = janusGraphGenericDao; - } - - public HeatParametersOperation getHeatParametersOperation() { - return heatParametersOperation; - } - - public void setHeatParametersOperation(HeatParametersOperation heatParametersOperation) { - this.heatParametersOperation = heatParametersOperation; - } - public Either<ArtifactDefinition, StorageOperationStatus> addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, boolean inTransaction) { Either<ArtifactData, StorageOperationStatus> status = addArtifactToGraph(artifactInfo, parentId, type, failIfExist); @@ -117,79 +101,6 @@ public class ArtifactOperation { } - public StorageOperationStatus addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, JanusGraphVertex parentVertex) { - - StorageOperationStatus status = addArtifactToGraph(artifactInfo, parentId, type, failIfExist, parentVertex); - - if (status.equals(StorageOperationStatus.OK)) { - log.debug("Failed to add artifact {} {} to {}", artifactInfo.getArtifactName(), type, parentId); - } - return status; - } - - private StorageOperationStatus addArtifactToGraph(ArtifactDefinition artifactInfo, String id, NodeTypeEnum type, boolean failIfexist, JanusGraphVertex parentVertex) { - - if (artifactInfo.getUniqueId() == null || artifactInfo.getUniqueId().isEmpty()) { - String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(id, artifactInfo.getArtifactLabel()); - artifactInfo.setUniqueId(uniqueId); - } - - if (!validateParentType(type)) { - return StorageOperationStatus.GENERAL_ERROR; - } - - ArtifactData artifactData = new ArtifactData(artifactInfo); - - Either<JanusGraphVertex, JanusGraphOperationStatus> existArtifact = janusGraphGenericDao - .getVertexByProperty(artifactData.getUniqueIdKey(), artifactData.getUniqueId()); - if (existArtifact.isRight()) { - if (existArtifact.right().value().equals(JanusGraphOperationStatus.NOT_FOUND)) { - // create new node - log.debug("Before adding artifact to graph {}", artifactData); - if (artifactData.getArtifactDataDefinition().getArtifactUUID() == null || artifactData.getArtifactDataDefinition().getArtifactUUID().isEmpty()) - updateUUID(artifactData.getArtifactDataDefinition(), null, artifactData.getArtifactDataDefinition().getArtifactVersion()); - Either<JanusGraphVertex, JanusGraphOperationStatus> createNodeResult = janusGraphGenericDao.createNode(artifactData); - - if (createNodeResult.isRight()) { - JanusGraphOperationStatus operationStatus = createNodeResult.right().value(); - log.debug("Failed to add artifact {} to graph. status is {}", artifactData.getArtifactDataDefinition().getArtifactName(), operationStatus); - BeEcompErrorManager.getInstance().logBeFailedCreateNodeError("Add artifact", artifactData.getArtifactDataDefinition().getArtifactName(), String.valueOf(operationStatus)); - return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(operationStatus); - } - - // add heat parameters - if (artifactInfo.getHeatParameters() != null && !artifactInfo.getHeatParameters().isEmpty() && !artifactInfo.getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.getType())) { - StorageOperationStatus addPropertiesStatus = heatParametersOperation.addPropertiesToGraph(artifactInfo.getListHeatParameters(), artifactData.getUniqueId().toString(), NodeTypeEnum.ArtifactRef); - if (addPropertiesStatus != StorageOperationStatus.OK) { - log.debug("Failed to create heat parameters on graph for artifact {}", artifactInfo.getArtifactName()); - return addPropertiesStatus; - } - } - - } else { - log.debug("Failed to check existance of artifact in graph for id {}", artifactData.getUniqueId()); - return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(existArtifact.right().value()); - } - } else if (failIfexist) { - log.debug("Artifact {} already exist", artifactData.getUniqueId()); - return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ALREADY_EXIST); - } - - // save logical artifact ref name on edge as property - Map<String, Object> properties = new HashMap<>(); - properties.put(GraphEdgePropertiesDictionary.NAME.getProperty(), artifactInfo.getArtifactLabel()); - if (artifactInfo.getArtifactGroupType() != null) - properties.put(GraphEdgePropertiesDictionary.GROUP_TYPE.getProperty(), artifactInfo.getArtifactGroupType().getType()); - JanusGraphOperationStatus relation = janusGraphGenericDao - .createEdge(parentVertex, artifactData, GraphEdgeLabels.ARTIFACT_REF, properties); - if (!relation.equals(JanusGraphOperationStatus.OK)) { - log.debug("Failed to create relation in graph for id {} to new artifact", id); - return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(relation); - } - - return StorageOperationStatus.OK; - } - private Either<ArtifactData, StorageOperationStatus> addArtifactToGraph(ArtifactDefinition artifactInfo, String id, NodeTypeEnum type, boolean failIfexist) { if (artifactInfo.getUniqueId() == null || artifactInfo.getUniqueId().isEmpty()) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java index ed635d1a0a..9ee085342e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityOperation.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.be.model.operations.impl; import static org.springframework.util.CollectionUtils.isEmpty; -import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import fj.data.Either; import java.util.ArrayList; @@ -36,7 +35,6 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; -import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary; @@ -68,12 +66,7 @@ public class CapabilityOperation extends AbstractOperation { this.capabilityTypeOperation = capabilityTypeOperation; this.propertyOperation = propertyOperation; } - - - @VisibleForTesting - public void setJanusGraphGenericDao(HealingJanusGraphGenericDao janusGraphGenericDao) { - this.janusGraphGenericDao = janusGraphGenericDao; - } + public Either<CapabilityData, JanusGraphOperationStatus> addCapabilityToGraph(String resourceId, CapabilityTypeData capTypeData, CapabilityDefinition capabilityDefinition) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java index af8a68f410..0e88d6b081 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java @@ -40,17 +40,6 @@ public class CsarOperation { @javax.annotation.Resource private OnboardingClient onboardingClient; - public static void main(String[] args) { - - CsarOperation csarOperation = new CsarOperation(); - csarOperation.init(); - - String csarUuid = "70025CF6081B489CA7B1CBA583D5278D"; - Either<Map<String, byte[]>, StorageOperationStatus> csar = csarOperation.getCsar(csarUuid, null); - System.out.println(csar.left().value()); - - } - @PostConstruct public void init() { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OnboardingClient.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OnboardingClient.java index ed0b43e38e..5aabc6402e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OnboardingClient.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OnboardingClient.java @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.model.operations.impl; import fj.data.Either; import java.util.Map; import java.util.Properties; +import lombok.NoArgsConstructor; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.config.Configuration.OnboardingConfig; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -33,6 +34,7 @@ import org.openecomp.sdc.common.http.client.api.HttpResponse; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.zip.ZipUtils; +@NoArgsConstructor @org.springframework.stereotype.Component("onboarding-client") public class OnboardingClient { @@ -44,20 +46,6 @@ public class OnboardingClient { downloadCsarHeaders.put("Accept", "application/octet-stream"); } - public OnboardingClient() { - super(); - } - - public static void main(String[] args) { - - OnboardingClient csarOperation = new OnboardingClient(); - - String csarUuid = "70025CF6081B489CA7B1CBA583D5278D"; - Either<Map<String, byte[]>, StorageOperationStatus> csar = csarOperation.getCsar(csarUuid, null); - System.out.println(csar.left().value()); - - } - public Either<Map<String, byte[]>, StorageOperationStatus> getCsar(String csarUuid, String userId) { String url = buildDownloadCsarUrl() + "/" + csarUuid; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java index 419adb8b70..f626c1d629 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java @@ -118,21 +118,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe private static final String PROPERTY = "Property"; private static final String UPDATE_DATA_TYPE = "UpdateDataType"; - public static void main(String[] args) { - - List<Pattern> buildFunctionPatterns = buildFunctionPatterns(); - - for (Pattern pattern : buildFunctionPatterns) { - - String[] strs = { "str_replace", "{ str_replace:", " {str_replace:", " { str_replace:", "{str_replace:" }; - for (String str : strs) { - Matcher m = pattern.matcher(str); - System.out.println(pattern.pattern() + " " + str + " " + m.find()); - } - } - - } - @Autowired public PropertyOperation(HealingJanusGraphGenericDao janusGraphGenericDao, DerivedFromOperation derivedFromOperation) { this.janusGraphGenericDao = janusGraphGenericDao; @@ -141,27 +126,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe private static Logger log = Logger.getLogger(PropertyOperation.class.getName()); - /** - * The value of functions is in a json format. Build pattern for each function name - * - * { str_replace: .... } {str_replace: .... } {str_replace: .... } { str_replace: .... } - * - * @return - */ - private static List<Pattern> buildFunctionPatterns() { - - List<Pattern> functionPatterns = new ArrayList<>(); - - String[] functions = { "get_input", "get_property" }; - - for (String function : functions) { - Pattern pattern = Pattern.compile("^[ ]*\\{[ ]*" + function + ":"); - functionPatterns.add(pattern); - } - - return functionPatterns; - } - public PropertyDefinition convertPropertyDataToPropertyDefinition(PropertyData propertyDataResult, String propertyName, String resourceId) { log.debug("The object returned after create property is {}", propertyDataResult); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/version/ApplicationVersionException.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/version/ApplicationVersionException.java index 9dca0389f7..58037192f7 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/version/ApplicationVersionException.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/version/ApplicationVersionException.java @@ -24,10 +24,6 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.TechnicalException public class ApplicationVersionException extends TechnicalException { - public ApplicationVersionException(String message, Throwable cause) { - super(message, cause); - } - public ApplicationVersionException(String message) { super(message); } |