summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java8
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java19
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java12
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java20
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java1
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java9
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java15
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/facade/operations/UserOperation.java8
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java26
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java12
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java30
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java16
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java8
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java9
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java78
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java5
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java6
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java15
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java6
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java5
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java9
-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
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/services/ValidationFactory.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java6
-rw-r--r--utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java4
-rw-r--r--utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java10
44 files changed, 159 insertions, 419 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
index 291605e4b1..579bf35324 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
@@ -1088,7 +1088,7 @@ public class ArtifactUuidFix {
hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
Map<String, List<Component>> vertices = getVerticesToValidate(VertexTypeEnum.NODE_TYPE, hasProps);
- boolean result = validateTosca(vertices, nodeToFix, "RESOURCE_TOSCA_ARTIFACTS");//
+ validateTosca(vertices, nodeToFix, "RESOURCE_TOSCA_ARTIFACTS");//
hasProps.clear();
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name());
@@ -1096,16 +1096,14 @@ public class ArtifactUuidFix {
hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
vertices = getVerticesToValidate(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps);
- result = validateTosca(vertices, vfToFix, "VF_TOSCA_ARTIFACTS");
+ validateTosca(vertices, vfToFix, "VF_TOSCA_ARTIFACTS");
hasProps.clear();
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
vertices = getVerticesToValidate(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps);
- result = validateTosca(vertices, serviceToFix, "SERVICE_TOSCA_ARTIFACTS");
-
- return result;
+ return validateTosca(vertices, serviceToFix, "SERVICE_TOSCA_ARTIFACTS");
}
public Map<String, List<Component>> getVerticesToValidate(VertexTypeEnum type,
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
index c34a006b6c..5be54a3c88 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
@@ -1693,7 +1693,6 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Component resource, ArtifactDefinition oldArtifact, ArtifactTemplateInfo artifactTemplateInfo,
List<ArtifactDefinition> updatedArtifacts, List<ArtifactTemplateInfo> updatedRequiredArtifacts) {
- Either<ArtifactDefinition, ResponseFormat> resStatus = null;
String artifactFileName = artifactTemplateInfo.getFileName();
// check if artifacts already exist
@@ -1705,13 +1704,11 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
BeEcompErrorManager.getInstance().logInternalDataError(
ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName,
ARTIFACT_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- resStatus = Either.right(componentsUtils.getResponseFormat(
+ return Either.right(componentsUtils.getResponseFormat(
ActionStatus.ARTIFACT_ALREADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR, artifactFileName,
artifactTemplateInfo.getType(), updatedArtifact.getArtifactType()));
- return resStatus;
}
- resStatus = Either.left(updatedArtifact);
- return resStatus;
+ return Either.left(updatedArtifact);
}
}
@@ -1720,8 +1717,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
.getArtifactContent(csarInfo.getCsarUUID(), csarInfo.getCsar(),
CsarUtils.ARTIFACTS_PATH + artifactFileName, artifactFileName, componentsUtils);
if (artifactContententStatus.isRight()) {
- resStatus = Either.right(artifactContententStatus.right().value());
- return resStatus;
+ return Either.right(artifactContententStatus.right().value());
}
Map<String, Object> json = ArtifactUtils.buildJsonForUpdateArtifact(oldArtifact.getUniqueId(), artifactFileName,
@@ -1734,8 +1730,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE));
if (uploadArtifactToService.isRight()) {
- resStatus = Either.right(uploadArtifactToService.right().value());
- return resStatus;
+ return Either.right(uploadArtifactToService.right().value());
}
ArtifactDefinition previousInfo = uploadArtifactToService.left().value().left().value();
ArtifactDefinition currentInfo = uploadArtifactToService.left().value().left().value();
@@ -1746,15 +1741,13 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
if (updateEnvEither.isRight()) {
log.debug("failed to update parameters to artifact {}", artifactFileName);
- resStatus = Either.right(updateEnvEither.right().value());
- return resStatus;
+ return Either.right(updateEnvEither.right().value());
}
artifactsBusinessLogic.updateGroupForHeat(previousInfo, updateEnvEither.left().value(), resource);
updatedArtifacts.add(updateEnvEither.left().value());
- resStatus = Either.left(currentInfo);
- return resStatus;
+ return Either.left(currentInfo);
}
public Either<Resource, ResponseFormat> deleteVFModules(Resource resource, CsarInfo csarInfo, boolean shouldLock, boolean inTransaction) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
index e411433baf..e5eefb43ad 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
@@ -188,17 +188,15 @@ public class HealthCheckBusinessLogic {
}
private HealthCheckInfo getDmaapProducerHealthCheck() {
- HealthCheckInfo healthCheckInfo = null;
- if(ConfigurationManager.getConfigurationManager().getConfiguration().getDmaapConsumerConfiguration().isActive()){
+ if (ConfigurationManager.getConfigurationManager().getConfiguration().getDmaapConsumerConfiguration().isActive()) {
String appVersion = getAppVersion();
- dmaapProducerHealth.getHealthCheckInfo().setVersion(appVersion);
- healthCheckInfo = dmaapProducerHealth.getHealthCheckInfo();
+ dmaapProducerHealth.getHealthCheckInfo().setVersion(appVersion);
+ return dmaapProducerHealth.getHealthCheckInfo();
} else {
- log.debug("Dmaap health check disabled");
+ log.debug("Dmaap health check disabled");
String description = ("Dmaap health check disabled");
- healthCheckInfo = new HealthCheckInfo(HC_COMPONENT_DMAAP_PRODUCER, DOWN, null, description);
+ return new HealthCheckInfo(HC_COMPONENT_DMAAP_PRODUCER, DOWN, null, description);
}
- return healthCheckInfo;
}
public HealthCheckInfo getJanusGraphHealthCheck() {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java
index 72aeb2b8f9..be2a45b24f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java
@@ -442,22 +442,18 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic {
}
public Either<List<Component>, ResponseFormat> getLatestVersionNotAbstractComponentsMetadata(boolean isAbstractAbstract, HighestFilterEnum highestFilter, ComponentTypeEnum componentTypeEnum, String internalComponentType, String userId) {
- ResponseFormat responseFormat = null;
-
try{
validateUserExists(userId);
- Boolean isHighest = isHighest(highestFilter);
Either<List<Component>, StorageOperationStatus> nonCheckoutCompResponse = toscaOperationFacade.getLatestVersionNotAbstractMetadataOnly(isAbstractAbstract, componentTypeEnum, internalComponentType);
if (nonCheckoutCompResponse.isLeft()) {
log.debug("Retrieved Resource successfully.");
return Either.left(nonCheckoutCompResponse.left().value());
}
- responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(nonCheckoutCompResponse.right().value()));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(nonCheckoutCompResponse.right().value())));
} finally {
janusGraphDao.commit();
}
- return Either.right(responseFormat);
}
public void setDeploymentArtifactsPlaceHolder(Component component, User user) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
index 3f48328cc9..7c463ac387 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
@@ -1657,7 +1657,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
Either<RequirementCapabilityRelDef, ResponseFormat> resultOp = null;
try {
org.openecomp.sdc.be.model.Component containerComponent = null;
- Either<org.openecomp.sdc.be.model.Component, ResponseFormat> validateComponentExists = null;
RequirementCapabilityRelDef foundRelation = null;
validateUserExists(userId);
@@ -2025,12 +2024,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
if(getComponentRes.isRight()) {
return componentsUtils.getResponseFormat(getComponentRes.right().value());
}
- String propOwner;
- if(!PropertiesUtils.isNodeServiceProxy(getComponentRes.left().value())) {
- propOwner = componentInstanceUniqueId;
- } else {
- propOwner = foundResourceInstance.getSourceModelUid();
- }
ResponseFormat actionStatus = updateCapPropOnContainerComponent(property, newValue, containerComponent,
foundResourceInstance, capabilityType, capabilityName, componentInstanceUniqueId);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
index 0c776a16a4..fe9d44837b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
@@ -617,7 +617,6 @@ public class GroupBusinessLogic extends BaseBusinessLogic {
public Either<List<GroupDefinition>, ResponseFormat> validateUpdateVfGroupNamesOnGraph(List<GroupDefinition> groups, Component component) {
List<GroupDefinition> updatedGroups = new ArrayList<>();
- Either<List<GroupDefinition>, ResponseFormat> result;
for (GroupDefinition group : groups) {
String groupType = group.getType();
@@ -630,7 +629,6 @@ public class GroupBusinessLogic extends BaseBusinessLogic {
newGroupNameRes = validateGenerateVfModuleGroupName(component.getSystemName(), group.getDescription(), counter);
if (newGroupNameRes.isRight()) {
log.debug("Failed to generate new vf module group name. Status is {} ", newGroupNameRes.right().value());
- result = Either.right(newGroupNameRes.right().value());
break;
}
newGroupName = newGroupNameRes.left().value();
@@ -641,8 +639,7 @@ public class GroupBusinessLogic extends BaseBusinessLogic {
}
- result = Either.left(updatedGroups);
- return result;
+ return Either.left(updatedGroups);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 7788066e52..4c34ddaba0 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -902,19 +902,17 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
private EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> findNodeTypeArtifactsToHandle(Resource curNodeType,
List<ArtifactDefinition> extractedArtifacts) {
- EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle = null;
try {
List<ArtifactDefinition> artifactsToUpload = new ArrayList<>(extractedArtifacts);
List<ArtifactDefinition> artifactsToUpdate = new ArrayList<>();
List<ArtifactDefinition> artifactsToDelete = new ArrayList<>();
processExistingNodeTypeArtifacts(extractedArtifacts, artifactsToUpload, artifactsToUpdate,
artifactsToDelete, collectExistingArtifacts(curNodeType));
- nodeTypeArtifactsToHandle = putFoundArtifacts(artifactsToUpload, artifactsToUpdate, artifactsToDelete);
+ return putFoundArtifacts(artifactsToUpload, artifactsToUpdate, artifactsToDelete);
} catch (Exception e) {
log.debug("Exception occurred when findNodeTypeArtifactsToHandle, error is:{}", e.getMessage(), e);
throw new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR);
}
- return nodeTypeArtifactsToHandle;
}
private EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> putFoundArtifacts(
@@ -3325,7 +3323,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
}
}
- String innerType = null;
property = new ComponentInstanceInput(curPropertyDef, value, null);
String validPropertyVAlue = validatePropValueBeforeCreate(property, value, isValidate, allDataTypes);
@@ -3445,7 +3442,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
}
}
- String innerType = null;
property = new ComponentInstanceProperty(curPropertyDef, value, null);
String validatePropValue = validatePropValueBeforeCreate(property, value, isValidate, allDataTypes);
@@ -4541,26 +4537,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
private void processDeploymentResourceArtifacts(User user, Resource resource,
Map<String, ArtifactDefinition> artifactMap, String k, Object v) {
- boolean shouldCreateArtifact = true;
Map<String, Object> artifactDetails = (Map<String, Object>) v;
Object object = artifactDetails.get(PLACE_HOLDER_RESOURCE_TYPES);
if (object != null) {
List<String> artifactTypes = (List<String>) object;
if (!artifactTypes.contains(resource.getResourceType()
.name())) {
- shouldCreateArtifact = false;
return;
}
} else {
log.info("resource types for artifact placeholder {} were not defined. default is all resources", k);
}
- if (shouldCreateArtifact) {
- if (artifactsBusinessLogic != null) {
- ArtifactDefinition artifactDefinition = artifactsBusinessLogic.createArtifactPlaceHolderInfo(
- resource.getUniqueId(), k, (Map<String, Object>) v, user, ArtifactGroupTypeEnum.DEPLOYMENT);
- if (artifactDefinition != null && !artifactMap.containsKey(artifactDefinition.getArtifactLabel())) {
- artifactMap.put(artifactDefinition.getArtifactLabel(), artifactDefinition);
- }
+ if (artifactsBusinessLogic != null) {
+ ArtifactDefinition artifactDefinition = artifactsBusinessLogic.createArtifactPlaceHolderInfo(
+ resource.getUniqueId(), k, (Map<String, Object>) v, user, ArtifactGroupTypeEnum.DEPLOYMENT);
+ if (artifactDefinition != null && !artifactMap.containsKey(artifactDefinition.getArtifactLabel())) {
+ artifactMap.put(artifactDefinition.getArtifactLabel(), artifactDefinition);
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
index 3b19ea9d86..eba4cc947e 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
@@ -813,7 +813,6 @@ public class ServiceImportBusinessLogic{
String yamlFileName, CsarInfo csarInfo, Service preparedService,
NodeTypeInfoToUpdateArtifacts nodeTypeInfoToUpdateArtifacts, boolean inTransaction, boolean shouldLock) {
- String nodeName = nodeTypeInfoToUpdateArtifacts.getNodeName();
Service resource = preparedService;
Map<String, EnumMap<ArtifactsBusinessLogic.ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = nodeTypeInfoToUpdateArtifacts
.getNodeTypesArtifactsToHandle();
@@ -1380,7 +1379,6 @@ public class ServiceImportBusinessLogic{
TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
}
}
- String innerType = null;
property = new ComponentInstanceInput(curPropertyDef, value, null);
String validPropertyVAlue = serviceBusinessLogic.validatePropValueBeforeCreate(property, value, isValidate, allDataTypes);
property.setValue(validPropertyVAlue);
@@ -1826,7 +1824,6 @@ public class ServiceImportBusinessLogic{
TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
}
}
- String innerType = null;
property = new ComponentInstanceInput(curPropertyDef, value, null);
String validPropertyVAlue = serviceBusinessLogic.validatePropValueBeforeCreate(property, value, isValidate, allDataTypes);
property.setValue(validPropertyVAlue);
@@ -1918,7 +1915,6 @@ public class ServiceImportBusinessLogic{
TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
}
}
- String innerType = null;
property = new ComponentInstanceProperty(curPropertyDef, value, null);
String validatePropValue = serviceBusinessLogic.validatePropValueBeforeCreate(property, value, isValidate, allDataTypes);
@@ -2009,7 +2005,6 @@ public class ServiceImportBusinessLogic{
TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
}
}
- String innerType = null;
property = new ComponentInstanceProperty(curPropertyDef, value, null);
String validatePropValue = serviceBusinessLogic.validatePropValueBeforeCreate(property, value, isValidate, allDataTypes);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java
index 935a5d6796..cf70d39743 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java
@@ -1358,7 +1358,6 @@ public class ServiceImportParseLogic {
if (object != null) {
List<String> artifactTypes = (List<String>) object;
if (!artifactTypes.contains(resource.getResourceType().name())) {
- shouldCreateArtifact = false;
return;
}
} else {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
index 030fc46887..9d65a667fe 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
@@ -550,18 +550,13 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof String && ((String) value).equalsIgnoreCase(inputName) && key.equals(GET_INPUT)) {
- value = "";
lhm1.remove(key);
} else if (value instanceof Map) {
Map<String, Object> subMap = (Map<String, Object>)value;
resetInputName(subMap, inputName);
} else if (value instanceof List && ((List) value).contains(inputName) && key.equals(GET_INPUT)) {
- value = "";
lhm1.remove(key);
- } else {
- continue;
}
-
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java
index 97fedffe9a..929cd46051 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java
@@ -40,9 +40,8 @@ public class Utils {
if (existingValues.isEmpty()) {
return 0;
}
- int maxCurrentCounter = 0;
try {
- maxCurrentCounter = existingValues.stream()
+ return 1 + existingValues.stream()
.map(COUNTER_PATTERN::matcher)
.filter(Matcher::find)
.map(matcher -> matcher.group(0))
@@ -52,8 +51,7 @@ public class Utils {
}
catch (Exception e) {
Log.warn("Failed in retrieivng counter from existing value: ", e);
- maxCurrentCounter = random.nextInt(100) + 50;
+ return random.nextInt(100) + 50;
}
- return ++maxCurrentCounter;
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java
index c6856eb42d..c6be01db5c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java
@@ -163,8 +163,7 @@ public class DistributionServlet extends BeGenericServlet {
log.debug("failed to get ueb serbver list from cofiguration", e);
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR);
getComponentsUtils().auditGetUebCluster(instanceId, responseFormat.getStatus().toString(), responseFormat.getFormattedMessage());
- response = buildErrorResponse(responseFormat);
- return response;
+ return buildErrorResponse(responseFormat);
}
}
@@ -267,18 +266,16 @@ public class DistributionServlet extends BeGenericServlet {
@Parameter(description = "The username and password", required = true)@HeaderParam(value = Constants.ACCEPT_HEADER) String accept) {
String url = request.getMethod() + " " + request.getRequestURI();
log.debug(START_HANDLE_REQUEST_OF, url);
- Response response = null;
Wrapper<Response> responseWrapper = new Wrapper<>();
//TODO check if in use
validateHeaders(responseWrapper, request, AuditingActionEnum.GET_VALID_ARTIFACT_TYPES);
if (responseWrapper.isEmpty()) {
- response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), ArtifactTypeEnum.values());
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), ArtifactTypeEnum.values());
} else {
- response = responseWrapper.getInnerElement();
+ return responseWrapper.getInnerElement();
}
- return response;
}
/**
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java
index 0320a0a795..eb514bf088 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java
@@ -154,7 +154,6 @@ public class AbstractTemplateServlet extends AbstractValidationsServlet {
@Parameter(description = "The requested asset uuid",
required = true) @PathParam("uuid") final String uuid) throws IOException {
- Response response = null;
ResponseFormat responseFormat = null;
AuditingActionEnum auditingActionEnum = AuditingActionEnum.GET_TEMPLATE_ABSTRACT_STATUS;
String requestURI = request.getRequestURI();
@@ -202,9 +201,7 @@ public class AbstractTemplateServlet extends AbstractValidationsServlet {
getComponentsUtils().auditExternalGetAsset(responseFormat, auditingActionEnum, distributionData,
resourceCommonInfo, requestId, uuid);
- response = buildOkResponse(responseFormat, result);
- return response;
-
+ return buildOkResponse(responseFormat, result);
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Fetch abstract status of service");
log.debug("getServiceAbstractStatus: Fetch abstract status of service with exception", e);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
index db065ac223..0154284cab 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
@@ -160,7 +160,6 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
@Parameter(description = "The filter key (resourceType only for resources)",
required = false) @QueryParam("resourceType") String resourceType) throws IOException {
- Response response = null;
ResponseFormat responseFormat = null;
String query = request.getQueryString();
String requestURI = request.getRequestURI().endsWith("/")?
@@ -224,8 +223,7 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
getComponentsUtils().auditExternalGetAssetList(responseFormat, auditingActionEnum, distributionData, requestId);
- response = buildOkResponse(responseFormat, result);
- return response;
+ return buildOkResponse(responseFormat, result);
}
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Fetch filtered list of assets");
@@ -276,7 +274,6 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
@Parameter(description = "The requested asset uuid",
required = true) @PathParam("uuid") final String uuid) throws IOException {
- Response response = null;
ResponseFormat responseFormat = null;
AuditingActionEnum auditingActionEnum = AuditingActionEnum.GET_ASSET_METADATA;
String requestURI = request.getRequestURI();
@@ -323,9 +320,7 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
getComponentsUtils().auditExternalGetAsset(responseFormat, auditingActionEnum, distributionData,
resourceCommonInfo, requestId, uuid);
- response = buildOkResponse(responseFormat, result);
- return response;
-
+ return buildOkResponse(responseFormat, result);
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Fetch filtered list of assets");
log.debug("getAssetList: Fetch list of assets failed with exception", e);
@@ -388,7 +383,6 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
String url = request.getRequestURI();
log.debug("Start handle request of {} {}", request.getMethod(), url);
- Response response = null;
ResponseFormat responseFormat = null;
ComponentTypeEnum componentType = ComponentTypeEnum.findByParamName(assetType);
AuditingActionEnum auditingActionEnum = AuditingActionEnum.GET_TOSCA_MODEL;
@@ -416,8 +410,7 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
getComponentsUtils().auditExternalGetAsset(responseFormat, auditingActionEnum, distributionData,
resourceCommonInfo, requestId, uuid);
- response = buildOkResponse(responseFormat, is, headers);
- return response;
+ return buildOkResponse(responseFormat, is, headers);
} catch (ComponentException e) {
responseFormat = e.getResponseFormat();
@@ -425,7 +418,7 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
resourceCommonInfo, requestId, uuid);
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get asset tosca model");
log.debug("failed to get asset tosca model", e);
- response = buildErrorResponse(responseFormat);
+ Response response = buildErrorResponse(responseFormat);
getComponentsUtils().auditExternalGetAsset(responseFormat, auditingActionEnum, distributionData,
resourceCommonInfo, requestId, uuid);
return response;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java
index b9412f680f..97678d72fc 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java
@@ -635,15 +635,13 @@ public class CrudExternalServlet extends AbstractValidationsServlet {
}
private Either<LifeCycleTransitionEnum, ResponseFormat> validateTransitionEnum(final String lifecycleTransition, User user) {
- LifeCycleTransitionEnum transitionEnum = LifeCycleTransitionEnum.CHECKOUT;
try {
- transitionEnum = LifeCycleTransitionEnum.getFromDisplayName(lifecycleTransition);
+ return Either.left(LifeCycleTransitionEnum.getFromDisplayName(lifecycleTransition));
} catch (IllegalArgumentException e) {
log.info("state operation is not valid. operations allowed are: {}", LifeCycleTransitionEnum.valuesAsString(), e);
ResponseFormat error = getComponentsUtils().getInvalidContentErrorAndAudit(user, "", AuditingActionEnum.CHECKOUT_RESOURCE);
return Either.right(error);
}
- return Either.left(transitionEnum);
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/facade/operations/UserOperation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/facade/operations/UserOperation.java
index c830734498..fb30826bb5 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/facade/operations/UserOperation.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/facade/operations/UserOperation.java
@@ -40,17 +40,15 @@ public class UserOperation {
}
public ActionStatus updateUserCache(UserOperationEnum operation, String userId, String role){
- ActionStatus result = ActionStatus.OK;
- try{
+ try {
UserMessage message = new UserMessage(operation, userId,role);
IStatus status = msProducer.pushMessage(message);
- result = FacadeOperationUtils.convertStatusToActionStatus(status);
+ return FacadeOperationUtils.convertStatusToActionStatus(status);
- }catch(Exception e){
+ } catch(Exception e) {
log.debug("update user cache - failed to send notification to update user cache {}", e.getMessage());
return ActionStatus.OK;
}
- return result;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java
index 7ac20893c9..8f1f2c1c21 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java
@@ -1400,35 +1400,25 @@ public class ComponentsUtils {
labelOrValue = AdditionalInformationEnum.None;
}
- ResponseFormat responseFormat = null;
switch (actionStatus) {
case COMPONENT_NAME_ALREADY_EXIST:
- responseFormat = getResponseFormat(actionStatus, "Additional parameter", additionalInfoParameterInfo.getKey());
- break;
+ return getResponseFormat(actionStatus, "Additional parameter", additionalInfoParameterInfo.getKey());
case ADDITIONAL_INFORMATION_EXCEEDS_LIMIT:
- responseFormat = getResponseFormat(actionStatus, labelOrValue.name().toLowerCase(), ValidationUtils.ADDITIONAL_INFORMATION_KEY_MAX_LENGTH.toString());
- break;
+ return getResponseFormat(actionStatus, labelOrValue.name().toLowerCase(), ValidationUtils.ADDITIONAL_INFORMATION_KEY_MAX_LENGTH.toString());
case ADDITIONAL_INFORMATION_MAX_NUMBER_REACHED:
- responseFormat = getResponseFormat(actionStatus, nodeType.name().toLowerCase());
- break;
+ return getResponseFormat(actionStatus, nodeType.name().toLowerCase());
case ADDITIONAL_INFORMATION_EMPTY_STRING_NOT_ALLOWED:
- responseFormat = getResponseFormat(actionStatus);
- break;
+ return getResponseFormat(actionStatus);
case ADDITIONAL_INFORMATION_KEY_NOT_ALLOWED_CHARACTERS:
- responseFormat = getResponseFormat(actionStatus);
- break;
+ return getResponseFormat(actionStatus);
case ADDITIONAL_INFORMATION_VALUE_NOT_ALLOWED_CHARACTERS:
- responseFormat = getResponseFormat(actionStatus);
- break;
+ return getResponseFormat(actionStatus);
case ADDITIONAL_INFORMATION_NOT_FOUND:
- responseFormat = getResponseFormat(actionStatus);
- break;
+ return getResponseFormat(actionStatus);
default:
- responseFormat = getResponseFormat(actionStatus);
- break;
+ return getResponseFormat(actionStatus);
}
- return responseFormat;
}
public ResponseFormat getResponseFormatAdditionalProperty(ActionStatus actionStatus) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java
index 1a8a305d2a..382e01c60a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java
@@ -534,7 +534,6 @@ public class BeGenericServlet extends BasicServlet {
ServletContext context = request.getSession().getServletContext();
String url = request.getMethod() + " " + request.getRequestURI();
log.debug("(get) Start handle request of {}", url);
- Response response = null;
try {
BaseBusinessLogic businessLogic = getBlForPropertyDeclaration(typeEnum, context);
@@ -547,8 +546,7 @@ public class BeGenericServlet extends BasicServlet {
Either<ComponentInstInputsMap, ResponseFormat> componentInstInputsMapRes = parseToComponentInstanceMap(componentInstInputsMapObj, modifier, componentTypeEnum);
if (componentInstInputsMapRes.isRight()) {
log.debug("failed to parse componentInstInputsMap");
- response = buildErrorResponse(componentInstInputsMapRes.right().value());
- return response;
+ return buildErrorResponse(componentInstInputsMapRes.right().value());
}
Either<List<ToscaDataDefinition>, ResponseFormat> propertiesAfterDeclaration = businessLogic
@@ -565,8 +563,7 @@ public class BeGenericServlet extends BasicServlet {
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Create inputs for service with id: " + componentId);
log.debug("Properties declaration failed with exception", e);
- response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
- return response;
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java
index 408efa12c6..f3d18602bd 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java
@@ -152,14 +152,12 @@ public class ConsumerServlet extends BeGenericServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
Either<ConsumerDefinition, ResponseFormat> actionResponse = businessLogic.getConsumer(consumerId, modifier);
if (actionResponse.isRight()) {
log.debug("failed to get consumer");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), actionResponse.left().value());
@@ -167,7 +165,6 @@ public class ConsumerServlet extends BeGenericServlet {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Consumer");
log.debug("get consumer failed with exception", e);
return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
-
}
}
@@ -184,8 +181,6 @@ public class ConsumerServlet extends BeGenericServlet {
public Response deleteConsumer(@PathParam("consumerId") final String consumerId,
@Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
- ServletContext context = request.getSession().getServletContext();
-
String url = request.getMethod() + " " + request.getRequestURI();
log.debug(START_HANDLE_REQUEST_OF, url);
@@ -193,14 +188,12 @@ public class ConsumerServlet extends BeGenericServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
Either<ConsumerDefinition, ResponseFormat> actionResponse = businessLogic.deleteConsumer(consumerId, modifier);
if (actionResponse.isRight()) {
log.debug("failed to delete consumer");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), actionResponse.left().value());
@@ -208,7 +201,6 @@ public class ConsumerServlet extends BeGenericServlet {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Consumer");
log.debug("delete consumer failed with exception", e);
return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
-
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java
index 5ba56fda5b..46338c2986 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java
@@ -95,24 +95,15 @@ public class DistributionServiceServlet extends BeGenericServlet {
String url = request.getMethod() + " " + request.getRequestURI();
log.debug("Start handle request of {}", url);
- Response response = null;
- ResponseFormat responseFormat = null;
-
try {
Either<DistributionStatusOfServiceListResponce, ResponseFormat> actionResponse = distributionMonitoringLogic.getListOfDistributionServiceStatus(serviceUUID, userId);
if (actionResponse.isRight()) {
-
- responseFormat = actionResponse.right().value();
- response = buildErrorResponse(responseFormat);
+ return buildErrorResponse(actionResponse.right().value());
} else {
- responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
- response = buildOkResponse(responseFormat, actionResponse.left().value());
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), actionResponse.left().value());
}
-
- return response;
-
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Distribution list for Service");
log.debug("failed to get service distribution statuses", e);
@@ -138,27 +129,18 @@ public class DistributionServiceServlet extends BeGenericServlet {
String url = request.getMethod() + " " + request.getRequestURI();
log.debug("Start handle request of {}", url);
- Response response = null;
- ResponseFormat responseFormat = null;
-
try {
Either<DistributionStatusListResponse, ResponseFormat> actionResponse = distributionMonitoringLogic.getListOfDistributionStatus(did, userId);
if (actionResponse.isRight()) {
-
- responseFormat = actionResponse.right().value();
+ ResponseFormat responseFormat = actionResponse.right().value();
log.debug("failed to fount statuses for did {} {}", did, responseFormat);
- response = buildErrorResponse(responseFormat);
+ return buildErrorResponse(responseFormat);
} else {
-
- responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
+ ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
log.debug("success to fount statuses for did {} {}", did, actionResponse.left().value());
- response = buildOkResponse(responseFormat, actionResponse.left().value());
-
+ return buildOkResponse(responseFormat, actionResponse.left().value());
}
-
- return response;
-
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Distribution Status");
log.debug("failed to get distribution status ", e);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java
index befdac48b0..9ea4a44acb 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java
@@ -527,7 +527,6 @@ public class ElementServlet extends BeGenericServlet {
public Response getFollowedResourcesServices(@Context final HttpServletRequest request,
@HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
- Response res = null;
try {
String url = request.getMethod() + " " + request.getRequestURI();
log.debug(START_HANDLE_REQUEST_OF, url);
@@ -539,13 +538,12 @@ public class ElementServlet extends BeGenericServlet {
return buildErrorResponse(followedResourcesServices.right().value());
}
Object data = RepresentationUtils.toRepresentation(followedResourcesServices.left().value());
- res = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), data);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), data);
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Followed Resources / Services Categories");
log.debug("Getting followed resources/services failed with exception", e);
throw e;
}
- return res;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -566,7 +564,6 @@ public class ElementServlet extends BeGenericServlet {
@HeaderParam(value = Constants.USER_ID_HEADER) String userId,
@QueryParam("excludeTypes") List<OriginTypeEnum> excludeTypes) throws IOException {
- Response res = null;
try {
String url = request.getMethod() + " " + request.getRequestURI();
log.debug(START_HANDLE_REQUEST_OF, url);
@@ -578,14 +575,13 @@ public class ElementServlet extends BeGenericServlet {
return buildErrorResponse(catalogData.right().value());
}
Object data = RepresentationUtils.toRepresentation(catalogData.left().value());
- res = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), data);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), data);
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Catalog Components");
log.debug("Getting catalog components failed with exception", e);
throw e;
}
- return res;
}
@DELETE
@@ -601,8 +597,6 @@ public class ElementServlet extends BeGenericServlet {
modifier.setUserId(userId);
log.debug("modifier id is {}", userId);
- Response response = null;
-
NodeTypeEnum nodeType = NodeTypeEnum.getByNameIgnoreCase(componentType);
if (nodeType == null) {
log.info("componentType is not valid: {}", componentType);
@@ -617,11 +611,9 @@ public class ElementServlet extends BeGenericServlet {
if (cleanResult.isRight()) {
log.debug("failed to delete marked components of type {}", nodeType);
- response = buildErrorResponse(cleanResult.right().value());
- return response;
+ return buildErrorResponse(cleanResult.right().value());
}
- response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), cleanResult.left().value());
- return response;
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), cleanResult.left().value());
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Delete Marked Components");
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java
index 811b748ca5..d1998d841b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java
@@ -218,14 +218,11 @@ public class GroupServlet extends AbstractValidationsServlet {
user.setUserId(userId);
log.debug("modifier id is {}", userId);
- Response response = null;
-
try {
Either<GroupDefinition, ResponseFormat> convertResponse = parseToObject(data, () -> GroupDefinition.class);
if (convertResponse.isRight()) {
log.debug("failed to parse group");
- response = buildErrorResponse(convertResponse.right().value());
- return response;
+ return buildErrorResponse(convertResponse.right().value());
}
GroupDefinition updatedGroup = convertResponse.left().value();
@@ -236,8 +233,7 @@ public class GroupServlet extends AbstractValidationsServlet {
if (actionResponse.isRight()) {
log.debug("failed to update GroupDefinition");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
GroupDefinition group = actionResponse.left().value();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java
index 1f80b4be87..ea63218e5e 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java
@@ -379,11 +379,8 @@ public class InputsServlet extends AbstractValidationsServlet {
@Parameter(description = "ComponentIns Inputs Object to be created",
required = true) String componentInstInputsMapObj) {
- ServletContext context = request.getSession().getServletContext();
String url = request.getMethod() + " " + request.getRequestURI();
log.debug("#createListInput: Start handle request of {}", url);
- Response response = null;
-
try {
// get modifier id
User modifier = new User();
@@ -394,8 +391,7 @@ public class InputsServlet extends AbstractValidationsServlet {
parseToComponentInstListInput(componentInstInputsMapObj, modifier);
if (componentInstInputsMapRes.isRight()) {
log.debug("failed to parse componentInstInputsMap");
- response = buildErrorResponse(componentInstInputsMapRes.right().value());
- return response;
+ return buildErrorResponse(componentInstInputsMapRes.right().value());
}
ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
@@ -419,8 +415,7 @@ public class InputsServlet extends AbstractValidationsServlet {
BeEcompErrorManager.getInstance()
.logBeRestApiGeneralError("Create list input for service with id: " + componentId);
log.debug("createListInput failed with exception", e);
- response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
- return response;
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java
index 57a29566b1..f0ef7074ea 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java
@@ -189,15 +189,13 @@ public class ServiceServlet extends AbstractValidationsServlet {
User modifier = new User();
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
Either<Map<String, Boolean>, ResponseFormat> actionResponse =
serviceBusinessLogic.validateServiceNameExists(serviceName, userId);
if (actionResponse.isRight()) {
log.debug("failed to get validate service name");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), actionResponse.left().value());
} catch (Exception e) {
@@ -303,7 +301,6 @@ public class ServiceServlet extends AbstractValidationsServlet {
User modifier = new User();
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
String serviceIdLower = serviceId.toLowerCase();
loggerSupportability.log(LoggerSupportabilityActions.DELETE_SERVICE, StatusCode.STARTED,"Starting to delete service {} by user {} ",serviceIdLower, userId);
@@ -311,12 +308,10 @@ public class ServiceServlet extends AbstractValidationsServlet {
ResponseFormat actionResponse = businessLogic.deleteService(serviceIdLower, modifier);
if (actionResponse.getStatus() != HttpStatus.SC_NO_CONTENT) {
log.debug("failed to delete service");
- response = buildErrorResponse(actionResponse);
- return response;
+ return buildErrorResponse(actionResponse);
}
- response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.NO_CONTENT), null);
loggerSupportability.log(LoggerSupportabilityActions.DELETE_SERVICE,StatusCode.COMPLETE,"Ended deleting service {} by user {}",serviceIdLower, userId);
- return response;
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.NO_CONTENT), null);
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Delete Service");
@@ -338,28 +333,16 @@ public class ServiceServlet extends AbstractValidationsServlet {
public Response deleteServiceByNameAndVersion(@PathParam("serviceName") final String serviceName,
@PathParam("version") final String version,
@Context final HttpServletRequest request) {
- String url = request.getMethod() + " " + request.getRequestURI();
- log.debug(START_HANDLE_REQUEST_OF, url);
-
- // get modifier id
- String userId = request.getHeader(Constants.USER_ID_HEADER);
- User modifier = new User();
- modifier.setUserId(userId);
- log.debug(MODIFIER_ID_IS, userId);
-
- Response response = null;
+ User modifier = getUser(request);
try {
ResponseFormat actionResponse = serviceBusinessLogic.deleteServiceByNameAndVersion(serviceName, version, modifier);
if (actionResponse.getStatus() != HttpStatus.SC_NO_CONTENT) {
log.debug("failed to delete service");
- response = buildErrorResponse(actionResponse);
- return response;
+ return buildErrorResponse(actionResponse);
}
- response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.NO_CONTENT), null);
- return response;
-
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.NO_CONTENT), null);
} catch (Exception e) {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Delete Service");
log.debug("delete service failed with exception", e);
@@ -367,6 +350,18 @@ public class ServiceServlet extends AbstractValidationsServlet {
}
}
+ private User getUser(HttpServletRequest request) {
+ String url = request.getMethod() + " " + request.getRequestURI();
+ log.debug(START_HANDLE_REQUEST_OF, url);
+
+ // get modifier id
+ String userId = request.getHeader(Constants.USER_ID_HEADER);
+ User modifier = new User();
+ modifier.setUserId(userId);
+ log.debug(MODIFIER_ID_IS, userId);
+ return modifier;
+ }
+
@PUT
@Path("/services/{serviceId}/metadata")
@Consumes(MediaType.APPLICATION_JSON)
@@ -389,24 +384,20 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
-
try {
String serviceIdLower = serviceId.toLowerCase();
Either<Service, ResponseFormat> convertResponse = parseToService(data, modifier);
if (convertResponse.isRight()) {
log.debug("failed to parse service");
- response = buildErrorResponse(convertResponse.right().value());
- return response;
+ return buildErrorResponse(convertResponse.right().value());
}
Service updatedService = convertResponse.left().value();
Either<Service, ResponseFormat> actionResponse = serviceBusinessLogic.updateServiceMetadata(serviceIdLower, updatedService, modifier);
if (actionResponse.isRight()) {
log.debug("failed to update service");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
Service service = actionResponse.left().value();
@@ -447,7 +438,6 @@ public class ServiceServlet extends AbstractValidationsServlet {
@Parameter(description = "Group instance object to be Updated", required = true) String data,
@Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws JsonProcessingException {
- Response response = null;
String url = request.getMethod() + " " + request.getRequestURI();
log.debug(START_HANDLE_REQUEST_OF, url);
@@ -474,16 +464,15 @@ public class ServiceServlet extends AbstractValidationsServlet {
updatedProperties = actionResponse.left().value();
ObjectMapper mapper = new ObjectMapper();
String result = mapper.writeValueAsString(updatedProperties);
- response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), result);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), result);
}
else{
- response = buildErrorResponse(actionResponse.right().value());
+ return buildErrorResponse(actionResponse.right().value());
}
} catch (Exception e) {
log.error("Exception occured during update Group Instance property values: {}", e.getMessage(), e);
throw e;
}
- return response;
}
@GET
@@ -508,7 +497,6 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
String serviceIdLower = serviceId.toLowerCase();
log.debug("get service with id {}", serviceId);
@@ -516,8 +504,7 @@ public class ServiceServlet extends AbstractValidationsServlet {
if (actionResponse.isRight()) {
log.debug("failed to get service");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
Service service = actionResponse.left().value();
@@ -552,13 +539,11 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
Either<Service, ResponseFormat> actionResponse = serviceBusinessLogic.getServiceByNameAndVersion(serviceName, serviceVersion, userId);
if (actionResponse.isRight()) {
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
Service service = actionResponse.left().value();
@@ -594,13 +579,11 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
Either<Service, ResponseFormat> distResponse = serviceBusinessLogic.activateDistribution(serviceId, env, modifier, request);
if (distResponse.isRight()) {
log.debug("failed to activate service distribution");
- response = buildErrorResponse(distResponse.right().value());
- return response;
+ return buildErrorResponse(distResponse.right().value());
}
Service service = distResponse.left().value();
Object result = null;
@@ -638,14 +621,12 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
Either<Service, ResponseFormat> distResponse = serviceBusinessLogic.markDistributionAsDeployed(serviceId, did, modifier);
if (distResponse.isRight()) {
log.debug("failed to mark distribution as deployed");
- response = buildErrorResponse(distResponse.right().value());
- return response;
+ return buildErrorResponse(distResponse.right().value());
}
Service service = distResponse.left().value();
Object result = RepresentationUtils.toRepresentation(service);
@@ -674,13 +655,12 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response;
try {
Service service = (serviceBusinessLogic.getService(serviceId, modifier)).left().value();
Either<Service, ResponseFormat> res = serviceBusinessLogic.updateDistributionStatusForActivation(service, modifier, DistributionStatusEnum.DISTRIBUTED);
if (res.isRight()) {
- response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
+ buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
}
return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), null);
} catch (Exception e) {
@@ -714,7 +694,6 @@ public class ServiceServlet extends AbstractValidationsServlet {
modifier.setUserId(userId);
log.debug(MODIFIER_ID_IS, userId);
- Response response = null;
try {
String serviceIdLower = serviceId.toLowerCase();
log.debug("get service components relations with id {}", serviceId);
@@ -722,8 +701,7 @@ public class ServiceServlet extends AbstractValidationsServlet {
if (actionResponse.isRight()) {
log.debug("failed to get service relations data");
- response = buildErrorResponse(actionResponse.right().value());
- return response;
+ return buildErrorResponse(actionResponse.right().value());
}
ServiceRelations serviceRelations = actionResponse.left().value();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
index 3e4907721d..74704caa64 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
@@ -177,11 +177,6 @@ public class CapabilityRequirementConverter {
private Object convertInstanceProperty(Map<String, DataTypeDefinition> dataTypes, ComponentInstance componentInstance, ComponentInstanceProperty prop) {
logger.debug("Convert property {} for instance {}", prop.getName(), componentInstance.getUniqueId());
- String propertyType = prop.getType();
- String innerType = null;
- if (prop.getSchema() != null && prop.getSchema().getProperty() != null) {
- innerType = prop.getSchema().getProperty().getType();
- }
String propValue = prop.getValue() == null ? prop.getDefaultValue() : prop.getValue();
return propertyConvertor.convertToToscaObject(prop, propValue, dataTypes, false);
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
index 03c08baf92..503ae856ca 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
@@ -76,7 +76,6 @@ public class SdcSchemaBuilder {
* @return true if the create operation was successful
*/
public boolean createSchema() {
- boolean res = false;
try(Cluster cluster = sdcSchemaUtils.createCluster();
Session session = cluster.connect()) {
log.info("creating Schema for Cassandra.");
@@ -99,12 +98,11 @@ public class SdcSchemaBuilder {
Map<String, List<String>> keyspaceMetadate = cassndraMetadata.get(keyspace.getKey());
createTables(keyspace.getValue(), keyspaceMetadate, session,metadataTablesStructure.get(keyspace.getKey()));
}
- res = true;
+ return true;
} catch (Exception e) {
log.error(EcompLoggerErrorCode.SCHEMA_ERROR, "creating Schema for Cassandra", "Cassandra", e.getLocalizedMessage());
- res = false;
+ return false;
}
- return res;
}
public boolean deleteSchema() {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
index 2174c8d295..8d2f24e6fa 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
@@ -1257,8 +1257,6 @@ public class JanusGraphGenericDao {
}
private JanusGraphOperationStatus lockNode(String lockId) {
- JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
-
GraphNodeLock lockNode = new GraphNodeLock(lockId);
Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew = createNode(lockNode, GraphNodeLock.class);
@@ -1271,19 +1269,17 @@ public class JanusGraphGenericDao {
JanusGraph tGraph = graph.left().value();
Either<JanusGraphVertex, JanusGraphOperationStatus> vertex = getVertexByProperty(lockNode.getUniqueIdKey(), lockNode.getUniqueId());
if (vertex.isLeft()) {
- status = relockNode(lockNode, lockNodeNew, tGraph, vertex);
+ return relockNode(lockNode, lockNodeNew, tGraph, vertex);
} else {
- status = vertex.right().value();
+ return vertex.right().value();
}
} else {
- status = graph.right().value();
+ return graph.right().value();
}
}
- return status;
}
private JanusGraphOperationStatus relockNode(GraphNodeLock lockNode, Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew, JanusGraph tGraph, Either<JanusGraphVertex, JanusGraphOperationStatus> vertex) {
- JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
Long time = vertex.left().value().value(GraphPropertiesDictionary.CREATION_DATE.getProperty());
Long lockTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphLockTimeout();
if (time + lockTimeout * 1000 < System.currentTimeMillis()) {
@@ -1296,14 +1292,13 @@ public class JanusGraphGenericDao {
} else {
log.debug("Failed Lock node for {} . Commit transacton for deleted previous vertex .", lockNode.getUniqueIdKey());
janusGraphClient.commit();
- status = checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
+ return checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
}
} else {
log.debug("Failed Lock node for {} rollback transacton", lockNode.getUniqueIdKey());
janusGraphClient.rollback();
- status = checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
+ return checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
}
- return status;
}
public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, boolean withEdges) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
index 3624bb353c..729d3c57da 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
@@ -985,18 +985,16 @@ public class JanusGraphDao {
public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel,
EdgeLabelEnum newLabel) {
- JanusGraphOperationStatus result = null;
Iterator<Edge> prevEdgeIter = toVertex.edges(Direction.IN, prevLabel.name());
if (prevEdgeIter == null || !prevEdgeIter.hasNext()) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG,
"Failed to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel,
fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
- result = JanusGraphOperationStatus.NOT_FOUND;
+ return JanusGraphOperationStatus.NOT_FOUND;
} else {
- result = replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
+ return replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
}
- return result;
}
/**
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
index a2b0adb4fe..13ff206ad8 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
@@ -110,8 +110,6 @@ public class PluginStatusBL {
}
public String getPluginsList() {
- String result = null;
-
if (pluginsConfiguration == null || pluginsConfiguration.getPluginsList() == null) {
log.warn("Configuration of type {} was not found", PluginsConfiguration.class);
throw new InvalidArgumentException("the plugin configuration was not read successfully.");
@@ -119,9 +117,8 @@ public class PluginStatusBL {
} else {
log.debug("The value returned from getConfig is {}", pluginsConfiguration);
- result = gson.toJson(pluginsConfiguration.getPluginsList());
+ return gson.toJson(pluginsConfiguration.getPluginsList());
}
- return result;
}
public String getPluginAvailability(String pluginId) {
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java
index c9d660a48e..18c6a645c4 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java
@@ -94,8 +94,6 @@ public class PortalServlet extends HttpServlet {
// Check if we got header from webseal
String userId = request.getHeader(Constants.WEBSEAL_USER_ID_HEADER);
- String firstNameFromCookie = "";
- String lastNameFromCookie = "";
if (null == userId) {
// Authentication via ecomp portal
try {
@@ -148,8 +146,8 @@ public class PortalServlet extends HttpServlet {
if (allHeadersExist) {
addCookies(response, mutableRequest, getMandatoryHeaders(request));
addCookies(response, mutableRequest, getOptionalHeaders(request));
- firstNameFromCookie = getValueFromCookie(request, Constants.HTTP_CSP_FIRSTNAME );
- lastNameFromCookie = getValueFromCookie(request, Constants.HTTP_CSP_LASTNAME);
+ getValueFromCookie(request, Constants.HTTP_CSP_FIRSTNAME );
+ getValueFromCookie(request, Constants.HTTP_CSP_LASTNAME);
//To be fixed
//addAuthCookie(response, userId, firstNameFromCookie, lastNameFromCookie);
@@ -162,7 +160,6 @@ public class PortalServlet extends HttpServlet {
boolean addAuthCookie(HttpServletResponse response, String userId, String firstName, String lastName) throws IOException {
boolean isBuildCookieCompleted = true;
- AuthenticationCookie authenticationCookie = null;
Cookie authCookie = null;
Configuration.CookieConfig confCookie =
ConfigurationManager.getConfigurationManager().getConfiguration().getAuthCookie();
@@ -171,7 +168,7 @@ public class PortalServlet extends HttpServlet {
String encryptedCookie = "";
try {
- authenticationCookie = new AuthenticationCookie(userId, firstName, lastName);
+ AuthenticationCookie authenticationCookie = new AuthenticationCookie(userId, firstName, lastName);
String cookieAsJson = RepresentationUtils.toRepresentation(authenticationCookie);
encryptedCookie = org.onap.sdc.security.CipherUtil.encryptPKC(cookieAsJson, confCookie.getSecurityKey());
} catch (Exception e) {
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) {
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/services/ValidationFactory.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/services/ValidationFactory.java
index 139f6ffd99..a6c25fbec6 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/services/ValidationFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/services/ValidationFactory.java
@@ -66,8 +66,7 @@ public class ValidationFactory {
}
private static Validator cerateValidatorImpl(ImplementationConfiguration validatorConf) {
- Validator validator = null;
- validator =
+ Validator validator =
CommonMethods.newInstance(validatorConf.getImplementationClass(), Validator.class);
validator.init(validatorConf.getProperties());
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java
index c6284ce776..7d9aa27c46 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java
@@ -25,15 +25,13 @@ import java.text.SimpleDateFormat;
public class VendorLicenseUtil {
public static String getIsoFormatDate(String inputDate) {
- String isoFormatDate = null;
SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
SimpleDateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yyyy'T'HH:mm:ss'Z'");
try {
- isoFormatDate = isoDateFormat.format(inputDateFormat.parse(inputDate));
+ return isoDateFormat.format(inputDateFormat.parse(inputDate));
} catch (ParseException e) {
- isoFormatDate = null;
+ return null;
}
- return isoFormatDate;
}
}
diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
index 9780c09936..3d4e772006 100644
--- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
+++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
@@ -53,10 +53,6 @@ public class Login extends HttpServlet {
System.out.println("about to build login page");
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
- String message = (String) request.getAttribute("message");
- if (message == null) {
- message = "";
- }
Collection<User> allUsers = Conf.getInstance().getUsers().values();
writer.println("<html>");
diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java
index d03b93c727..7aa48e62cf 100644
--- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java
+++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java
@@ -134,19 +134,9 @@ public class RequestsClient extends HttpServlet {
try {
result = IOUtils.toString(con.getErrorStream());
response.append(result);
-
} catch (Exception e2) {
- result = null;
- }
- // logger.debug("Response body: {}", response);
-
- if (response != null) {
- responseString = response.toString();
}
- // Map<String, List<String>> headerFields = con.getHeaderFields();
- // String responseMessage = con.getResponseMessage();
-
con.disconnect();
return responseCode;