-/*-
- * ============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
* 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.health.impl;
import org.openecomp.sdc.health.data.MonitoredModules;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import java.util.ArrayList;
import java.util.Arrays;
public class HealthCheckManagerImpl implements HealthCheckManager {
- private static MdcDataDebugMessage mdcDataDebugMessage;
- private HealthCheckDao healthCheckDao;
-
- private static final Logger logger;
+ private static final Logger LOGGER = LoggerFactory.getLogger(HealthCheckManagerImpl.class);
- static {
- mdcDataDebugMessage = new MdcDataDebugMessage();
- logger = LoggerFactory.getLogger(HealthCheckManagerImpl.class);
- }
+ private HealthCheckDao healthCheckDao;
public HealthCheckManagerImpl() {
healthCheckDao = HealthCheckDaoFactory.getInstance().createInterface();
try {
zeHealthInfos = zusammenAdaptor.checkHealth(context);
} catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
+ LOGGER.error(ex.getMessage(), ex);
zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
MonitoredModules.ZU, HealthCheckStatus.DOWN,
zVersion, ex.getMessage());
try {
cassandraHealth = healthCheckDao.checkHealth();
} catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
+ LOGGER.error(ex.getMessage(), ex);
description = ex.getMessage();
cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion, ex.getMessage());
}
} catch (Exception e) {
- logger.error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
MonitoredModules.ZU, HealthCheckStatus.DOWN, zVersion, e.getMessage()
);
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;
private static final String EP_POOL_EXPIRY_TIME = "T23:59:59Z";
private static final DateTimeFormatter FORMATTER
= DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
-
-
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
public VendorLicenseManagerImpl(VendorLicenseFacade vendorLicenseFacade,
VendorLicenseModelDao vendorLicenseModelDao,
LicenseAgreementDao licenseAgreementDao,
@Override
public void validate(String vendorLicenseModelId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vendorLicenseModelId);
-
vendorLicenseFacade.validate(vendorLicenseModelId, version);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vendorLicenseModelId);
}
@Override
public VendorLicenseModelEntity createVendorLicenseModel(
VendorLicenseModelEntity vendorLicenseModelEntity) {
- mdcDataDebugMessage.debugEntryMessage(null);
-
vendorLicenseModelDao.create(vendorLicenseModelEntity);
- mdcDataDebugMessage.debugExitMessage(null);
-
return vendorLicenseModelEntity;
}
@Override
public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vendorLicenseModelEntity.getId());
-
String existingVendorName = vendorLicenseModelDao.get(vendorLicenseModelEntity).getVendorName();
updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName,
vendorLicenseModelEntity.getVendorName());
vendorLicenseModelDao.update(vendorLicenseModelEntity);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vendorLicenseModelEntity.getId());
}
@Override
@Override
public Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vlmId);
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vlmId);
return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, version, null));
}
@Override
public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
- mdcDataDebugMessage
- .debugEntryMessage(VLM_ID, licenseAgreement.getVendorLicenseModelId());
- mdcDataDebugMessage
- .debugExitMessage(VLM_ID, licenseAgreement.getVendorLicenseModelId());
return vendorLicenseFacade.createLicenseAgreement(licenseAgreement);
}
public void updateLicenseAgreement(LicenseAgreementEntity licenseAgreement,
Set<String> addedFeatureGroupIds,
Set<String> removedFeatureGroupIds) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_LA_ID, licenseAgreement
- .getVendorLicenseModelId(), licenseAgreement.getId());
-
LicenseAgreementEntity retrieved = licenseAgreementDao.get(licenseAgreement);
VersioningUtil
.validateEntityExistence(retrieved, licenseAgreement, VendorLicenseModelEntity.ENTITY_TYPE);
addFeatureGroupsToLicenseAgreementRef(addedFeatureGroupIds, licenseAgreement);
removeFeatureGroupsToLicenseAgreementRef(removedFeatureGroupIds, licenseAgreement);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_LA_ID, licenseAgreement
- .getVendorLicenseModelId(), licenseAgreement.getId());
}
@Override
public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
String licenseAgreementId) {
-
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_LA_ID, vlmId, licenseAgreementId);
- mdcDataDebugMessage.debugExitMessage(VLM_ID_LA_ID, vlmId, licenseAgreementId);
return vendorLicenseFacade.getLicenseAgreementModel(vlmId, version, licenseAgreementId);
}
@Override
public void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_LA_ID, vlmId, licenseAgreementId);
-
LicenseAgreementEntity input =
new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
retrieved.getName());
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_LA_ID, vlmId, licenseAgreementId);
}
@Override
public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vlmId);
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vlmId);
return vendorLicenseFacade.listFeatureGroups(vlmId, version);
}
@Override
public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
- mdcDataDebugMessage
- .debugEntryMessage(VLM_ID, featureGroup.getVendorLicenseModelId());
- mdcDataDebugMessage.debugExitMessage(VLM_ID, featureGroup.getId());
return vendorLicenseFacade.createFeatureGroup(featureGroup);
}
Set<String> removedLicenseKeyGroups,
Set<String> addedEntitlementPools,
Set<String> removedEntitlementPools) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_FG_ID, featureGroup
- .getVendorLicenseModelId(), featureGroup.getId());
-
FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
VersioningUtil
.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
addedLicenseKeyGroups, removedLicenseKeyGroups);
updateEpLkgOnMrnChange(featureGroup, addedLicenseKeyGroups, addedEntitlementPools, retrieved);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_FG_ID, featureGroup
- .getVendorLicenseModelId(), featureGroup.getId());
}
/**
@Override
public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_FG_ID,
- featureGroup.getVendorLicenseModelId(), featureGroup.getId());
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_FG_ID,
- featureGroup.getVendorLicenseModelId(), featureGroup.getId());
return vendorLicenseFacade.getFeatureGroupModel(featureGroup);
}
@Override
public void deleteFeatureGroup(FeatureGroupEntity featureGroup) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_FG_ID,
- featureGroup.getVendorLicenseModelId(), featureGroup.getId());
-
FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
VersioningUtil
.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
deleteUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
retrieved.getName());
-
- mdcDataDebugMessage
- .debugExitMessage(VLM_ID_FG_ID,
- featureGroup.getVendorLicenseModelId(), featureGroup.getId());
}
@Override
public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vlmId);
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vlmId);
return vendorLicenseFacade.listEntitlementPools(vlmId, version);
}
@Override
public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
- mdcDataDebugMessage
- .debugEntryMessage(VLM_ID, entitlementPool.getVendorLicenseModelId());
- mdcDataDebugMessage
- .debugExitMessage(VLM_ID, entitlementPool.getVendorLicenseModelId());
-
entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
.getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + EP_POOL_START_TIME
: null) : null);
private void validateCreateDate(String startDate, String expiryDate,
String vendorLicenseModelId) {
- mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate
- + " " + expiryDate);
-
LocalDate parsedStartDate = parseLocalDate(startDate);
LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
.build());
}
-
- mdcDataDebugMessage.debugExitMessage(null);
}
private void validateIfStartAndExpiryDateIsNotNull(String startDate, String expiryDate,
private void validateUpdateDate(String startDate, String expiryDate,
String vendorLicenseModelId) {
- mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate
- + " " + expiryDate);
-
LocalDate parsedStartDate = parseLocalDate(startDate);
LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
.build());
}
-
- mdcDataDebugMessage.debugExitMessage(null);
}
@Override
public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_EP_ID, entitlementPool
- .getVendorLicenseModelId(), entitlementPool.getId());
-
entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
.getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + EP_POOL_START_TIME
: null) : null);
validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
entitlementPool.getVendorLicenseModelId());
vendorLicenseFacade.updateEntitlementPool(entitlementPool);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_EP_ID, entitlementPool
- .getVendorLicenseModelId(), entitlementPool.getId());
}
@Override
public EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_EP_ID, entitlementPool
- .getVendorLicenseModelId(), entitlementPool.getId());
-
EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
VersioningUtil
.validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
retrieved.setExpiryDate(LocalDate.parse(retrieved.getExpiryDate(), FORMATTER ).format
(targetFormatter));
}
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_EP_ID, entitlementPool
- .getVendorLicenseModelId(), entitlementPool.getId());
return retrieved;
}
@Override
public void deleteEntitlementPool(EntitlementPoolEntity entitlementPool) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_EP_ID, entitlementPool
- .getVendorLicenseModelId(), entitlementPool.getId());
-
EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
VersioningUtil
.validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
deleteUniqueName(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
retrieved.getName());
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_EP_ID, entitlementPool
- .getVendorLicenseModelId(), entitlementPool.getId());
}
protected void deleteChildLimits(String vlmId, Version version, String epLkgId) {
@Override
public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vlmId);
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vlmId);
return vendorLicenseFacade.listLicenseKeyGroups(vlmId, version);
}
@Override
public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- mdcDataDebugMessage
- .debugEntryMessage(VLM_ID, licenseKeyGroup.getVendorLicenseModelId());
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID, licenseKeyGroup
- .getVendorLicenseModelId());
-
licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
.getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + EP_POOL_START_TIME
: null) : null);
@Override
public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_LKG_ID, licenseKeyGroup
- .getVendorLicenseModelId(), licenseKeyGroup.getId());
-
licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
.getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + EP_POOL_START_TIME
: null) : null);
validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
licenseKeyGroup.getVendorLicenseModelId());
vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroup);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_LKG_ID, licenseKeyGroup
- .getVendorLicenseModelId(), licenseKeyGroup.getId());
}
@Override
public LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_LKG_ID, licenseKeyGroup
- .getVendorLicenseModelId(), licenseKeyGroup.getId());
-
LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
VersioningUtil
.validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_LKG_ID, licenseKeyGroup
- .getVendorLicenseModelId(), licenseKeyGroup.getId());
return retrieved;
}
@Override
public void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID_LKG_ID, licenseKeyGroup
- .getVendorLicenseModelId(), licenseKeyGroup.getId());
-
LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
VersioningUtil
.validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
retrieved.getName());
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID_LKG_ID, licenseKeyGroup
- .getVendorLicenseModelId(), licenseKeyGroup.getId());
}
@Override
public LimitEntity createLimit(LimitEntity limit) {
- mdcDataDebugMessage
- .debugEntryMessage(VLM_ID, limit.getVendorLicenseModelId(), EP_LKGID, limit
- .getEpLkgId());
- mdcDataDebugMessage
- .debugExitMessage(VLM_ID, limit.getVendorLicenseModelId(), EP_LKGID, limit
- .getEpLkgId());
validateLimit(limit);
LimitEntity createdLimit = vendorLicenseFacade.createLimit(limit);
updateParentForLimit(limit);
@Override
public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, vlmId, EP_LKGID, epLkgId);
- mdcDataDebugMessage.debugExitMessage(VLM_ID, vlmId, EP_LKGID, epLkgId);
return vendorLicenseFacade.listLimits(vlmId, version, epLkgId);
}
@Override
public void deleteLimit(LimitEntity limitEntity) {
- mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", limitEntity
- .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId());
-
if (!isLimitPresent(limitEntity)) {
VersioningUtil
.validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
limitDao.delete(limitEntity);
updateParentForLimit(limitEntity);
-
- mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", limitEntity
- .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId());
}
@Override
public void updateLimit(LimitEntity limit) {
- mdcDataDebugMessage
- .debugEntryMessage(VLM_ID, limit.getVendorLicenseModelId(), EP_LKGID, limit
- .getEpLkgId());
getLimit(limit);
validateLimit(limit);
vendorLicenseFacade.updateLimit(limit);
updateParentForLimit(limit);
- mdcDataDebugMessage
- .debugExitMessage(VLM_ID, limit.getVendorLicenseModelId(), EP_LKGID, limit
- .getEpLkgId());
}
private boolean isLimitPresent(LimitEntity limit) {
@Override
public LimitEntity getLimit(LimitEntity limitEntity) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, limitEntity.getVendorLicenseModelId(),
- EP_LKGID, limitEntity.getEpLkgId());
-
if (!isLimitPresent(limitEntity)) {
VersioningUtil
.validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
LimitEntity retrieved = limitDao.get(limitEntity);
VersioningUtil
.validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
-
- mdcDataDebugMessage.debugExitMessage(VLM_ID, limitEntity.getVendorLicenseModelId(),
- EP_LKGID, limitEntity.getEpLkgId());
return retrieved;
}
* captured in VLM XML
*/
private void updateParentForLimit(LimitEntity limit) {
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, limit.getVendorLicenseModelId(),
- EP_LKGID, limit.getEpLkgId(), "Limit Parent ", limit.getParent());
if ("EntitlementPool".equals(limit.getParent())) {
EntitlementPoolEntity entitlementPoolEntity =
entitlementPoolDao.get(new EntitlementPoolEntity(limit.getVendorLicenseModelId(),
limit.getEpLkgId()));
vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroupEntity);
}
-
- mdcDataDebugMessage.debugEntryMessage(VLM_ID, limit.getVendorLicenseModelId(),
- EP_LKGID, limit.getEpLkgId(), "Limit Parent ", limit.getParent());
}
protected void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
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.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import java.util.Collection;
public class ComponentDependencyModelManagerImpl implements ComponentDependencyModelManager {
-
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
protected static final Logger logger =
LoggerFactory.getLogger(ComponentDependencyModelManagerImpl.class);
@Override
public Collection<ComponentDependencyModelEntity> list(String vspId, Version version) {
-
- mdcDataDebugMessage.debugExitMessage("VSP id, version", vspId, version.toString());
-
return componentDependencyModelDao
.list(new ComponentDependencyModelEntity(vspId, version, null));
}
@Override
public void delete(String vspId, Version version, String dependencyId) {
- mdcDataDebugMessage.debugEntryMessage("VSP id, dependencyId", vspId, dependencyId);
ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(vspId,
version, dependencyId);
if (componentDependencyEntity != null) {
componentDependencyModelDao.delete(componentDependencyEntity);
}
-
- mdcDataDebugMessage.debugExitMessage("VSP id, dependencyId", vspId, dependencyId);
}
@Override
public void update(ComponentDependencyModelEntity entity) {
- mdcDataDebugMessage.debugEntryMessage("VSP id, dependencyId", entity.getVspId(),
- entity.getId());
ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(
entity.getVspId(), entity.getVersion(), entity.getId());
validateComponentDependency(entity);
@Override
public ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId) {
- mdcDataDebugMessage.debugEntryMessage("VSP id, dependencyId", vspId, dependencyId);
ComponentDependencyModelEntity componentDependency =
getComponentDependency(vspId, version, dependencyId);
return componentDependency;
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 static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.COMPUTE_TYPE_PREFIX;
public class ComponentManagerImpl implements ComponentManager {
- private static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private final ComponentDao componentDao;
private final CompositionEntityDataManager compositionEntityDataManager;
private final NicManager nicManager;
@Override
public Collection<ComponentEntity> listComponents(String vspId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID, vspId);
- mdcDataDebugMessage.debugExitMessage(VSP_ID, vspId);
return componentDao.list(new ComponentEntity(vspId, version, null));
}
@Override
public void deleteComponents(String vspId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID, vspId);
if (!vspInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_COMPONENT, ErrorLevel.ERROR.name(),
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
-
- mdcDataDebugMessage.debugExitMessage(VSP_ID, vspId);
}
@Override
public ComponentEntity createComponent(ComponentEntity component) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID, component.getId());
-
final String vfcAddNotAllowedInHeatOnboardingMsg =
"VFCs cannot be added for VSPs onboarded with HEAT.";
updateComponentName(component);
createdComponent = compositionEntityDataManager.createComponent(component);
}
-
- mdcDataDebugMessage.debugExitMessage(VSP_ID, component.getId());
-
return createdComponent;
}
@Override
public CompositionEntityValidationData updateComponent(ComponentEntity component) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID_COMPONENT_ID, component
- .getVspId(), component.getId());
ComponentEntity retrieved =
getValidatedComponent(component.getVspId(), component.getVersion(), component.getId());
}
componentDao.update(component);
}
- mdcDataDebugMessage.debugExitMessage(VSP_ID_COMPONENT_ID, component.getVspId(),
- component.getId());
-
return validationData;
}
@Override
public CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version,
String componentId) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
ComponentEntity componentEntity = getValidatedComponent(vspId, version, componentId);
ComponentData component = componentEntity.getComponentCompositionData();
response.setId(componentId);
response.setData(component);
response.setSchema(getComponentCompositionSchema(schemaInput));
- mdcDataDebugMessage.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return response;
}
@Override
public void deleteComponent(String vspId, Version version, String componentId) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
if (!vspInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_COMPONENT, ErrorLevel.ERROR.name(),
throw new CoreException(
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
-
- mdcDataDebugMessage.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
@Override
public QuestionnaireResponse getQuestionnaire(String vspId, Version version,
String componentId) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
ComponentEntity component = componentDao.getQuestionnaireData(vspId, version, componentId);
VersioningUtil
new ComponentQuestionnaireSchemaInput(nicNames, questionnaireResponse.getData() == null
? null
: JsonUtil.json2Object(questionnaireResponse.getData(), Map.class))));
-
- mdcDataDebugMessage.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
return questionnaireResponse;
}
@Override
public void updateQuestionnaire(String vspId, Version version, String componentId,
String questionnaireData) {
- mdcDataDebugMessage.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
validateComponentExistence(vspId, version, componentId);
componentDao.updateQuestionnaireData(vspId, version, componentId, questionnaireData);
-
- mdcDataDebugMessage.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
}
@Override
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.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.Optional;
public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
-
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private ManualVspDataCollectionService
manualVspDataCollectionService = new ManualVspDataCollectionService();
@Override
public VspModelInfo gatherVspInformation(String vspId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
VspModelInfo vspModelInfo = new VspModelInfo();
//Get Release Vendor Name
Optional<String> releaseVendor;
if (MapUtils.isNotEmpty(vspComponentNics)) {
vspModelInfo.setNics(vspComponentNics);
}
-
- mdcDataDebugMessage.debugExitMessage(null, null);
return vspModelInfo;
}
@Override
public ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
ManualVspToscaGenerationService vspToscaGenerator = new ManualVspToscaGenerationService();
ToscaServiceModel manualVspToscaServiceModel =
vspToscaGenerator.createManualVspToscaServiceModel(vspModelInfo);
- mdcDataDebugMessage.debugExitMessage(null, null);
return manualVspToscaServiceModel;
}
}
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 NicManagerImpl implements NicManager {
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
-
private final NicDao nicDao;
private final CompositionEntityDataManager compositionEntityDataManager;
private final NetworkManager networkManager;
@Override
public Collection<NicEntity> listNics(String vspId, Version version, String componentId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentId, null));
if (!nics.isEmpty()) {
nicEntity.setNicCompositionData(nic);
});
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId);
-
return nics;
}
@Override
public NicEntity createNic(NicEntity nic) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, nic.getVspId(),
- nic.getComponentId());
-
NicEntity createdNic;
if (!vspInfoDao.isManual(nic.getVspId(), nic.getVersion())) {
ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
validateNic(nic);
createdNic = compositionEntityDataManager.createNic(nic);
}
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, nic.getVspId(), nic.getComponentId());
-
return createdNic;
}
@Override
public CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId,
String nicId) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage("VSP id, component id, nic id", vspId, componentId, nicId);
-
NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
Nic nic = nicEntity.getNicCompositionData();
response.setId(nicId);
response.setData(nic);
response.setSchema(getNicCompositionSchema(schemaInput));
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
-
return response;
}
@Override
public void deleteNic(String vspId, Version version, String componentId, String nicId) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
-
if (!vspInfoDao.isManual(vspId, version)) {
final ErrorCode deleteNicErrorBuilder =
DeleteNicErrorBuilder.getDeleteNicForHeatOnboardedVspErrorBuilder();
NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
nicDao.delete(nicEntity);
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
}
@Override
public CompositionEntityValidationData updateNic(NicEntity nic) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, nic.getVspId(), nic.getComponentId(),
- nic.getId());
-
NicEntity retrieved =
getValidatedNic(nic.getVspId(), nic.getVersion(), nic.getComponentId(), nic.getId());
if (CollectionUtils.isEmpty(validationData.getErrors())) {
nicDao.update(nic);
}
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, nic.getVspId(), nic.getComponentId(),
- nic.getId());
-
return validationData;
}
@Override
public QuestionnaireResponse getNicQuestionnaire(String vspId, Version version,
String componentId, String nicId) {
- MDC_DATA_DEBUG_MESSAGE
- .debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
-
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, version, componentId, nicId);
VersioningUtil.validateEntityExistence(nicQuestionnaire,
questionnaireResponse.setData(nicQuestionnaire.getQuestionnaireData());
questionnaireResponse.setSchema(getNicQuestionnaireSchema(null));
-
- MDC_DATA_DEBUG_MESSAGE
- .debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
-
return questionnaireResponse;
}
@Override
public void updateNicQuestionnaire(String vspId, Version version, String componentId,
String nicId, String questionnaireData) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
-
getNic(vspId, version, componentId, nicId);
nicDao.updateQuestionnaireData(vspId, version, componentId, nicId, questionnaireData);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID_COMPONENT_ID, vspId, componentId, nicId);
}
protected String getNicQuestionnaireSchema(SchemaTemplateInput 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.messages.AuditMessages;
import org.openecomp.sdc.logging.types.LoggerConstants;
import java.util.zip.ZipOutputStream;
public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager {
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private static final Logger LOGGER =
LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
@Override
public ValidationResponse validate(String vspId, Version version) throws IOException {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
VspDetails vspDetails = getValidatedVsp(vspId, version);
Collection<ComponentDependencyModelEntity> componentDependencies =
componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null));
validationResponse
.setVspErrors(vspErrors, LoggerTragetServiceName.SUBMIT_VSP);
validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails));
-
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return validationResponse;
}
@Override
public Map<String, List<ErrorMessage>> compile(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
ToscaServiceModel serviceModel =
OnboardingMethod.Manual.name().equals(getValidatedVsp(vspId, version).getOnboardingMethod())
//Generate Tosca service model for Manual Onboarding flow
: serviceModelDao.getServiceModel(vspId, version);
Map<String, List<ErrorMessage>> compilationErrors = compile(vspId, version, serviceModel);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return compilationErrors;
}
}
private Set<CompositionEntityValidationData> componentValidation(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
Set<CompositionEntityValidationData> validationData = new HashSet<>();
Collection<ComponentEntity> components =
componentDao.list(new ComponentEntity(vspId, version, null));
}
private Collection<ErrorCode> validateLicensingData(VspDetails vspDetails) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspDetails.getId());
-
if (vspDetails.getVendorId() == null || vspDetails.getVlmVersion() == null
|| vspDetails.getLicenseAgreement() == null
|| CollectionUtils.isEmpty(vspDetails.getFeatureGroups())) {
return Collections.emptyList();
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspDetails.getId());
return vendorLicenseFacade
.validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(),
vspDetails.getLicenseAgreement(), vspDetails.getFeatureGroups());
@Override
public VspDetails createVsp(VspDetails vspDetails) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
-
vspInfoDao.create(vspDetails);
vspInfoDao.updateQuestionnaireData(vspDetails.getId(), vspDetails.getVersion(),
new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData());
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return vspDetails;
}
@Override
public void updateVsp(VspDetails vspDetails) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspDetails.getId());
-
VspDetails retrieved = vspInfoDao.get(vspDetails);
// TODO: 6/21/2017 remove this validation when validation will be added in the REST level
if (retrieved == null) {
updateUniqueName(retrieved.getName(), vspDetails.getName());
vspInfoDao.update(vspDetails);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspDetails.getId());
}
private void updateDeploymentFlavor(VspDetails vspDetails) {
@Override
public VspDetails getVsp(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
VspDetails vsp = getValidatedVsp(vspId, version);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return vsp;
}
@Override
public void deleteVsp(String vspId) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_VSP, ErrorLevel.ERROR.name(),
LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Unsupported operation");
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
-
throw new UnsupportedOperationException(
VendorSoftwareProductConstants.UNSUPPORTED_OPERATION_ERROR);
}
@Override
public File getTranslatedFile(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
String errorMessage;
PackageInfo packageInfo = packageInfoDao.get(new PackageInfo(vspId, version));
throw new CoreException(new TranslationFileCreationErrorBuilder(vspId, version).build(),
exception);
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
-
return translatedFile;
}
@Override
public byte[] getOrchestrationTemplateFile(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
OrchestrationTemplateEntity uploadData = orchestrationTemplateDao.get(vspId, version);
ByteBuffer contentData = uploadData.getContentData();
if (contentData == null) {
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get uploaded HEAT");
throw new CoreException(new FileCreationErrorBuilder(vspId).build(), exception);
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return baos.toByteArray();
}
@Override
public PackageInfo createPackage(String vspId, Version version) throws IOException {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Version vlmVersion = vspDetails.getVlmVersion();
packageInfoDao.create(packageInfo);
LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_PACKAGE + vspId);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return packageInfo;
}
@Override
public QuestionnaireResponse getVspQuestionnaire(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
VspQuestionnaireEntity retrieved = vspInfoDao.getQuestionnaire(vspId, version);
VersioningUtil.validateEntityExistence(retrieved, new VspQuestionnaireEntity(vspId, version),
VspDetails.ENTITY_TYPE);
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
questionnaireResponse.setData(questionnaireData);
questionnaireResponse.setSchema(getVspQuestionnaireSchema(null));
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
-
return questionnaireResponse;
}
@Override
public void updateVspQuestionnaire(String vspId, Version version, String questionnaireData) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
}
private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version,
String onboardingMethod) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
-
// The apis of CompositionEntityDataManager used here are stateful!
// so, it must be re-created from scratch when it is used!
CompositionEntityDataManager compositionEntityDataManager =
if (MapUtils.isNotEmpty(errorsByEntityId)) {
compositionEntityDataManager.buildTrees();
compositionEntityDataManager.addErrorsToTrees(errorsByEntityId);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return new QuestionnaireValidationResult(
compositionEntityDataManager.getAllErrorsByVsp(vspId));
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return null;
}
@Override
public File getInformationArtifact(String vspId, Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
if (vspDetails == null) {
} catch (IOException ex) {
throw new CoreException(new InformationArtifactCreationErrorBuilder(vspId).build(), ex);
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return infoArtifactFile;
}
String getVspQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return SchemaGenerator
.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput);
}
import org.openecomp.sdc.itempermissions.dao.ItemPermissionsDaoFactory;
import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes;
import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.notification.dao.SubscribersDao;
import org.openecomp.sdc.notification.factories.SubscribersDaoFactory;
import org.openecomp.sdc.versioning.dao.ItemDao;
*/
public class OwnerHealer implements Healer {
private static final String HEALING_USER_SUFFIX = "_healer";
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
private static final ItemPermissionsDao permissionsDao =
ItemPermissionsDaoFactory.getInstance().createInterface();
private static final ItemDao itemDao = ItemDaoFactory.getInstance().createInterface();
.createInterface();
public Object heal(String itemId, Version version) {
- mdcDataDebugMessage.debugEntryMessage(null);
-
Collection<ItemPermissionsEntity> itemPermissions = permissionsDao.listItemPermissions(itemId);
if (itemPermissions.stream().noneMatch(this::isOwnerPermission)) {
import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
import org.openecomp.sdc.heat.services.tree.HeatTreeManager;
import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.services.HeatFileAnalyzer;
import java.util.Optional;
public class CandidateEntityBuilder {
-
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
-
private final CandidateService candidateService;
public CandidateEntityBuilder(CandidateService candidateService) {
OrchestrationTemplateCandidateData candidateDataEntity =
candidateService.createCandidateDataEntity(candidateDataEntityTo, zipFileManifest,
analyzedZipHeatFiles);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP Id", vspDetails.getId());
return candidateDataEntity;
}
}
FileContentHandler fileContentHandler,
AnalyzedZipHeatFiles analyzedZipHeatFiles)
throws IOException {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP Id", vspDetails.getId());
-
try (InputStream manifest = fileContentHandler.getFileContent(SdcCommon.MANIFEST_NAME)) {
if (Objects.isNull(manifest)) {
String.valueOf(JsonUtil.sbObject2Json(manifestContent)).getBytes());
}
} finally {
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP Id", vspDetails.getId());
}
}
}
import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
noSqlDb.getMappingManager().mapper(PackageInfo.class);
private static final PackageInfoAccessor accessor =
noSqlDb.getMappingManager().createAccessor(PackageInfoAccessor.class);
-
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
@Override
protected Mapper<PackageInfo> getMapper() {
return mapper;
@Override
public List<PackageInfo> listByCategory(String category, String subCategory) {
- mdcDataDebugMessage.debugEntryMessage(null);
Result<PackageInfo> packages = accessor.listInfo();
List<PackageInfo> filteredPackages = new ArrayList<>();
filteredPackages.add(packageInfo);
}
}
- mdcDataDebugMessage.debugExitMessage(null);
return filteredPackages;
}
package org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.factory.QuestionnnaireDataServiceFactory;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactData;
private QuestionnaireDataService questionnaireDataService = QuestionnnaireDataServiceFactory
.getInstance().createInterface();
private StringBuilder textArtifact;
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
@Override
public String generate(String vspId, Version version) {
InformationArtifactData informationArtifactData =
}
private String createTxtArtifact(InformationArtifactData informationArtifactData) {
-
-
- mdcDataDebugMessage.debugEntryMessage(null);
-
textArtifact = new StringBuilder(TxtInformationArtifactConstants.HEADER);
addVspVlmEntries(informationArtifactData);
addAvailabilityEntries();
addRecoveryEntriesPerComponent(componentQuestionnaire);
}
textArtifact.append(TxtInformationArtifactConstants.FOOTER);
-
- mdcDataDebugMessage.debugExitMessage(null);
return textArtifact.toString();
}
private void addDataEntries(InformationArtifactData informationArtifactData) {
-
-
- mdcDataDebugMessage.debugEntryMessage(null);
-
addEntryWithIndent(STORAGE_BACKUP_DETAILS, "", TAB);
Optional<StorageDataReplication> storageDataReplication =
storageDataReplication.ifPresent(rep -> addEntryWithIndent(DATA_REP_DEST,
String.valueOf(rep.getStorageReplicationDestination()), TAB + TAB));
-
- mdcDataDebugMessage.debugExitMessage(null);
}
private void addAvailabilityEntries() {
- mdcDataDebugMessage.debugEntryMessage(null);
-
addEntryWithIndent(HIGH_AVAILABILITY, "", TAB);
Optional<Availability> availability =
availability
.ifPresent(availabilityVal -> addEntryWithIndent(USING_AVAILABILITY_ZONES, String.valueOf(
availabilityVal.isUseAvailabilityZonesForHighAvailability()), TAB + TAB));
-
- mdcDataDebugMessage.debugExitMessage(null);
}
private void addVspVlmEntries(InformationArtifactData informationArtifactData) {
- mdcDataDebugMessage.debugEntryMessage(null);
-
addEntryWithIndent(TITLE, "", "");
Optional<VspDetails> vspDetails = Optional.of(informationArtifactData).map
(InformationArtifactData::getVspDetails);
addEntryWithIndent(LIST_OF_FEATURE_GROUPS, "", TAB + TAB);
vspDetails.ifPresent(vspDets -> addListEntriesWithIndent(vspDets
.getFeatureGroups(), TAB + TAB + TAB));
-
- mdcDataDebugMessage.debugExitMessage(null);
}
static String roundVersionAsNeeded(Version version) {
}
private void addRecoveryEntriesPerComponent(ComponentQuestionnaire componentQuestionnaire) {
-
- mdcDataDebugMessage.debugEntryMessage(null);
-
addEntryWithIndent(RECOVERY_DETAILS, "", TAB + TAB + TAB);
Optional<Recovery> recovery = Optional.of(componentQuestionnaire).map(
ComponentQuestionnaire::getGeneral).map(
recovery.ifPresent(recoveryVal -> addEntryWithIndent(RECOVERY_DETAILS_TIME, String.valueOf(
recoveryVal.getTimeObjective()), TAB + TAB + TAB + TAB));
-
- mdcDataDebugMessage.debugExitMessage(null);
}
private void addEntriesPerNic(NicQuestionnaire nicQuestionnaire) {
-
-
- mdcDataDebugMessage.debugEntryMessage(null);
-
addEntryWithIndent(VNICS, "", TAB + TAB + TAB);
Optional<Network> networkOpt = Optional.of(nicQuestionnaire).map(
NicQuestionnaire::getNetwork);
.isIpv4Required()), TAB + TAB + TAB + TAB));
ipconfigOpt.ifPresent(ipconfig -> addEntryWithIndent(VNICS_IPV6, String.valueOf(ipconfig
.isIpv6Required()), TAB + TAB + TAB + TAB));
-
- mdcDataDebugMessage.debugExitMessage(null);
}
private void addEntriesPerComponent(ComponentQuestionnaire componentQuestionnaire) {
-
-
- mdcDataDebugMessage.debugEntryMessage(null);
-
addEntryWithIndent(VFC_NAME, "", TAB + TAB + TAB);
addEntryWithIndent(VFC_DESC, "", TAB + TAB + TAB);
addEntryWithIndent(VFC_IMAGES, "", TAB + TAB + TAB);
numVmsOpt.ifPresent(numVms -> addEntryWithIndent(VFC_INSTANCE_NUMBER_MAX, String.valueOf
(numVms.getMaximum()), TAB + TAB + TAB + TAB));
-
-
- mdcDataDebugMessage.debugExitMessage(null);
}
private void addListEntriesWithIndent(List<String> fieldValues, String indent) {
import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
private static final NicDao nicDao = NicDaoFactory.getInstance().createInterface();
private static final VendorSoftwareProductInfoDao vspInfoDao =
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
@Override
public InformationArtifactData generateQuestionnaireDataForInformationArtifact(String vspId,
Version version) {
- mdcDataDebugMessage.debugEntryMessage("VSP Id", vspId);
-
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Collection<ComponentEntity> componentEntities = componentDao.listQuestionnaires(vspId, version);
Collection<NicEntity> nicEntities = nicDao.listByVsp(vspId, version);
List<ComponentQuestionnaire> componentQuestionnaireList =
getListOfComponentQuestionnaireFromJson(componentEntities);
List<NicQuestionnaire> nicQuestionnaireList = getListOfNicQuestionnaireFromJson(nicEntities);
-
- mdcDataDebugMessage.debugExitMessage("VSP Id", vspId);
return new InformationArtifactData(vspDetails, vspQuestionnaire, componentQuestionnaireList,
nicQuestionnaireList);
}