예제 #1
0
  /* (非 Javadoc)
   * <p>Title: persistenceFunction</p>
   * <p>Description: 持久化程式弹窗模式</p>
   * @param permission
   * @return
   */
  public boolean persistenceFunction(Permission permission) {
    Integer userId = Constants.getCurrendUser().getUserId();
    if (null == permission.getPermissionId() || "".equals(permission.getPermissionId())) {
      permission.setCreated(new Date());
      permission.setLastmod(new Date());
      permission.setCreater(userId);
      permission.setModifyer(userId);
      permission.setStatus(Constants.PERSISTENCE_STATUS);
      if (Constants.IS_FUNCTION.equals(permission.getType())) {
        permission.setState(Constants.TREE_STATUS_CLOSED);
      } else {
        permission.setState(Constants.TREE_STATUS_OPEN);
      }
      permissionPublicDao.save(permission);
    } else {
      if (Constants.IS_FUNCTION.equals(permission.getType())) {
        permission.setState(Constants.TREE_STATUS_CLOSED);
      } else {
        permission.setState(Constants.TREE_STATUS_OPEN);
      }

      permission.setLastmod(new Date());
      permission.setModifyer(userId);
      permissionPublicDao.update(permission);
    }
    return true;
  }
예제 #2
0
  /* (非 Javadoc)
   * <p>Title: persistenceFunction</p>
   * <p>Description:持久化程式 </p>
   * @param list
   * @return
   */
  public boolean persistenceFunction(List<Permission> list) {
    logger.debug("f");
    Integer userId = Constants.getCurrendUser().getUserId();
    for (Permission function : list) {
      function.setLastmod(new Date());
      function.setModifyer(userId);
      if (Constants.TREE_GRID_ADD_STATUS.equals(function.getStatus())) {
        function.setPermissionId(null);
        function.setCreated(new Date());
        function.setLastmod(new Date());
        function.setModifyer(userId);
        function.setCreater(userId);
        function.setStatus(Constants.PERSISTENCE_STATUS);
      }

      permissionPublicDao.saveOrUpdate(function);
    }
    return true;
  }