LOGGER.error("Cannot convert {} to Xml format {}", config, e.getMessage());
LOGGER.debug("Stack trace", 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 (Exception e) {
LOGGER.error("Cannot convert {} to String format {}", config, e.getMessage());
LOGGER.debug("Stack trace", e);
}
c.setDirectoryId(config.getDirectory().getId());
c.setTimestamp(config.getTimestamp());
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();
return result;
}