コード例 #1
0
  public ResponseContext execute(ResponseContext resc) throws BusinessLogicException {
    try {
      RequestContext reqc = getRequestContext();

      String[] targets = reqc.getParameter("target");

      MySqlConnectionManager.getInstance().beginTransaction();
      AbstractDaoFactory factory = AbstractDaoFactory.getFactory("users");
      AbstractDao dao = factory.getAbstractDao();

      List users = new ArrayList();

      for (int i = 0; i < targets.length; i++) {
        Map params = new HashMap();
        params.put("value", targets[i]);
        params.put("where", "where user_id=?");

        UserBean ub = (UserBean) dao.read(params);

        params.put("userId", targets[i]);
        params.put("adminFlag", "1");
        params.put("userbean", ub);
        dao.update(params);
        users.add(ub.getUserName());
      }

      MySqlConnectionManager.getInstance().commit();
      MySqlConnectionManager.getInstance().closeConnection();

      Map result = new HashMap();
      result.put("list", users);
      result.put("want", "管理者権限に");

      resc.setResult(result);
      resc.setTarget("AccountChangeResult");

      return resc;
    } catch (IntegrationException e) {
      throw new BusinessLogicException(e.getMessage(), e);
    }
  }
コード例 #2
0
  public ResponseContext execute(ResponseContext resc) throws BusinessLogicException {
    try {
      RequestContext reqc = getRequestContext();

      String[] articleId = reqc.getParameter("articleId");

      String status = reqc.getParameter("status")[0];

      Map params = new HashMap();

      params.put("status", status);

      AbstractDaoFactory factory = AbstractDaoFactory.getFactory("article");
      AbstractDao dao = factory.getAbstractDao();

      for (int i = 0; i < articleId.length; i++) {
        params.put("articleId", articleId[i]);

        MySqlConnectionManager.getInstance().beginTransaction();

        ArticleBean ab = (ArticleBean) dao.read(params);

        params.put("articlebean", ab);
        dao.update(params);

        MySqlConnectionManager.getInstance().commit();
        MySqlConnectionManager.getInstance().closeConnection();
      }

      resc.setTarget("publicationrangesetting");

      return resc;

    } catch (IntegrationException e) {
      throw new BusinessLogicException(e.getMessage(), e);
    }
  }