aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src/main/java/org')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java39
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java69
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java23
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AbstractOperation.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java7
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java14
10 files changed, 53 insertions, 135 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
index 7d53abfe21..facbcbe2a4 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
@@ -1107,10 +1107,8 @@ public class NodeTemplateOperation extends BaseOperation {
}
private void setArtifactPlaceholderCommonFields(String resourceId, User user, ArtifactDataDefinition artifactInfo) {
- String uniqueId = null;
-
if (resourceId != null) {
- uniqueId = UniqueIdBuilder.buildPropertyUniqueId(resourceId.toLowerCase(), artifactInfo.getArtifactLabel().toLowerCase());
+ String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(resourceId.toLowerCase(), artifactInfo.getArtifactLabel().toLowerCase());
artifactInfo.setUniqueId(uniqueId);
}
artifactInfo.setUserIdCreator(user.getUserId());
@@ -1175,9 +1173,7 @@ public class NodeTemplateOperation extends BaseOperation {
}
}
MapListRequirementDataDefinition fullCalculatedReq = new MapListRequirementDataDefinition();
- status = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.FULLFILLED_REQUIREMENTS, VertexTypeEnum.FULLFILLED_REQUIREMENTS, fullCalculatedReq, componentInstance.getUniqueId());
- return StorageOperationStatus.OK;
-
+ return addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.FULLFILLED_REQUIREMENTS, VertexTypeEnum.FULLFILLED_REQUIREMENTS, fullCalculatedReq, componentInstance.getUniqueId());
}
public static String createCapPropertyKey(String key, String instanceId) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
index 43b74870e9..80570e0869 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
@@ -77,8 +77,6 @@ public class NodeTypeOperation extends ToscaElementOperation {
public Either<NodeType, StorageOperationStatus> createNodeType(NodeType nodeType) {
- Either<NodeType, StorageOperationStatus> result = null;
-
nodeType.generateUUID();
nodeType = getResourceMetaDataFromResource(nodeType);
@@ -92,8 +90,7 @@ public class NodeTypeOperation extends ToscaElementOperation {
List<GraphVertex> derivedResources = null;
Either<List<GraphVertex>, StorageOperationStatus> derivedResourcesResult = findDerivedResources(nodeType);
if (derivedResourcesResult.isRight()) {
- result = Either.right(derivedResourcesResult.right().value());
- return result;
+ return Either.right(derivedResourcesResult.right().value());
} else {
derivedResources = derivedResourcesResult.left().value();
}
@@ -105,65 +102,53 @@ public class NodeTypeOperation extends ToscaElementOperation {
if (createdVertex.isRight()) {
JanusGraphOperationStatus status = createdVertex.right().value();
log.error("Error returned after creating resource data node {}. status returned is ", nodeTypeVertex, status);
- result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
- return result;
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
nodeTypeVertex = createdVertex.left().value();
StorageOperationStatus assosiateCommon = assosiateCommonForToscaElement(nodeTypeVertex, nodeType, derivedResources);
if (assosiateCommon != StorageOperationStatus.OK) {
- result = Either.right(assosiateCommon);
- return result;
+ return Either.right(assosiateCommon);
}
StorageOperationStatus associateDerived = assosiateToDerived(nodeTypeVertex, derivedResources);
if (associateDerived != StorageOperationStatus.OK) {
- result = Either.right(associateDerived);
- return result;
+ return Either.right(associateDerived);
}
StorageOperationStatus associateCategory = assosiateResourceMetadataToCategory(nodeTypeVertex, nodeType);
if (associateCategory != StorageOperationStatus.OK) {
- result = Either.right(associateCategory);
- return result;
+ return Either.right(associateCategory);
}
StorageOperationStatus associateAttributes = associateAttributesToResource(nodeTypeVertex, nodeType, derivedResources);
if (associateAttributes != StorageOperationStatus.OK) {
- result = Either.right(associateAttributes);
- return result;
+ return Either.right(associateAttributes);
}
StorageOperationStatus associateRequirements = associateRequirementsToResource(nodeTypeVertex, nodeType, derivedResources);
if (associateRequirements != StorageOperationStatus.OK) {
- result = Either.right(associateRequirements);
- return result;
+ return Either.right(associateRequirements);
}
StorageOperationStatus associateCapabilities = associateCapabilitiesToResource(nodeTypeVertex, nodeType, derivedResources);
if (associateCapabilities != StorageOperationStatus.OK) {
- result = Either.right(associateCapabilities);
- return result;
+ return Either.right(associateCapabilities);
}
StorageOperationStatus associateCapabilitiesProps = associateCapabilitiesPropertiesToResource(nodeTypeVertex, nodeType, derivedResources);
if (associateCapabilitiesProps != StorageOperationStatus.OK) {
- result = Either.right(associateCapabilitiesProps);
- return result;
+ return Either.right(associateCapabilitiesProps);
}
StorageOperationStatus associateInterfaces = associateInterfacesToResource(nodeTypeVertex, nodeType, derivedResources);
if (associateInterfaces != StorageOperationStatus.OK) {
- result = Either.right(associateInterfaces);
- return result;
+ return Either.right(associateInterfaces);
}
StorageOperationStatus addAdditionalInformation = addAdditionalInformationToResource(nodeTypeVertex, nodeType, derivedResources);
if (addAdditionalInformation != StorageOperationStatus.OK) {
- result = Either.right(addAdditionalInformation);
- return result;
+ return Either.right(addAdditionalInformation);
}
- result = Either.left(nodeType);
- return result;
-
+ return Either.left(nodeType);
}
private StorageOperationStatus associateInterfacesToResource(GraphVertex nodeTypeVertex, NodeType nodeType, List<GraphVertex> derivedResources) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
index 76f952b4c4..92e10a955f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
@@ -23,13 +23,9 @@ package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import com.google.gson.reflect.TypeToken;
import fj.data.Either;
import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.Optional;
+import java.util.function.BiFunction;
import java.util.stream.Collectors;
import org.apache.commons.collections.MapUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -99,14 +95,11 @@ import org.springframework.beans.factory.annotation.Autowired;
public class TopologyTemplateOperation extends ToscaElementOperation {
private static final Logger log = Logger.getLogger(TopologyTemplateOperation.class);
- private static final String PATH_DELIMITER = ".";
@Autowired
private ArchiveOperation archiveOperation;
public Either<TopologyTemplate, StorageOperationStatus> createTopologyTemplate(TopologyTemplate topologyTemplate) {
- Either<TopologyTemplate, StorageOperationStatus> result = null;
-
topologyTemplate.generateUUID();
topologyTemplate = getResourceMetaDataFromResource(topologyTemplate);
@@ -123,104 +116,82 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
if (createdVertex.isRight()) {
JanusGraphOperationStatus status = createdVertex.right().value();
log.debug( "Error returned after creating topology template data node {}. status returned is ", topologyTemplateVertex, status);
- result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
- return result;
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
- topologyTemplateVertex = createdVertex.left().value();
-
- StorageOperationStatus assosiateCommon = assosiateCommonForToscaElement(topologyTemplateVertex, topologyTemplate, null);
+ StorageOperationStatus assosiateCommon = assosiateCommonForToscaElement(topologyTemplateVertex, topologyTemplate);
if (assosiateCommon != StorageOperationStatus.OK) {
- result = Either.right(assosiateCommon);
- return result;
+ return Either.right(assosiateCommon);
}
StorageOperationStatus associateCategory = assosiateMetadataToCategory(topologyTemplateVertex, topologyTemplate);
if (associateCategory != StorageOperationStatus.OK) {
- result = Either.right(associateCategory);
- return result;
+ return Either.right(associateCategory);
}
StorageOperationStatus associateInputs = associateInputsToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInputs != StorageOperationStatus.OK) {
- result = Either.right(associateInputs);
- return result;
+ return Either.right(associateInputs);
}
StorageOperationStatus associateGroups = associateGroupsToComponent(topologyTemplateVertex, topologyTemplate);
if (associateGroups != StorageOperationStatus.OK) {
- result = Either.right(associateGroups);
- return result;
+ return Either.right(associateGroups);
}
StorageOperationStatus associatePolicies = associatePoliciesToComponent(topologyTemplateVertex, topologyTemplate);
if (associatePolicies != StorageOperationStatus.OK) {
- result = Either.right(associatePolicies);
- return result;
+ return Either.right(associatePolicies);
}
StorageOperationStatus associateInstAttr = associateInstAttributesToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInstAttr != StorageOperationStatus.OK) {
- result = Either.right(associateInstAttr);
- return result;
+ return Either.right(associateInstAttr);
}
StorageOperationStatus associateInstProperties = associateInstPropertiesToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInstProperties != StorageOperationStatus.OK) {
- result = Either.right(associateInstProperties);
- return result;
+ return Either.right(associateInstProperties);
}
StorageOperationStatus associateInstInputs = associateInstInputsToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInstProperties != StorageOperationStatus.OK) {
- result = Either.right(associateInstInputs);
- return result;
+ return Either.right(associateInstInputs);
}
StorageOperationStatus associateInstGroups = associateInstGroupsToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInstGroups != StorageOperationStatus.OK) {
- result = Either.right(associateInstInputs);
- return result;
+ return Either.right(associateInstInputs);
}
StorageOperationStatus associateRequirements = associateRequirementsToResource(topologyTemplateVertex, topologyTemplate);
if (associateRequirements != StorageOperationStatus.OK) {
- result = Either.right(associateRequirements);
- return result;
+ return Either.right(associateRequirements);
}
StorageOperationStatus associateCapabilities = associateCapabilitiesToResource(topologyTemplateVertex, topologyTemplate);
if (associateCapabilities != StorageOperationStatus.OK) {
- result = Either.right(associateCapabilities);
- return result;
+ return Either.right(associateCapabilities);
}
StorageOperationStatus associateArtifacts = associateTopologyTemplateArtifactsToComponent(topologyTemplateVertex, topologyTemplate);
if (associateArtifacts != StorageOperationStatus.OK) {
- result = Either.right(associateArtifacts);
- return result;
+ return Either.right(associateArtifacts);
}
StorageOperationStatus addAdditionalInformation = addAdditionalInformationToResource(topologyTemplateVertex, topologyTemplate);
if (addAdditionalInformation != StorageOperationStatus.OK) {
- result = Either.right(addAdditionalInformation);
- return result;
+ return Either.right(addAdditionalInformation);
}
StorageOperationStatus associateCapProperties = associateCapPropertiesToResource(topologyTemplateVertex, topologyTemplate);
if (associateCapProperties != StorageOperationStatus.OK) {
- result = Either.right(associateCapProperties);
- return result;
+ return Either.right(associateCapProperties);
}
StorageOperationStatus associateInterfaces = associateInterfacesToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInterfaces != StorageOperationStatus.OK) {
- result = Either.right(associateInterfaces);
- return result;
+ return Either.right(associateInterfaces);
}
StorageOperationStatus associatePathProperties = associateForwardingPathToResource(topologyTemplateVertex, topologyTemplate);
if (associateCapProperties != StorageOperationStatus.OK) {
- result = Either.right(associatePathProperties);
- return result;
+ return Either.right(associatePathProperties);
}
-
-
return Either.left(topologyTemplate);
-
}
private StorageOperationStatus associatePoliciesToComponent(GraphVertex nodeTypeVertex, TopologyTemplate topologyTemplate) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
index b7cc2c8bd6..a2b1f89667 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
@@ -169,14 +169,12 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
* @return
*/
public Either<User, StorageOperationStatus> getToscaElementOwner(GraphVertex toscaElement) {
- Either<User, StorageOperationStatus> result = null;
Iterator<Vertex> vertices = toscaElement.getVertex().vertices(Direction.IN, EdgeLabelEnum.STATE.name());
if (vertices == null || !vertices.hasNext()) {
- result = Either.right(StorageOperationStatus.NOT_FOUND);
+ return Either.right(StorageOperationStatus.NOT_FOUND);
} else {
- result = Either.left(convertToUser(vertices.next()));
+ return Either.left(convertToUser(vertices.next()));
}
- return result;
}
/**
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index 3ae39fdc4a..637c91324e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -134,15 +134,10 @@ public abstract class ToscaElementOperation extends BaseOperation {
}
public Either<GraphVertex, StorageOperationStatus> markComponentToDelete(GraphVertex componentToDelete) {
- Either<GraphVertex, StorageOperationStatus> result = null;
-
Boolean isDeleted = (Boolean) componentToDelete.getMetadataProperty(GraphPropertyEnum.IS_DELETED);
if (isDeleted != null && isDeleted && !(Boolean) componentToDelete.getMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION)) {
// component already marked for delete
- result = Either.left(componentToDelete);
- return result;
} else {
-
componentToDelete.addMetadataProperty(GraphPropertyEnum.IS_DELETED, Boolean.TRUE);
componentToDelete.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
@@ -152,13 +147,10 @@ public abstract class ToscaElementOperation extends BaseOperation {
if (updateNode.isRight()) {
log.debug("Failed to update component {}. status is {}", componentToDelete.getUniqueId(), updateNode.right().value());
updateComponent = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateNode.right().value());
- result = Either.right(updateComponent);
- return result;
+ return Either.right(updateComponent);
}
-
- result = Either.left(componentToDelete);
- return result;
}
+ return Either.left(componentToDelete);
}
/**
@@ -539,6 +531,10 @@ public abstract class ToscaElementOperation extends BaseOperation {
return JanusGraphOperationStatus.OK;
}
+ protected StorageOperationStatus assosiateCommonForToscaElement(GraphVertex nodeTypeVertex, ToscaElement toscaElement) {
+ return assosiateCommonForToscaElement(nodeTypeVertex, toscaElement, null);
+ }
+
protected StorageOperationStatus assosiateCommonForToscaElement(GraphVertex nodeTypeVertex, ToscaElement toscaElement, List<GraphVertex> derivedResources) {
StorageOperationStatus associateUsers = assosiateToUsers(nodeTypeVertex, toscaElement);
@@ -728,8 +724,6 @@ public abstract class ToscaElementOperation extends BaseOperation {
protected <T extends ToscaElement> Either<List<T>, StorageOperationStatus> getFollowedComponent(String userId, Set<LifecycleStateEnum> lifecycleStates, Set<LifecycleStateEnum> lastStateStates, ComponentTypeEnum neededType) {
- Either<List<T>, StorageOperationStatus> result = null;
-
Map<GraphPropertyEnum, Object> props = null;
if (userId != null) {
@@ -794,10 +788,7 @@ public abstract class ToscaElementOperation extends BaseOperation {
}
} // whlile users
- ;
- result = Either.left(components);
- return result;
-
+ return Either.left(components);
}
private <T extends ToscaElement> List<T> fetchComponents(String userId, Set<LifecycleStateEnum> lifecycleStates, List<GraphVertex> vertices, ComponentTypeEnum neededType, EdgeLabelEnum edgelabel) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 8cdced1685..2c51ff472c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -181,14 +181,12 @@ public class ModelConverter {
}
public static VertexTypeEnum getVertexType(String resourceTypeName) {
- VertexTypeEnum vertexType = null;
ResourceTypeEnum resourceType = ResourceTypeEnum.getTypeByName(resourceTypeName);
if (isAtomicComponent(resourceType)) {
- vertexType = VertexTypeEnum.NODE_TYPE;
+ return VertexTypeEnum.NODE_TYPE;
} else {
- vertexType = VertexTypeEnum.TOPOLOGY_TEMPLATE;
+ return VertexTypeEnum.TOPOLOGY_TEMPLATE;
}
- return vertexType;
}
private static Service convertToService(ToscaElement 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 a51eb33c03..40fe5c8b4f 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
@@ -228,15 +228,11 @@ public abstract class AbstractOperation {
}
protected String getValueFromJsonElement(JsonElement jsonElement) {
- String value = null;
-
if (jsonElement == null || jsonElement.isJsonNull()) {
- value = EMPTY_VALUE;
+ return EMPTY_VALUE;
} else {
- value = jsonElement.toString();
+ return jsonElement.toString();
}
-
- return value;
}
protected Either<String, JanusGraphOperationStatus> getInnerType(ToscaPropertyType type, Supplier<SchemaDefinition> schemeGen) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java
index 4284afea0f..f4ad0b2c09 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperation.java
@@ -103,12 +103,7 @@ public class ComponentInstanceOperation extends AbstractOperation {
.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), resourceInstanceId);
if (vertexService.isRight()) {
log.debug("failed to fetch vertex of resource instance for id = {}", resourceInstanceId);
- JanusGraphOperationStatus status = vertexService.right().value();
- if (status == JanusGraphOperationStatus.NOT_FOUND) {
- status = JanusGraphOperationStatus.INVALID_ID;
- }
- result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexService.right().value()));
- return result;
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexService.right().value()));
}
Vertex vertex = vertexService.left().value();
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 2eeb55cc99..e5901fb998 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
@@ -1089,7 +1089,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
if (propertyDefinition == null) {
return false;
}
- boolean isValid = false;
String innerType = null;
String propertyType = propertyDefinition.getType();
ToscaPropertyType type = getType(propertyType);
@@ -1106,18 +1105,17 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
}
String value = propertyDefinition.getDefaultValue();
if (type != null) {
- isValid = isValidValue(type, value, innerType, dataTypes);
+ return isValidValue(type, value, innerType, dataTypes);
} else {
log.trace("The given type {} is not a pre defined one.", propertyType);
DataTypeDefinition foundDt = dataTypes.get(propertyType);
if (foundDt != null) {
- isValid = isValidComplexValue(foundDt, value, dataTypes);
+ return isValidComplexValue(foundDt, value, dataTypes);
} else {
- isValid = false;
+ return false;
}
}
- return isValid;
}
public boolean isPropertyTypeValid(IComplexDefaultValue property) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java
index c64e47a14a..6ff34671ba 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java
@@ -241,9 +241,6 @@ public class DataTypeValidatorConverter {
}
public ImmutablePair<JsonElement, Boolean> validateAndUpdate(String value, DataTypeDefinition dataTypeDefinition, Map<String, DataTypeDefinition> allDataTypes) {
-
- ImmutablePair<JsonElement, Boolean> result = falseResult;
-
if (value == null || value.isEmpty()) {
return trueEmptyResult;
}
@@ -255,9 +252,7 @@ public class DataTypeValidatorConverter {
return falseResult;
}
- result = validateAndUpdate(jsonElement, dataTypeDefinition, allDataTypes);
-
- return result;
+ return validateAndUpdate(jsonElement, dataTypeDefinition, allDataTypes);
}
private Map<String, PropertyDefinition> getAllProperties(DataTypeDefinition dataTypeDefinition) {
@@ -278,9 +273,6 @@ public class DataTypeValidatorConverter {
}
public boolean isValid(String value, DataTypeDefinition dataTypeDefinition, Map<String, DataTypeDefinition> allDataTypes) {
-
- boolean result = false;
-
if (value == null || value.isEmpty()) {
return true;
}
@@ -293,9 +285,7 @@ public class DataTypeValidatorConverter {
return false;
}
- result = isValid(jsonElement, dataTypeDefinition, allDataTypes);
-
- return result;
+ return isValid(jsonElement, dataTypeDefinition, allDataTypes);
}
private boolean isValid(JsonElement jsonElement, DataTypeDefinition dataTypeDefinition, Map<String, DataTypeDefinition> allDataTypes) {