import org.openecomp.sdc.activitylog.ActivityLogManager;
import org.openecomp.sdc.activitylog.dao.ActivityLogDao;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
public class ActivityLogManagerImpl implements ActivityLogManager {
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private ActivityLogDao activityLogDao;
public ActivityLogManagerImpl(ActivityLogDao activityLogDao) {
@Override
public void logActivity(ActivityLogEntity activityLogEntity) {
- mdcDataDebugMessage.debugEntryMessage("ITEM id", activityLogEntity.getItemId());
activityLogEntity.setId(CommonMethods.nextUuId());
activityLogDao.create(activityLogEntity);
}
@Override
public Collection<ActivityLogEntity> listLoggedActivities(String itemId, Version version) {
- mdcDataDebugMessage.debugEntryMessage("ITEM id", itemId);
return activityLogDao.list(new ActivityLogEntity(itemId, version));
}
}
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import java.util.Set;
public class ComputeManagerImpl implements ComputeManager {
-
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private final ComputeDao computeDao;
private final CompositionEntityDataManager compositionEntityDataManager;
private final VendorSoftwareProductInfoDao vspInfoDao;
@Override
public ComputeEntity createCompute(ComputeEntity compute) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, compute.getVspId(), compute.getComponentId());
-
if (!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
.getAddComputeNotSupportedHeatOnboardMethodErrorBuilder();
createUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
compute.getComputeCompositionData().getName());
}
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, compute.getVspId(), compute.getComponentId());
-
return compute;
}
@Override
public Collection<ListComputeResponse> listComputes(String vspId, Version version,
String componentId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
Collection<ComputeEntity> computes =
computeDao.list(new ComputeEntity(vspId, version, componentId, null));
Collection<ListComputeResponse> computeResponse =
getListComputeResponse(vspId, version, computes);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return computeResponse;
}
public CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version,
String componentId,
String computeFlavorId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID_COMPUTE_ID, vspId,
- componentId, computeFlavorId);
-
ComputeEntity computeEntity = getValidatedCompute(vspId, version, componentId, computeFlavorId);
ComputeData compute = computeEntity.getComputeCompositionData();
response.setId(computeFlavorId);
response.setData(compute);
response.setSchema(getComputeCompositionSchema(schemaInput));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID_COMPUTE_ID, vspId,
- componentId, computeFlavorId);
-
return response;
}
@Override
public QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String
componentId, String computeId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, componentId", vspId, componentId, computeId);
-
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
ComputeEntity computeQuestionnaire =
computeDao.getQuestionnaireData(vspId, version, componentId, computeId);
new ComputeEntity(vspId, version, componentId, computeId), VspDetails.ENTITY_TYPE);
questionnaireResponse.setData(computeQuestionnaire.getQuestionnaireData());
questionnaireResponse.setSchema(getComputeQuestionnaireSchema(null));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId, computeId);
-
return questionnaireResponse;
}
@Override
public void updateComputeQuestionnaire(String vspId, Version version, String componentId,
String computeId, String questionnaireData) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID_COMPUTE_ID, vspId, componentId, computeId);
-
ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId,
computeId));
VersioningUtil.validateEntityExistence(retrieved, new ComputeEntity(vspId, version,
componentId, computeId), VspDetails.ENTITY_TYPE);
computeDao.updateQuestionnaireData(vspId, version, componentId, computeId, questionnaireData);
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID_COMPUTE_ID, vspId, componentId, computeId);
}
@Override
public CompositionEntityValidationData updateCompute(ComputeEntity compute) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, compute.getVspId(), compute.getComponentId(),
- compute.getId());
-
ComputeEntity retrieved =
getComputeEntity(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
compute.getId());
compute.getComputeCompositionData().getName());
computeDao.update(compute);
}
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, compute.getVspId(), compute.getComponentId(),
- compute.getId());
-
return validationData;
}
final String vspCompositionEditNotAllowedMsg =
"Composition entities may not be created / deleted for Vendor Software Product "
+ "whose entities were uploaded";
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID_COMPUTE_ID, vspId,
- componentId, computeFlavorId);
-
if (!vspInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_COMPUTE, ErrorLevel.ERROR.name(),
deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
retrieved.getComputeCompositionData().getName());
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID_COMPUTE_ID, vspId,
- componentId, computeFlavorId);
}
private void deleteComputeFromDeploymentFlavors(String vspId, Version version,
}
protected String getComputeCompositionSchema(SchemaTemplateInput schemaInput) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return SchemaGenerator
.generate(SchemaTemplateContext.composition, CompositionEntityType.compute, schemaInput);
}
protected String getComputeQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return SchemaGenerator
.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute, schemaInput);
}
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import java.util.Map;
public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
-
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private final VendorSoftwareProductInfoDao vspInfoDao;
private final DeploymentFlavorDao deploymentFlavorDao;
private final CompositionEntityDataManager compositionEntityDataManager;
@Override
public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
return deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
}
public DeploymentFlavorEntity createDeploymentFlavor(
DeploymentFlavorEntity deploymentFlavorEntity) {
DeploymentFlavorEntity createDeploymentFlavor;
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id ", deploymentFlavorEntity.getVspId());
-
if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
deploymentFlavorEntity.getVersion())) {
ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId,
Version version,
String deploymentFlavorId) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_DEPLOYMENT_FLAVOR_ID, vspId, deploymentFlavorId);
-
DeploymentFlavorEntity deploymentFlavorEntity =
getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
DeploymentFlavor deploymentFlavor = deploymentFlavorEntity.getDeploymentFlavorCompositionData();
.generate(SchemaTemplateContext.composition, CompositionEntityType.deployment,
schemaInput));
response.setData(deploymentFlavor);
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage("VSP id, deployment flavor id ", vspId, deploymentFlavorId);
-
return response;
}
@Override
public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_DEPLOYMENT_FLAVOR_ID, vspId, deploymentFlavorId);
DeploymentFlavorEntity deploymentFlavorEntity =
getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
if (!vspInfoDao.isManual(vspId, version)) {
deploymentFlavorDao.delete(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
}
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_DEPLOYMENT_FLAVOR_ID, vspId, deploymentFlavorId);
}
@Override
public CompositionEntityValidationData updateDeploymentFlavor(
DeploymentFlavorEntity deploymentFlavorEntity) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, deploymentFlavor id", deploymentFlavorEntity
- .getVspId(), deploymentFlavorEntity.getId());
-
if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
deploymentFlavorEntity.getVersion())) {
final ErrorCode updateDeploymentFlavorErrorBuilder =
if (CollectionUtils.isEmpty(validationData.getErrors())) {
deploymentFlavorDao.update(deploymentFlavorEntity);
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, deploymentFlavor id",
- deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getId());
return validationData;
}
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import java.util.stream.Collectors;
public class ImageManagerImpl implements ImageManager {
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private final VendorSoftwareProductInfoDao vspInfoDao;
private final ImageDao imageDao;
private final CompositionEntityDataManager compositionEntityDataManager;
@Override
public Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
Collection<ImageEntity> imageEntities =
imageDao.list(new ImageEntity(vspId, version, componentId, null));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return imageEntities;
}
@Override
public CompositionEntityResponse<Image> getImageSchema(String vspId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, image id", vspId);
-
CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
ImageCompositionSchemaInput inputSchema = new ImageCompositionSchemaInput();
Image image = new Image();
inputSchema.setImage(image);
response.setSchema(getImageCompositionSchema(inputSchema));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, image id", vspId);
return response;
}
@Override
public CompositionEntityResponse<Image> getImage(String vspId, Version version, String
componentId, String imageId) {
-
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, componentId, image id", vspId, componentId,
- imageId);
ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
Image image = imageEntity.getImageCompositionData();
response.setId(imageId);
response.setData(image);
response.setSchema(getImageCompositionSchema(schemaInput));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, componentId, image id", vspId, componentId,
- imageId);
-
return response;
}
@Override
public QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String
componentId, String imageId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
ImageEntity retrieved = imageDao.getQuestionnaireData(vspId, version, componentId, imageId);
imageId), ComponentEntity.ENTITY_TYPE);
questionnaireResponse.setData(retrieved.getQuestionnaireData());
questionnaireResponse.setSchema(getImageQuestionnaireSchema(null));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
-
return questionnaireResponse;
}
@Override
public void deleteImage(String vspId, Version version, String componentId, String imageId) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId, imageId);
ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
if (!vspInfoDao.isManual(vspId, version)) {
final ErrorCode deleteImageErrorBuilder =
if (imageEntity != null) {
imageDao.delete(new ImageEntity(vspId, version, componentId, imageId));
}
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId, imageId);
}
private void validateHeatVspImageUpdate(String name, String value, String retrivedValue) {
@Override
public CompositionEntityValidationData updateImage(ImageEntity image) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, image.getVspId(), image.getComponentId(),
- image.getId());
-
boolean isManual = vspInfoDao.isManual(image.getVspId(), image.getVersion());
ImageEntity retrieved =
getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(),
if (CollectionUtils.isEmpty(validationData.getErrors())) {
imageDao.update(image);
}
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, image.getVspId(), image.getComponentId(),
- image.getId());
-
return validationData;
}
@Override
public void updateImageQuestionnaire(String vspId, Version version, String componentId, String
imageId, String questionnaireData) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id, imageId", vspId, componentId,
- imageId);
-
getImageEntity(vspId, version, componentId, imageId);
}
imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id, imageId", vspId, componentId,
- imageId);
}
private boolean isImageVersionUnique(String vspId, Version version, String componentId,
}
protected String getImageCompositionSchema(SchemaTemplateInput schemaInput) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return SchemaGenerator
.generate(SchemaTemplateContext.composition, CompositionEntityType.image,
schemaInput);
}
protected String getImageQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return SchemaGenerator
.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image,
schemaInput);
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private final ComponentArtifactDao componentArtifactDao;
private static final Logger logger =
LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
@Override
public void delete(String vspId, Version version, String componentId,
MonitoringUploadType monitoringUploadType) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ComponentMonitoringUploadEntity componentMonitoringUploadEntity =
setValuesForComponentArtifactEntityUpload(vspId, version, null, componentId, null,
monitoringUploadType, null);
}
componentArtifactDao.delete(retrieved.get());
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
@Override
public void upload(InputStream object, String filename, String vspId,
Version version, String componentId,
MonitoringUploadType type) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
if (object == null) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
}
}
logger.audit("Uploaded Monitoring File for component id:" + componentId + " ,vspId:" + vspId);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
private void validateVesEventUpload(FileContentHandler upload,
@Override
public MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ComponentMonitoringUploadEntity current =
new ComponentMonitoringUploadEntity(vspId, version, componentId, null);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return setMonitoringUploadStatusValues(current);
}
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import java.util.Collection;
public class NetworkManagerImpl implements NetworkManager {
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
-
private final NetworkDao networkDao;
private final CompositionEntityDataManager compositionEntityDataManager;
private final VendorSoftwareProductInfoDao VSPInfoDao;
@Override
public Collection<NetworkEntity> listNetworks(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
-
return networkDao.list(new NetworkEntity(vspId, version, null));
}
@Override
public NetworkEntity createNetwork(NetworkEntity network) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, network.getVspId());
-
if (!VSPInfoDao.isManual(network.getVspId(), network.getVersion())) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.CREATE_NETWORK, ErrorLevel.ERROR.name(),
new CompositionEditNotAllowedErrorBuilder(network.getVspId(), network.getVersion())
.build());
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, network.getVspId());
-
return null;
}
@Override
public CompositionEntityValidationData updateNetwork(NetworkEntity network) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_NETWORK_ID, network.getVspId(), network.getId());
-
NetworkEntity retrieved = getValidatedNetwork(network.getVspId(), network.getVersion(), network.getId());
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
if (CollectionUtils.isEmpty(validationData.getErrors())) {
networkDao.update(network);
}
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_NETWORK_ID, network.getVspId(), network.getId());
-
return validationData;
}
@Override
public CompositionEntityResponse<Network> getNetwork(String vspId, Version version,
String networkId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_NETWORK_ID, vspId, networkId);
-
NetworkEntity networkEntity = getValidatedNetwork(vspId, version, networkId);
Network network = networkEntity.getNetworkCompositionData();
response.setId(networkId);
response.setData(network);
response.setSchema(getCompositionSchema(schemaInput));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_NETWORK_ID, vspId, networkId);
-
return response;
}
@Override
public void deleteNetwork(String vspId, Version version, String networkId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_NETWORK_ID, vspId, networkId);
-
if (!VSPInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_NETWORK, ErrorLevel.ERROR.name(),
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_NETWORK_ID, vspId, networkId);
}
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.api.annotations.Metrics;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
implements OrchestrationTemplateCandidateManager {
private static final Logger LOGGER =
LoggerFactory.getLogger(OrchestrationTemplateCandidateManagerImpl.class);
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
-
private final VendorSoftwareProductInfoDao vspInfoDao;
private final CandidateService candidateService;
private static final String VSP_ID = "VSP id";
@Metrics
public UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload,
String fileSuffix, String networkPackageName) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
OrchestrationTemplateFileHandler orchestrationTemplateFileHandler =
OrchestrationUploadFactory.createOrchestrationTemplateFileHandler(fileSuffix);
@Override
public OrchestrationTemplateActionResponse process(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
OrchestrationTemplateCandidateData candidate = fetchCandidateDataEntity(vspId, version)
.orElseThrow(
() -> new CoreException(new OrchestrationTemplateNotFoundErrorBuilder(vspId).build()));
@Override
public Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
Optional<FilesDataStructure> candidateFileDataStructure =
candidateService.getOrchestrationTemplateCandidateFileDataStructure(vspId, version);
if (candidateFileDataStructure.isPresent()) {
return candidateFileDataStructure;
} else {
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return Optional.empty();
}
}
@Override
public ValidationResponse updateFilesDataStructure(String vspId, Version version,
FilesDataStructure fileDataStructure) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
ValidationResponse response = new ValidationResponse();
Optional<List<ErrorMessage>> validateErrors =
candidateService.validateFileDataStructure(fileDataStructure);
errorsMap.put(SdcCommon.UPLOAD_FILE, errorMessages);
response.setUploadDataErrors(errorsMap,
LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return response;
}
}
candidateService
.updateOrchestrationTemplateCandidateFileDataStructure(vspId, version, fileDataStructure);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return response;
}
@Override
public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
VspDetails vspDetails = getVspDetails(vspId, version);
Optional<OrchestrationTemplateCandidateData> candidateDataEntity =
getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage
(), ""));
LOGGER.error(errorMessage.getMessage());
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return Optional.empty();
}
OnboardingTypesEnum type =
FilesDataStructure structure = JsonUtil
.json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
String manifest = candidateService.createManifest(vspDetails, structure);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return Optional.of(
new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(), candidateService
.replaceManifestInZip(candidateDataEntity.get().getContentData(),
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
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 static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
-
private final ProcessDao processDao;
private static final String VSP_ID_COMPONENT_ID = "VSP id, component id";
@Override
public Collection<ProcessEntity> listProcesses(String vspId, Version version,
String componentId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return processDao.list(new ProcessEntity(vspId, version, componentId, null));
}
@Override
public void deleteProcesses(String vspId, Version version, String componentId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ProcessEntity allProcesses = new ProcessEntity(vspId, version, componentId, null);
Collection<ProcessEntity> processes = processDao.list(allProcesses);
} else {
processDao.deleteAll(allProcesses);
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
@Override
public ProcessEntity createProcess(ProcessEntity process) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, process.getId(),
- process.getComponentId());
validateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
process.getName());
processDao.create(process);
createUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
process.getName());
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, process.getId(),
- process.getComponentId());
-
return process;
}
@Override
public ProcessEntity getProcess(String vspId, Version version, String componentId,
String processId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ProcessEntity retrieved =
processDao.get(new ProcessEntity(vspId, version, componentId, processId));
validateProcessExistence(vspId, version, componentId, processId, retrieved);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return retrieved;
}
@Override
public void updateProcess(ProcessEntity process) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, process.getId(),
- process.getComponentId());
-
ProcessEntity retrieved = processDao.get(process);
validateProcessExistence(process.getVspId(), process.getVersion(), process.getComponentId(),
process.getId(), retrieved);
updateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
retrieved.getName(), process.getName());
processDao.update(process);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, process.getId(),
- process.getComponentId());
}
@Override
public void deleteProcess(String vspId, Version version, String componentId, String processId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ProcessEntity retrieved = getProcess(vspId, version, componentId, processId);
processDao.delete(retrieved);
deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
retrieved.getName());
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
@Override
public File getProcessArtifact(String vspId, Version version, String componentId,
String processId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
File file = new File(String.format("%s_%s_%s", vspId, componentId, processId));
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get process artifact");
throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return file;
}
@Override
public void deleteProcessArtifact(String vspId, Version version, String componentId,
String processId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
processDao.deleteArtifact(retrieved);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
@Override
public void uploadProcessArtifact(InputStream artifactFile, String artifactFileName, String vspId,
Version version, String componentId, String processId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
ProcessEntity process = getProcess(vspId, version, componentId, processId);
process.setArtifactName(artifactFileName);
process.setArtifact(readArtifact(artifactFile));
processDao.uploadArtifact(process);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
private ProcessEntity getValidatedProcessArtifact(String vspId, Version version,
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.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
public abstract class BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler {
protected static final Logger logger =
LoggerFactory.getLogger(BaseOrchestrationTemplateHandler.class);
- protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
@Override
public UploadFileResponse upload(VspDetails vspDetails, InputStream fileToUpload,
String fileSuffix, String networkPackageName,
uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
getHandlerType().toString())));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
return uploadFileResponse;
}
if (!MapUtils.isEmpty(uploadFileResponse.getErrors())) {
- mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
return uploadFileResponse;
}
if (updateCandidateData(vspDetails, uploadedFileData, optionalContentMap.get(), fileSuffix,
networkPackageName, candidateService, uploadFileResponse)) {
return uploadFileResponse;
}
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
return uploadFileResponse;
}
getHandlerType().toString()), exception);
uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE,
new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
return true;
}
return false;
getHandlerType().toString()), exception);
uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE,
new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
return true;
}
return false;
import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.messages.AuditMessages;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemplateProcessHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class);
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private final CandidateService candidateService =
CandidateServiceFactory.getInstance().createInterface();
private static final String VSP_ID = "VSP id";
candidateData.getContentData().array());
if (!fileContent.isPresent()) {
response.addStructureErrors(uploadFileResponse.getErrors());
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId,
HEAT_VALIDATION_ERROR));
return response;
if (CollectionUtils.isNotEmpty(structure.getUnassigned())) {
response.addErrorMessageToMap(SdcCommon.UPLOAD_FILE,
Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId,
HEAT_VALIDATION_ERROR));
return response;
LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId);
uploadFileResponse.addStructureErrors(uploadErrors);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return response;
}