}
catch (ConversionException e) {
throw new PersistenceException(e.getMessage(), e);
}
Configuration c = new Configuration();
c.setId(config.getId());
c.setName(config.getName());
c.setType(config.getClass().getSimpleName());
c.setDirectory(config.getDirectory());
try {
c.setData(ConfigAsXmlHelper.xmlToString(d));
}
catch (ConversionException e) {
e.printStackTrace();
}
// System.out.println("Configuration data =" + c.getData());
// Parent directory need to be defined !!
c.setDirectoryId(config.getDirectory().getId());
c.setTimestamp(config.getTimestamp());
if (config instanceof IConfig<?>) {
IConfig<?> sc = (IConfig<?>) config;
c.setChartProperties(sc.getChartProperties());
c.setPlotPropertiesMap(sc.getPlotPropertiesMap());
}
dao.saveConfig(c, config.isForcedSaving());
if (c.getId() != null) {
result = getConfigById(c.getId());
// The timestamp is not defined by the getConfigById,
// so we need to set his value explicitly with
// the one provided by the save operation.
if (result.getDirectory() != null && c.getDirectory() != null) {
result.getDirectory().setTimestamp(c.getDirectory().getTimestamp());
}
result.setModified(false);
}
c.clean();
// System.out.println("Actuator= " + result.getDimensionX().getActuatorsList().size());
return result;
}