1 package org.openecomp.sdc.healing.healers;
4 import org.openecomp.sdc.common.utils.SdcCommon;
5 import org.openecomp.sdc.healing.interfaces.Healer;
6 import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
7 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
8 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
9 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
10 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
11 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
12 import org.openecomp.sdc.versioning.dao.types.Version;
15 import java.util.Objects;
17 public class VspOnboardingMethodHealer implements Healer {
18 /*private static final VendorSoftwareProductDao vendorSoftwareProductDao =
19 VendorSoftwareProductDaoFactory.getInstance().createInterface();*/
20 private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao =
21 VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
22 private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
24 public VspOnboardingMethodHealer(){
28 public Object heal(Map<String, Object> healingParams) throws Exception {
29 mdcDataDebugMessage.debugEntryMessage(null, null);
31 String onboardingMethod=null;
32 String vspId = (String) healingParams.get(SdcCommon.VSP_ID);
33 Version version = (Version) healingParams.get(SdcCommon.VERSION);
34 VspDetails vendorSoftwareProductInfo =
35 vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version));
36 vendorSoftwareProductInfo.getOnboardingMethod();
38 if(Objects.isNull(vendorSoftwareProductInfo.getOnboardingMethod())) {
39 onboardingMethod="HEAT";
40 vendorSoftwareProductInfo.setOnboardingMethod(onboardingMethod);
41 vendorSoftwareProductInfoDao.update(vendorSoftwareProductInfo);
42 //vendorSoftwareProductDao.updateVendorSoftwareProductInfo(vendorSoftwareProductInfo);
44 return onboardingMethod;