Exemplo n.º 1
0
 public Configuration update(Configuration entity, Long userId, boolean deleted) {
   String key = entity.getConf_key();
   String value = entity.getConf_value();
   if (entity.getConfiguration_id() == null || entity.getConfiguration_id() <= 0) {
     entity.setStarttime(new Date());
     entity.setDeleted(deleted);
     em.persist(entity);
   } else {
     if (userId != null) {
       entity.setUser(adminUserDao.get(userId));
     }
     entity.setDeleted(deleted);
     entity.setUpdatetime(new Date());
     entity = em.merge(entity);
   }
   if (CONFIG_CRYPT_KEY.equals(key)) {
     configKeyCryptClassName = value;
   } else if ("show.whiteboard.draw.status".equals(key)) {
     whiteboardDrawStatus = "1".equals(value);
   } else if ("application.name".equals(key)) {
     appName = value;
   }
   // TODO ensure entity returned is updated
   return entity;
 }
Exemplo n.º 2
0
 /**
  * @deprecated please use {@link ConfigurationDao#update(Configuration, Long)}
  * @param conf
  * @return
  */
 public Long updateConfig(Configuration conf) {
   try {
     if (conf.getConfiguration_id() == null
         || conf.getConfiguration_id() == 0
         || conf.getConfiguration_id() == 0L) {
       em.persist(conf);
     } else {
       if (!em.contains(conf)) {
         conf = em.merge(conf);
       }
     }
     if (CONFIG_CRYPT_KEY.equals(conf.getConf_key())) {
       configKeyCryptClassName = conf.getConf_value();
     } else if ("show.whiteboard.draw.status".equals(conf.getConf_key())) {
       whiteboardDrawStatus = "1".equals(conf.getConf_value());
     }
     return conf.getConfiguration_id();
   } catch (Exception ex2) {
     log.error("[updateConfByUID]: ", ex2);
   }
   return new Long(-1);
 }