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.NicDao;
8 import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
9 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
10 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
11 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
12 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
13 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
14 import org.openecomp.sdc.versioning.dao.types.Version;
16 import java.util.Collection;
19 public class NicDataHealer implements Healer {
20 /*private static final VendorSoftwareProductDao vendorSoftwareProductDao =
21 VendorSoftwareProductDaoFactory.getInstance().createInterface();*/
23 private static final NicDao nicDao = NicDaoFactory.getInstance().createInterface();
25 private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
27 public NicDataHealer(){
31 public Object heal(Map<String, Object> healingParams) throws Exception {
32 mdcDataDebugMessage.debugEntryMessage(null, null);
33 String vspId = (String) healingParams.get(SdcCommon.VSP_ID);
34 Version version = (Version) healingParams.get(SdcCommon.VERSION);
35 String user = (String) healingParams.get(SdcCommon.USER);
36 Collection<NicEntity> nics = nicDao.listByVsp(vspId, version);
37 for (NicEntity nicEntity : nics) {
38 Nic nic = nicEntity.getNicCompositionData();
39 if (nic != null && nic.getNetworkType()==null) {
40 nic.setNetworkType(NetworkType.Internal);
41 nicEntity.setNicCompositionData(nic);
42 //vendorSoftwareProductDao.updateNic(nicEntity);
43 nicDao.update(nicEntity);