public Long saveOrUpdateConfiguration(long user_level,
LinkedHashMap<String, ?> values, Long users_id) {
try {
if (authLevelManagement.checkAdminLevel(user_level)) {
Configuration conf = (Configuration) CastMapToObject
.getInstance().castByGivenObject(values,
Configuration.class);
if (conf.getConfiguration_id().equals(null)
|| conf.getConfiguration_id() == 0) {
log.info("add new Configuration");
conf.setConfiguration_id(null);
conf.setStarttime(new Date());
conf.setDeleted("false");
return this.addConfig(conf);
} else {
log.info("update Configuration ID: "
+ conf.getConfiguration_id());
Configuration conf2 = this.getConfByConfigurationId(3L,
conf.getConfiguration_id());
conf2.setComment(conf.getComment());
conf2.setConf_key(conf.getConf_key());
conf2.setConf_value(conf.getConf_value());
conf2.setUser_id(users_id);
conf2.setDeleted("false");
conf2.setUpdatetime(new Date());
return this.updateConfig(conf2);
}
} else {
log.error("[saveOrUpdateConfByConfigurationId] Error: Permission denied");
return new Long(-100);