aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src
diff options
context:
space:
mode:
authorvempo <vitaliy.emporopulo@amdocs.com>2018-01-16 18:34:43 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-01-17 07:43:58 +0000
commit4f0e3326c4c83bac26a30f77c8bf55139b38aa2c (patch)
tree6a46504be723d40ce7bc370aff48892c1b7663ad /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src
parent6c03bbdc00dd380b1232a543b72a5e909c3af46d (diff)
Removed MDC from VSP manager module
Change-Id: If9dfd50e7ae328b4d64be93ab085eb0ffc6cfc83 Issue-ID: SDC-772 Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java42
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java51
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java27
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java35
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java48
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java31
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java34
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java84
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java18
14 files changed, 90 insertions, 375 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java
index 81bbe356c3..596ce5010f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java
@@ -1,15 +1,25 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
@@ -22,8 +32,6 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
public class ComponentDependencyModelManagerImpl implements ComponentDependencyModelManager {
- protected static final Logger logger =
- LoggerFactory.getLogger(ComponentDependencyModelManagerImpl.class);
private ComponentManager componentManager;
private ComponentDependencyModelDao componentDependencyModelDao;
@@ -34,13 +42,6 @@ public class ComponentDependencyModelManagerImpl implements ComponentDependencyM
this.componentDependencyModelDao = componentDependencyModelDao;
}
- private void raiseException(ErrorCode errorCode) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message());
- throw new CoreException(errorCode);
- }
-
@Override
public Collection<ComponentDependencyModelEntity> list(String vspId, Version version) {
return componentDependencyModelDao
@@ -65,12 +66,12 @@ public class ComponentDependencyModelManagerImpl implements ComponentDependencyM
if (entity.getSourceComponentId().equals(entity.getTargetComponentId())) {
ErrorCode errorCode =
ComponentDependencyModelErrorBuilder.getSourceTargetComponentEqualErrorBuilder();
- raiseException(errorCode);
+ throw new CoreException(errorCode);
}
} else {
ErrorCode errorCode = ComponentDependencyModelErrorBuilder
.getNoSourceComponentErrorBuilder();
- raiseException(errorCode);
+ throw new CoreException(errorCode);
}
if (!StringUtils.isEmpty(entity.getTargetComponentId())) {
@@ -90,17 +91,14 @@ public class ComponentDependencyModelManagerImpl implements ComponentDependencyM
@Override
public void update(ComponentDependencyModelEntity entity) {
- ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(
- entity.getVspId(), entity.getVersion(), entity.getId());
+ getComponentDependency(entity.getVspId(), entity.getVersion(), entity.getId());
validateComponentDependency(entity);
componentDependencyModelDao.update(entity);
}
@Override
public ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId) {
- ComponentDependencyModelEntity componentDependency =
- getComponentDependency(vspId, version, dependencyId);
- return componentDependency;
+ return getComponentDependency(vspId, version, dependencyId);
}
private ComponentDependencyModelEntity getComponentDependency(String vspId, Version version,
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
index 16f40d64e0..67867d52f6 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
@@ -1,9 +1,6 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.impl;
@@ -23,14 +19,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -38,7 +29,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -83,9 +73,6 @@ public class ComponentManagerImpl implements ComponentManager {
@Override
public void deleteComponents(String vspId, Version version) {
if (!vspInfoDao.isManual(vspId, version)) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_COMPONENT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete component");
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
@@ -98,11 +85,8 @@ public class ComponentManagerImpl implements ComponentManager {
ComponentEntity createdComponent;
if (!vspInfoDao.isManual(component.getVspId(), component.getVersion())) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create component");
throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ new ErrorCode.ErrorCodeBuilder()
.withId(VendorSoftwareProductErrorCodes.VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING)
.withMessage(vfcAddNotAllowedInHeatOnboardingMsg).build());
} else {
@@ -128,25 +112,17 @@ public class ComponentManagerImpl implements ComponentManager {
Collection<ComponentEntity> vspComponentList =
listComponents(component.getVspId(), component.getVersion());
- if (!vspComponentList.isEmpty()) //1707 release only supports 1 VFC in VSP (manual creation)
- {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create component: "
- + "vsp component count exceed");
+ if (!vspComponentList.isEmpty()) {
+ //1707 release only supports 1 VFC in VSP (manual creation)
throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ new ErrorCode.ErrorCodeBuilder()
.withId(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED)
.withMessage(vspVfcCountExceedMsg).build());
}
if (!isVfcNameUnique(vspComponentList,
component.getComponentCompositionData().getDisplayName())) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create component: "
- + "vsp component duplicate name");
throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ new ErrorCode.ErrorCodeBuilder()
.withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
.withMessage(vspVfcDuplicateNameMsg).build());
}
@@ -199,12 +175,8 @@ public class ComponentManagerImpl implements ComponentManager {
}
if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData()
.getDisplayName())) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_COMPONENT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Component with same name already " +
- "exists for specified VSP");
throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ new ErrorCode.ErrorCodeBuilder()
.withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
.withMessage("VFC with specified name already present in given VSP.").build());
@@ -231,9 +203,6 @@ public class ComponentManagerImpl implements ComponentManager {
@Override
public void deleteComponent(String vspId, Version version, String componentId) {
if (!vspInfoDao.isManual(vspId, version)) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_COMPONENT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete component");
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
index 32946a0aa9..a074557d13 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
@@ -21,13 +21,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.json.JsonSchemaDataGenerator;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
@@ -39,7 +34,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
@@ -82,10 +76,6 @@ public class ComputeManagerImpl implements ComputeManager {
if (!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
.getAddComputeNotSupportedHeatOnboardMethodErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_COMPUTE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- onboardingMethodUpdateErrorCode.message());
throw new CoreException(onboardingMethodUpdateErrorCode);
} else {
validateUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
@@ -106,10 +96,7 @@ public class ComputeManagerImpl implements ComputeManager {
String componentId) {
Collection<ComputeEntity> computes =
computeDao.list(new ComputeEntity(vspId, version, componentId, null));
-
- Collection<ListComputeResponse> computeResponse =
- getListComputeResponse(vspId, version, computes);
- return computeResponse;
+ return getListComputeResponse(vspId, version, computes);
}
private Collection<ListComputeResponse> getListComputeResponse(String vspId, Version version,
@@ -232,11 +219,6 @@ public class ComputeManagerImpl implements ComputeManager {
final ErrorCode updateHeatComputeErrorBuilder =
DuplicateComputeInComponentErrorBuilder.getComputeHeatReadOnlyErrorBuilder(name);
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_COMPUTE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- updateHeatComputeErrorBuilder.message());
throw new CoreException(updateHeatComputeErrorBuilder);
}
}
@@ -258,11 +240,8 @@ public class ComputeManagerImpl implements ComputeManager {
"Composition entities may not be created / deleted for Vendor Software Product "
+ "whose entities were uploaded";
if (!vspInfoDao.isManual(vspId, version)) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_COMPUTE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete compute");
throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ new ErrorCode.ErrorCodeBuilder()
.withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED)
.withMessage(vspCompositionEditNotAllowedMsg).build());
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
index b32ed637e2..56678abfd5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
@@ -19,11 +19,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
@@ -33,7 +29,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.DeploymentFlavorErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
@@ -81,9 +76,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
deploymentFlavorEntity.getVersion())) {
ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
.getAddDeploymentNotSupportedHeatOnboardErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), deploymentFlavorErrorBuilder.message());
throw new CoreException(deploymentFlavorErrorBuilder);
} else {
validateDeploymentFlavor(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
@@ -110,9 +102,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
.getFeatureGroupNotexistErrorBuilder(featureGroup, deploymentFlavorEntity.getVspId(),
version);
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), deploymentFlavorErrorBuilder.message());
throw new CoreException(deploymentFlavorErrorBuilder);
}
validateComponentComputeAssociation(deploymentFlavorEntity, version);
@@ -127,9 +116,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
.getDuplicateDeploymentFlavorModelErrorBuilder(
deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel(),
deploymentFlavorEntity.getVspId());
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), deploymentFlavorModelErrorBuilder.message());
throw new CoreException(deploymentFlavorModelErrorBuilder);
}
});
@@ -174,10 +160,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
if (vfcCount != 1) {
ErrorCode duplicateVfcAssociationErrorBuilder = DeploymentFlavorErrorBuilder
.getDuplicateVfcAssociationErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(),
- duplicateVfcAssociationErrorBuilder.message());
throw new CoreException(duplicateVfcAssociationErrorBuilder);
}
}
@@ -196,9 +178,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
.getComputeFlavorId().trim().length() > 0)) {
ErrorCode invalidAssociationErrorBuilder = DeploymentFlavorErrorBuilder
.getInvalidAssociationErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), invalidAssociationErrorBuilder.message());
throw new CoreException(invalidAssociationErrorBuilder);
} else if (componentComputeAssociation.getComponentId() != null
&& componentComputeAssociation.getComponentId().trim().length() > 0) {
@@ -222,10 +201,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
ErrorCode invalidComputeIdErrorBuilder = DeploymentFlavorErrorBuilder
.getInvalidComputeIdErrorBuilder(componentComputeAssociation.getComputeFlavorId(),
componentComputeAssociation.getComponentId());
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(),
- invalidComputeIdErrorBuilder.message());
throw new CoreException(invalidComputeIdErrorBuilder);
}
}
@@ -288,10 +263,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
final ErrorCode deleteDeploymentFlavorErrorBuilder =
NotSupportedHeatOnboardMethodErrorBuilder
.getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- deleteDeploymentFlavorErrorBuilder.message());
throw new CoreException(deleteDeploymentFlavorErrorBuilder);
}
if (deploymentFlavorEntity != null) {
@@ -308,10 +279,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
final ErrorCode updateDeploymentFlavorErrorBuilder =
NotSupportedHeatOnboardMethodErrorBuilder
.getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- updateDeploymentFlavorErrorBuilder.message());
throw new CoreException(updateDeploymentFlavorErrorBuilder);
}
DeploymentFlavorEntity retrieved =
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
index efc50908cf..6451768119 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
@@ -21,11 +21,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.ImageManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -34,7 +30,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.ImageErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -71,11 +66,6 @@ public class ImageManagerImpl implements ImageManager {
if (!isManual) {
ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder
.getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_IMAGE, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message());
-
throw new CoreException(errorCode);
}
compositionEntityDataManager.createImage(imageEntity);
@@ -84,9 +74,7 @@ public class ImageManagerImpl implements ImageManager {
@Override
public Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
- Collection<ImageEntity> imageEntities =
- imageDao.list(new ImageEntity(vspId, version, componentId, null));
- return imageEntities;
+ return imageDao.list(new ImageEntity(vspId, version, componentId, null));
}
@Override
@@ -136,10 +124,6 @@ public class ImageManagerImpl implements ImageManager {
final ErrorCode deleteImageErrorBuilder =
NotSupportedHeatOnboardMethodErrorBuilder
.getDelImageNotSupportedHeatOnboardMethodErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_IMAGE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- deleteImageErrorBuilder.message());
throw new CoreException(deleteImageErrorBuilder);
}
if (imageEntity != null) {
@@ -151,11 +135,6 @@ public class ImageManagerImpl implements ImageManager {
if (value != null && !value.equals(retrivedValue)) {
final ErrorCode updateHeatImageErrorBuilder =
ImageErrorBuilder.getImageHeatReadOnlyErrorBuilder(name);
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- updateHeatImageErrorBuilder.message());
throw new CoreException(updateHeatImageErrorBuilder);
}
}
@@ -207,9 +186,6 @@ public class ImageManagerImpl implements ImageManager {
}
} catch (IllegalArgumentException exception) {
ErrorCode errorCode = ImageErrorBuilder.getInvalidImageFormatErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message() + exception);
throw new CoreException(errorCode, exception);
}
@@ -227,11 +203,6 @@ public class ImageManagerImpl implements ImageManager {
if (!isImageVersionUnique(vspId, version, componentId, imageId, image)) {
ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageVersionErrorBuilder(image
.getVersion(), componentId);
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message());
-
throw new CoreException(errorCode);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
index 367d2a9c21..1d8c0b430d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
@@ -1,15 +1,26 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.MapUtils;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService;
import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService;
@@ -21,7 +32,8 @@ import java.util.Map;
import java.util.Optional;
public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
- private ManualVspDataCollectionService
+
+ private final ManualVspDataCollectionService
manualVspDataCollectionService = new ManualVspDataCollectionService();
@Override
@@ -33,10 +45,6 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version);
} catch (Exception ex) {
releaseVendor = Optional.empty();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Release Vendor not found : "
- + ex.getMessage());
}
releaseVendor.ifPresent(vspModelInfo::setReleaseVendor);
@@ -45,10 +53,6 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
try {
allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version);
} catch (Exception ex) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors : "
- + ex.getMessage());
allowedFlavors = null;
}
if (MapUtils.isNotEmpty(allowedFlavors)) {
@@ -61,10 +65,6 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
vspComponentImages =
manualVspDataCollectionService.getVspComponentImages(vspId, version);
} catch (Exception ex) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images : "
- + ex.getMessage());
vspComponentImages = null;
}
if (MapUtils.isNotEmpty(vspComponentImages)) {
@@ -76,10 +76,6 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
try {
vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version);
} catch (Exception ex) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components : "
- + ex.getMessage());
vspComponents = null;
}
if (MapUtils.isNotEmpty(vspComponents)) {
@@ -91,10 +87,6 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
try {
vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version);
} catch (Exception ex) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics : "
- + ex.getMessage());
vspComponentNics = null;
}
if (MapUtils.isNotEmpty(vspComponentNics)) {
@@ -106,8 +98,6 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
@Override
public ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo) {
ManualVspToscaGenerationService vspToscaGenerator = new ManualVspToscaGenerationService();
- ToscaServiceModel manualVspToscaServiceModel =
- vspToscaGenerator.createManualVspToscaServiceModel(vspModelInfo);
- return manualVspToscaServiceModel;
+ return vspToscaGenerator.createManualVspToscaServiceModel(vspModelInfo);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
index d32c09b7da..b2a1bf3218 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
@@ -28,13 +28,6 @@ import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerErrorDescription;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
@@ -59,11 +52,8 @@ import java.util.Optional;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
+
private final ComponentArtifactDao componentArtifactDao;
- private static final Logger logger =
- LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
- private static final String INVALID = "Invalid ";
- private static final String VSP_ID_COMPONENT_ID = "VSP id, component id";
MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao) {
this.componentArtifactDao = componentArtifactDao;
@@ -98,10 +88,6 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
Version version, String componentId,
MonitoringUploadType type) {
if (object == null) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), INVALID + type
- .toString() + " zip file");
throw new CoreException(new MonitoringUploadErrorBuilder(
getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
"zip")).build());
@@ -115,10 +101,6 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
validateVesEventUpload(upload, errors);
}
if (MapUtils.isNotEmpty(errors)) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), INVALID + type
- .toString() + " zip file");
throw new CoreException(
new MonitoringUploadErrorBuilder(
errors.values().iterator().next().get(0).getMessage())
@@ -129,14 +111,9 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
uploadedFileData);
} catch (Exception exception) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), INVALID + type
- .toString() + "zip file");
throw new CoreException(new MonitoringUploadErrorBuilder(exception.getMessage()).build());
}
}
- logger.audit("Uploaded Monitoring File for component id:" + componentId + " ,vspId:" + vspId);
}
private void validateVesEventUpload(FileContentHandler upload,
@@ -145,9 +122,6 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
.add(new ErrorMessage(ErrorLevel.ERROR,
Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage()));
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.VALIDATE_MONITORING_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VES_FILE);
throw new CoreException(
new MonitoringUploadErrorBuilder(
Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage())
@@ -230,9 +204,6 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData);
VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
} catch (IOException exception) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.VALIDATE_MONITORING_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid Monitoring zip file");
throw new CoreException(
new MonitoringUploadErrorBuilder(vspId, version,
Messages.INVALID_ZIP_FILE.getErrorMessage())
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
index 027d7a1664..53f3782183 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
@@ -18,18 +18,13 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
@@ -45,14 +40,14 @@ import java.util.Collection;
public class NetworkManagerImpl implements NetworkManager {
private final NetworkDao networkDao;
private final CompositionEntityDataManager compositionEntityDataManager;
- private final VendorSoftwareProductInfoDao VSPInfoDao;
+ private final VendorSoftwareProductInfoDao vspInfoDao;
public NetworkManagerImpl(NetworkDao networkDao,
CompositionEntityDataManager compositionEntityDataManager,
VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao) {
this.networkDao = networkDao;
this.compositionEntityDataManager = compositionEntityDataManager;
- this.VSPInfoDao = vendorSoftwareProductInfoDao;
+ this.vspInfoDao = vendorSoftwareProductInfoDao;
}
@Override
@@ -62,10 +57,7 @@ public class NetworkManagerImpl implements NetworkManager {
@Override
public NetworkEntity createNetwork(NetworkEntity network) {
- if (!VSPInfoDao.isManual(network.getVspId(), network.getVersion())) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_NETWORK, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create network");
+ if (!vspInfoDao.isManual(network.getVspId(), network.getVersion())) {
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(network.getVspId(), network.getVersion())
.build());
@@ -78,7 +70,7 @@ public class NetworkManagerImpl implements NetworkManager {
NetworkEntity retrieved = getValidatedNetwork(network.getVspId(), network.getVersion(), network.getId());
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
- schemaInput.setManual(!VSPInfoDao.isManual(network.getVspId(), network.getVersion()));
+ schemaInput.setManual(!vspInfoDao.isManual(network.getVspId(), network.getVersion()));
schemaInput.setNetwork(retrieved.getNetworkCompositionData());
CompositionEntityValidationData validationData = compositionEntityDataManager
@@ -96,7 +88,7 @@ public class NetworkManagerImpl implements NetworkManager {
Network network = networkEntity.getNetworkCompositionData();
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
- schemaInput.setManual(!VSPInfoDao.isManual(vspId, version));
+ schemaInput.setManual(!vspInfoDao.isManual(vspId, version));
schemaInput.setNetwork(network);
CompositionEntityResponse<Network> response = new CompositionEntityResponse<>();
@@ -116,10 +108,7 @@ public class NetworkManagerImpl implements NetworkManager {
@Override
public void deleteNetwork(String vspId, Version version, String networkId) {
- if (!VSPInfoDao.isManual(vspId, version)) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_NETWORK, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete network");
+ if (!vspInfoDao.isManual(vspId, version)) {
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
index 35157264aa..a4fa6be1d8 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
@@ -19,11 +19,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
@@ -99,10 +94,6 @@ public class NicManagerImpl implements NicManager {
if (!vspInfoDao.isManual(nic.getVspId(), nic.getVersion())) {
ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
.getAddNicNotSupportedHeatOnboardMethodErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- onboardingMethodUpdateErrorCode.message());
throw new CoreException(onboardingMethodUpdateErrorCode);
} else {
validateNic(nic);
@@ -123,11 +114,6 @@ public class NicManagerImpl implements NicManager {
.matches(VendorSoftwareProductConstants.NAME_PATTERN)) {
ErrorCode errorCode = NicErrorBuilder
.getNicNameFormatErrorBuilder(VendorSoftwareProductConstants.NAME_PATTERN);
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
- errorCode.id(),errorCode.message());
-
throw new CoreException(errorCode);
}
@@ -140,10 +126,6 @@ public class NicManagerImpl implements NicManager {
&& !(networkId == null || networkId.isEmpty())) {
final ErrorCode nicNetworkIdNotAllowedExternalNetworkErrorBuilder =
new NicNetworkIdNotAllowedExternalNetworkErrorBuilder().build();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(),
- nicNetworkIdNotAllowedExternalNetworkErrorBuilder.message());
throw new CoreException(nicNetworkIdNotAllowedExternalNetworkErrorBuilder);
}
}
@@ -157,9 +139,6 @@ public class NicManagerImpl implements NicManager {
if (!(networkDescription == null || networkDescription.isEmpty())) {
final ErrorCode nicNetworkDescriptionErrorBuilder =
NicInternalNetworkErrorBuilder.getNetworkDescriptionInternalNetworkErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), nicNetworkDescriptionErrorBuilder.message());
throw new CoreException(nicNetworkDescriptionErrorBuilder);
}
}
@@ -171,10 +150,6 @@ public class NicManagerImpl implements NicManager {
final ErrorCode duplicateNicInComponentErrorBuilder =
new DuplicateNicInComponentErrorBuilder(nic.getNicCompositionData().getName(),
nic.getComponentId()).build();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(),
- duplicateNicInComponentErrorBuilder.message());
throw new CoreException(duplicateNicInComponentErrorBuilder);
}
@@ -216,10 +191,6 @@ public class NicManagerImpl implements NicManager {
if (!vspInfoDao.isManual(vspId, version)) {
final ErrorCode deleteNicErrorBuilder =
DeleteNicErrorBuilder.getDeleteNicForHeatOnboardedVspErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_NIC, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- deleteNicErrorBuilder.message());
throw new CoreException(deleteNicErrorBuilder);
}
@@ -240,11 +211,6 @@ public class NicManagerImpl implements NicManager {
.matches(VendorSoftwareProductConstants.NAME_PATTERN)) {
ErrorCode errorCode = NicErrorBuilder
.getNicNameFormatErrorBuilder(VendorSoftwareProductConstants.NAME_PATTERN);
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_NIC, ErrorLevel.ERROR.name(),
- errorCode.id(),errorCode.message());
-
throw new CoreException(errorCode);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
index 77eeb394c7..3a17e453af 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
@@ -48,6 +48,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -117,10 +118,8 @@ public class OrchestrationTemplateCandidateManagerImpl
if (validateErrors.isPresent()) {
List<ErrorMessage> errorMessages = validateErrors.get();
if (CollectionUtils.isNotEmpty(errorMessages)) {
- Map<String, List<ErrorMessage>> errorsMap = new HashMap<>();
- errorsMap.put(SdcCommon.UPLOAD_FILE, errorMessages);
- response.setUploadDataErrors(errorsMap,
- LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE);
+ Map<String, List<ErrorMessage>> errorsMap = Collections.singletonMap(SdcCommon.UPLOAD_FILE, errorMessages);
+ response.setUploadDataErrors(errorsMap);
return response;
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
index 3ec8c7ae2f..1bdb9b2a28 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
@@ -19,13 +19,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.ProcessManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
@@ -44,10 +38,10 @@ import java.nio.ByteBuffer;
import java.util.Collection;
public class ProcessManagerImpl implements ProcessManager {
+
private static final String PROCESS_ARTIFACT_NOT_EXIST_MSG =
"Process artifact for process with Id %s does not exist for %s with Id %s and version %s";
private final ProcessDao processDao;
- private static final String VSP_ID_COMPONENT_ID = "VSP id, component id";
public ProcessManagerImpl(ProcessDao processDao) {
this.processDao = processDao;
@@ -128,9 +122,6 @@ public class ProcessManagerImpl implements ProcessManager {
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(retrieved.getArtifact().array());
} catch (IOException exception) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get process artifact");
throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
}
return file;
@@ -163,17 +154,11 @@ public class ProcessManagerImpl implements ProcessManager {
private ByteBuffer readArtifact(InputStream artifactInputStream) {
if (artifactInputStream == null) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPLOAD_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't upload process artifact");
throw new CoreException(new UploadInvalidErrorBuilder().build());
}
try {
return ByteBuffer.wrap(FileUtils.toByteArray(artifactInputStream));
} catch (RuntimeException exception) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPLOAD_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't upload process artifact");
throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
}
}
@@ -192,7 +177,6 @@ public class ProcessManagerImpl implements ProcessManager {
VersioningUtil.validateEntityExistence(retrieved, inputProcess, VspDetails.ENTITY_TYPE);
if (retrieved.getArtifact() == null) {
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
.withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND)
.withMessage(String.format(PROCESS_ARTIFACT_NOT_EXIST_MSG,
processId, VspDetails.ENTITY_TYPE, vspId, version)).build());
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index d36f1bc8ce..0257c8d7c2 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -36,18 +36,13 @@ import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
-import org.openecomp.sdc.logging.messages.AuditMessages;
-import org.openecomp.sdc.logging.types.LoggerConstants;
-import org.openecomp.sdc.logging.types.LoggerErrorCode;
-import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.validation.util.ValidationManagerUtil;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
@@ -82,9 +77,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageInvalidErrorBuilder
import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
-import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
@@ -113,13 +106,19 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager {
- private static final Logger LOGGER =
- LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
private final OrchestrationTemplateDao orchestrationTemplateDao;
private final VendorSoftwareProductInfoDao vspInfoDao;
@@ -136,7 +135,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private final ComputeDao computeDao;
private final ImageDao imageDao;
private final ManualVspToscaManager manualVspToscaManager;
- private static final String PACKAGE_NOT_FOUND = "Package not found";
public VendorSoftwareProductManagerImpl(
OrchestrationTemplateDao orchestrationTemplateDataDao,
@@ -191,8 +189,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(),
vspDetails.getOnboardingMethod()));
- List<ErrorCode> vspErrors = new ArrayList<>();
- vspErrors.addAll(validateVspFields(vspDetails));
+ List<ErrorCode> vspErrors = new ArrayList<>(validateVspFields(vspDetails));
if (validateComponentDependencies(componentDependencies)) {
vspErrors
.add(ComponentDependencyModelErrorBuilder.getcyclicDependencyComponentErrorBuilder());
@@ -215,11 +212,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
.vendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(),
vspDetails.getVersion()));
}
- validationResponse.setUploadDataErrors(validateOrchestrationTemplate(orchestrationTemplate),
- LoggerTragetServiceName.SUBMIT_VSP);
+ validationResponse.setUploadDataErrors(validateOrchestrationTemplate(orchestrationTemplate));
}
validationResponse
- .setVspErrors(vspErrors, LoggerTragetServiceName.SUBMIT_VSP);
+ .setVspErrors(vspErrors);
validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails));
return validationResponse;
}
@@ -260,8 +256,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
.generateToscaModel(manualVspToscaManager.gatherVspInformation(vspId, version))
: serviceModelDao.getServiceModel(vspId, version);
- Map<String, List<ErrorMessage>> compilationErrors = compile(vspId, version, serviceModel);
- return compilationErrors;
+ return compile(vspId, version, serviceModel);
}
private boolean validateComponentDependencies(
@@ -447,15 +442,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
enrichmentManager.setModel(serviceModel);
Map<String, List<ErrorMessage>> enrichErrors = enrichmentManager.enrich();
- if (MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, enrichErrors))) {
- LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.ENRICHMENT_COMPLETED
- + vendorSoftwareProductId);
- } else {
- enrichErrors.values().forEach(errorList ->
- auditIfContainsErrors(errorList, vendorSoftwareProductId,
- AuditMessages.ENRICHMENT_ERROR));
- }
-
enrichedServiceModelDao
.storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel());
@@ -530,16 +516,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public VspDetails getVsp(String vspId, Version version) {
- VspDetails vsp = getValidatedVsp(vspId, version);
- return vsp;
+ return getValidatedVsp(vspId, version);
}
private VspDetails getValidatedVsp(String vspId, Version version) {
VspDetails vsp = vspInfoDao.get(new VspDetails(vspId, version));
if (vsp == null) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_VSP, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Requested VSP not found");
throw new CoreException(new VendorSoftwareProductNotFoundErrorBuilder(vspId).build());
}
return vsp;
@@ -547,9 +529,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public void deleteVsp(String vspId) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_VSP, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Unsupported operation");
throw new UnsupportedOperationException(
VendorSoftwareProductConstants.UNSUPPORTED_OPERATION_ERROR);
}
@@ -561,23 +540,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public File getTranslatedFile(String vspId, Version version) {
- String errorMessage;
-
PackageInfo packageInfo = packageInfoDao.get(new PackageInfo(vspId, version));
if (packageInfo == null) {
- errorMessage = PACKAGE_NOT_FOUND;
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage);
throw new CoreException(new PackageNotFoundErrorBuilder(vspId, version).build());
}
ByteBuffer translatedFileBuffer = packageInfo.getTranslatedFile();
if (translatedFileBuffer == null) {
- errorMessage = PACKAGE_NOT_FOUND;
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage);
throw new CoreException(new PackageInvalidErrorBuilder(vspId, version).build());
}
@@ -586,10 +555,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
try (FileOutputStream fos = new FileOutputStream(translatedFile)) {
fos.write(translatedFileBuffer.array());
} catch (IOException exception) {
- errorMessage = "Can't create package";
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_TRANSLATED_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage);
throw new CoreException(new TranslationFileCreationErrorBuilder(vspId, version).build(),
exception);
}
@@ -612,9 +577,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
new ByteArrayInputStream(contentData.array()))) {
zos.write(contentData.array());
} catch (IOException exception) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_UPLOADED_HEAT, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get uploaded HEAT");
throw new CoreException(new FileCreationErrorBuilder(vspId).build(), exception);
}
return baos.toByteArray();
@@ -626,7 +588,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public PackageInfo createPackage(String vspId, Version version) throws IOException {
+ public PackageInfo createPackage(String vspId, Version version) {
ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Version vlmVersion = vspDetails.getVlmVersion();
@@ -645,8 +607,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts)));
packageInfoDao.create(packageInfo);
-
- LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_PACKAGE + vspId);
return packageInfo;
}
@@ -820,14 +780,4 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return serviceModel != null && serviceModel.getEntryDefinitionServiceTemplate() != null;
}
- private void auditIfContainsErrors(List<ErrorMessage> errorList, String vspId, String auditType) {
- errorList.forEach(errorMessage -> {
- if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
- LOGGER.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
- vspId));
- }
- });
- }
-
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
index 769d55a320..cab205c212 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
@@ -44,16 +44,14 @@ public class ValidationResponse {
/**
* Sets vsp errors.
* @param vspErrors the vsp errors
- * @param targetServiceName the target service name
*/
- public void setVspErrors(Collection<ErrorCode> vspErrors,
- String targetServiceName) {
+ public void setVspErrors(Collection<ErrorCode> vspErrors) {
this.vspErrors = vspErrors;
if (CollectionUtils.isNotEmpty(vspErrors)) {
valid = false;
}
- VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors, targetServiceName);
+ VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors);
}
@@ -80,17 +78,15 @@ public class ValidationResponse {
/**
* Sets upload data errors.
* @param uploadDataErrors the upload data errors
- * @param targetServiceName the target service name
*/
- public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors,
- String targetServiceName) {
+ public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors) {
this.uploadDataErrors = uploadDataErrors;
if (MapUtils.isNotEmpty(uploadDataErrors)) {
valid = false;
}
VendorSoftwareProductUtils
- .setErrorsIntoLogger(uploadDataErrors, targetServiceName);
+ .setErrorsIntoLogger(uploadDataErrors);
}
public QuestionnaireValidationResult getQuestionnaireValidationResult() {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
index d5c6ab4c64..44bca4032e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
@@ -27,7 +27,6 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorDescription;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
@@ -103,15 +102,8 @@ public class VendorSoftwareProductUtils {
/**
* Sets errors into logger.
* @param errors the errors
- * @param targetServiceName the target service name
*/
- public static void setErrorsIntoLogger(Map<String, List<ErrorMessage>> errors,
- String targetServiceName) {
- MdcDataErrorMessage mdcDataErrorMessage =
- new MdcDataErrorMessage(targetServiceName, LoggerConstants.TARGET_ENTITY_DB,
- ErrorLevel.ERROR.name(), null, null);
- mdcDataErrorMessage.setMdcValues();
-
+ public static void setErrorsIntoLogger(Map<String, List<ErrorMessage>> errors) {
if (MapUtils.isEmpty(errors)) {
return;
}
@@ -127,14 +119,8 @@ public class VendorSoftwareProductUtils {
/**
* Sets errors into logger.
* @param errors the errors
- * @param targetServiceName the target service name
*/
- public static void setErrorsIntoLogger(Collection<ErrorCode> errors,
- String targetServiceName) {
- MdcDataErrorMessage mdcDataErrorMessage =
- new MdcDataErrorMessage(targetServiceName, LoggerConstants.TARGET_ENTITY_DB,
- ErrorLevel.ERROR.name(), null, null);
- mdcDataErrorMessage.setMdcValues();
+ public static void setErrorsIntoLogger(Collection<ErrorCode> errors) {
if (CollectionUtils.isEmpty(errors)) {
return;