Skip to content
Snippets Groups Projects
Commit e2dda4d1 authored by gwen-soleil's avatar gwen-soleil
Browse files

fix regression: conversion legacy class to new class for managing was not working.

parent fdc63bbd
No related branches found
No related merge requests found
......@@ -23,6 +23,8 @@ import fr.soleil.tango.archiving.config.AttributeConfig;
import fr.soleil.tango.archiving.config.InsertionModes;
import fr.soleil.tango.archiving.infra.tango.ArchivingConfig;
import fr.soleil.tango.archiving.infra.tango.ArchivingConfigs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tango.archiving.collector.data.ArchivingKPI;
import org.tango.archiving.collector.data.AttributeScalarEvent;
import org.tango.archiving.collector.data.ImageEventRO;
......@@ -35,6 +37,7 @@ public class ArchivingDatabase implements IArchivingDatabase {
private final DataBaseManager dataBaseManager;
private final IArchivingManagerApiRef manager;
private final Logger logger = LoggerFactory.getLogger(ArchivingDatabase.class);
private IHdbAttributeInsert inserter;
......@@ -78,6 +81,8 @@ public class ArchivingDatabase implements IArchivingDatabase {
@Override
public void registerAttributeMode(final ArchivingConfig config) throws ArchivingException {
logger.warn("registerAttributeMode {}", config.getAttributeConfig().getFullName());
System.out.println("registerAttributeMode " + config.getAttributeConfig().getFullName());
AttributeLightMode lightMode = new AttributeLightMode();
lightMode.setAttributeCompleteName(config.getAttributeConfig().getFullName());
lightMode.setDevice_in_charge(config.getArchiver());
......@@ -115,6 +120,7 @@ public class ArchivingDatabase implements IArchivingDatabase {
mode.setEventMode(new EventMode());
}
lightMode.setMode(mode);
logger.debug("registerAttributeMode lightMode = {}", lightMode);
dataBaseManager.getMode().insertModeRecord(lightMode);
}
......@@ -170,6 +176,7 @@ public class ArchivingDatabase implements IArchivingDatabase {
throw new ArchivingException(e);
}
for (AttributeLightMode mode : legacyTasks) {
logger.debug("AttributeLightMode {}", mode);
ArchivingConfig config = new ArchivingConfig();
AttributeConfig attribute = new AttributeConfig();
attribute.setFullName(mode.getAttributeCompleteName());
......@@ -177,20 +184,24 @@ public class ArchivingDatabase implements IArchivingDatabase {
attribute.setWriteType(mode.getWritable());
config.setAttributeConfig(attribute);
InsertionModes modes = new InsertionModes();
modes.setAttributeName(mode.getAttributeCompleteName());
if (mode.getMode().getModeP() != null) {
modes.setPeriodic(true);
modes.setPeriodPeriodic(mode.getMode().getModeP().getPeriod());
}
if (mode.getMode().getModeA() != null) {
modes.setAbsolute(true);
modes.setPeriodAbsolute(mode.getMode().getModeA().getPeriod());
modes.setSlowDriftAbsolute(mode.getMode().getModeA().isSlow_drift());
modes.setDecreaseDeltaAbsolute(mode.getMode().getModeA().getValInf());
modes.setIncreaseDeltaAbsolute(mode.getMode().getModeA().getValSup());
}
if (mode.getMode().getModeD() != null) {
modes.setDifference(true);
modes.setPeriodDifference(mode.getMode().getModeD().getPeriod());
}
if (mode.getMode().getModeR() != null) {
modes.setRelative(true);
modes.setPeriodRelative(mode.getMode().getModeR().getPeriod());
modes.setSlowDriftRelative(mode.getMode().getModeR().isSlow_drift());
modes.setDecreasePercentRelative(mode.getMode().getModeR().getPercentInf());
......@@ -200,6 +211,7 @@ public class ArchivingDatabase implements IArchivingDatabase {
modes.setEvent(true);
}
config.setModes(modes);
logger.debug("getArchiverCurrentTasks {}", config);
archiverCurrentTasks.addConfiguration(config);
}
return archiverCurrentTasks;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment