コード例 #1
0
  /**
   * 登録処理を行います.<br>
   * 登録完了時および何かしらの問題があった場合に、画面にメッセージを表示します.<br>
   * 処理実行後、{@link Mapping#INPUT}で定義されたURIに遷移します.
   *
   * @return 画面遷移先のURI文字列
   * @throws Exception
   */
  @Execute(validator = true, validate = "validateForInsert", input = EditDeptAction.Mapping.INPUT)
  public String insert() throws Exception {
    try {
      Dept dept = this.deptService.findById(this.editDeptForm.deptId);
      if (dept != null) {
        super.messages.add(
            ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.dept.already.exists"));
        ActionMessagesUtil.addErrors(super.httpRequest, super.messages);
        return EditDeptAction.Mapping.INPUT;
      }

      DeptDto dto = Beans.createAndCopy(DeptDto.class, this.editDeptForm).execute();

      this.deptService.insertRecord(dto);

      this.init(this.editDeptForm.deptId);

      super.messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("infos.insert"));
      ActionMessagesUtil.addMessages(super.httpRequest, super.messages);
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    return EditDeptAction.Mapping.INPUT;
  }
コード例 #2
0
  /**
   * 削除処理を行います.<br>
   * 削除完了時および何かしら問題があった場合に、画面にメッセージを表示します.<br>
   * 処理実行後、{@link Mapping#INPUT}で定義されたURIに遷移します.
   *
   * @return 画面遷移先のURI文字列
   * @throws Exception
   */
  @Execute(validator = false)
  public String delete() throws Exception {
    try {
      List<Dept> deptList = this.deptService.findByParentId(this.editDeptForm.deptId);
      if (deptList.size() > 0) {
        super.messages.add(
            ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.dept.childexists"));
        ActionMessagesUtil.addErrors(super.httpRequest, super.messages);
        return EditDeptAction.Mapping.INPUT;
      }

      this.deptService.deleteRecord(
          Beans.createAndCopy(DeptDto.class, this.editDeptForm).execute());
      this.init(null);

      super.messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("infos.delete"));
      ActionMessagesUtil.addMessages(super.httpRequest, super.messages);
    } catch (UnabledLockException e) {
      super.errorLog(e);

      super.messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(e.getKey()));
      ActionMessagesUtil.addErrors(super.httpRequest, super.messages);
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    return EditDeptAction.Mapping.INPUT;
  }
コード例 #3
0
  /**
   * 受注伝票を更新します.
   *
   * @param dto 受注伝票DTO
   * @return ロック結果
   * @throws UnabledLockException
   * @throws ServiceException
   */
  @Override
  protected int updateRecord(ROrderSlipDto dto) throws UnabledLockException, ServiceException {

    RoSlipTrn entity =
        Beans.createAndCopy(RoSlipTrn.class, dto)
            .dateConverter(Constants.FORMAT.DATE, "roDate", "validDate")
            .dateConverter(Constants.FORMAT.DATE, "shipDate", "validDate")
            .dateConverter(Constants.FORMAT.DATE, "deliveryDate", "validDate")
            .dateConverter(Constants.FORMAT.TIMESTAMP, "updDatetm")
            .execute();

    if (dto.cutoffGroupCategory != null && dto.cutoffGroupCategory.length() == 3) {

      entity.cutoffGroup = dto.cutoffGroupCategory.substring(0, 2);

      entity.paybackCycleCategory = dto.cutoffGroupCategory.substring(2, 3);
    }

    int lockResult =
        this.lockRecord(
            RoSlipService.Param.RO_SLIP_ID,
            entity.roSlipId.toString(),
            entity.updDatetm,
            "rorder/LockSlip.sql");

    Map<String, Object> param = setEntityToParam(entity);
    this.updateBySqlFile("rorder/UpdateSlip.sql", param).execute();

    return lockResult;
  }
コード例 #4
0
  /**
   * 受注伝票を登録します.
   *
   * @param dto 受注伝票DTO
   * @return 登録件数
   * @throws ServiceException
   */
  @Override
  protected int insertRecord(ROrderSlipDto dto) throws ServiceException {

    dto.roSlipId = Long.toString(seqMakerService.nextval(RoSlipService.Table.RO_SLIP_TRN));
    NumberConverter convUP = createUnitPriceConverter(dto.priceFractCategory);
    NumberConverter convTax = createUnitPriceConverter(dto.taxFractCategory);

    RoSlipTrn entity =
        Beans.createAndCopy(RoSlipTrn.class, dto)
            .converter(convUP, "retailPriceTotal", "priceTotal", "costTotal")
            .converter(convTax, "ctaxPriceTotal")
            .dateConverter(Constants.FORMAT.DATE, "roDate", "validDate")
            .dateConverter(Constants.FORMAT.DATE, "shipDate", "validDate")
            .dateConverter(Constants.FORMAT.DATE, "deliveryDate", "validDate")
            .execute();

    if (dto.cutoffGroupCategory != null && dto.cutoffGroupCategory.length() == 3) {

      entity.cutoffGroup = dto.cutoffGroupCategory.substring(0, 2);

      entity.paybackCycleCategory = dto.cutoffGroupCategory.substring(2, 3);
    }

    Map<String, Object> param = setEntityToParam(entity);

    return this.updateBySqlFile("rorder/InsertRoSlip.sql", param).execute();
  }
コード例 #5
0
  /**
   * レートIDからレートマスタの情報を取得します.
   *
   * @return レートマスタ情報
   * @throws Exception
   */
  @Execute(validator = false, urlPattern = "getRateInfosByRateId/{rateId}")
  public String getRateInfosByRateId() throws Exception {

    if (!StringUtil.hasLength(commonRateForm.rateId)) {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    try {

      Rate rate = rateService.findById(commonRateForm.rateId);

      if (rate != null) {

        BeanMap map =
            Beans.createAndCopy(BeanMap.class, rate)
                .dateConverter(Constants.FORMAT.TIMESTAMP, "creDatetm", "updDatetm")
                .execute();

        BeanMap bmap = super.createBeanMapWithNullToEmpty(map);
        ResponseUtil.write(JSON.encode(bmap), "text/javascript");

      } else {
        ResponseUtil.write("", "text/javascript");
      }

    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    return null;
  }
コード例 #6
0
 @Execute(validator = false)
 public String complete() {
   Lesson lesson =
       Beans.createAndCopy(Lesson.class, lessonForm)
           .dateConverter("yyyy-MM-dd HH:mm:ss", "lessonDate")
           .execute();
   lessonService.update(lesson);
   return "/educate/lesson/complete.jsp";
 }
コード例 #7
0
  @Execute(validator = false, redirect = true)
  @RemoveSession(name = "accountDto")
  public String submit() {
    account = Beans.createAndCopy(Account.class, sregisterForm).execute();
    accountService.delete(account);
    account.disabledFlg = 1;
    if (account.authority == 0) {}

    return "/index";
  }
コード例 #8
0
  /**
   * 受注伝票番号を指定して、受注伝票情報を取得します.
   *
   * @param id 受注伝票番号
   * @return 受注伝票DTO
   * @throws ServiceException
   */
  @Override
  public ROrderSlipDto loadBySlipId(String id) throws ServiceException {
    if (id == null || id.equals("")) {
      return null;
    }

    RoSlipTrn record = getRoSlipTrn(id);

    if (record == null) {
      return null;
    }

    ROrderSlipDto trnDto =
        Beans.createAndCopy(ROrderSlipDto.class, record)
            .dateConverter(Constants.FORMAT.TIMESTAMP, "updDatetm")
            .execute();

    trnDto.cutoffGroupCategory = trnDto.cutoffGroup + trnDto.paybackCycleCategory;

    return trnDto;
  }
コード例 #9
0
  /**
   * 更新処理を行います.<br>
   * 更新完了時に、画面にメッセージを表示します. 処理実行後、{@link Mapping#INPUT}で定義されたURIに遷移します.
   *
   * @return 画面遷移先のURI文字列
   * @throws Exception
   */
  @Execute(validator = true, validate = "validateForUpdate", input = EditDeptAction.Mapping.INPUT)
  public String update() throws Exception {
    try {
      DeptDto dto = Beans.createAndCopy(DeptDto.class, this.editDeptForm).execute();

      this.deptService.updateRecord(dto);

      this.init(this.editDeptForm.deptId);

      super.messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("infos.update"));
      ActionMessagesUtil.addMessages(super.httpRequest, super.messages);
    } catch (UnabledLockException e) {
      super.errorLog(e);

      super.messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(e.getKey()));
      ActionMessagesUtil.addErrors(super.httpRequest, super.messages);
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    return EditDeptAction.Mapping.INPUT;
  }
コード例 #10
0
  /**
   * アクションフォームを初期化します.
   *
   * @param deptId 部門ID
   * @throws ServiceException
   */
  private void init(String deptId) throws ServiceException {
    this.editDeptForm.reset();

    this.editDeptForm.isUpdate = super.userDto.isMenuUpdate(Constants.MENU_ID.SETTING_DEPT);

    List<Dept> deptList = this.deptService.findAllDept();
    for (Dept dept : deptList) {
      this.editDeptForm.parentList.add(new LabelValueBean(dept.name, dept.deptId));
    }
    this.editDeptForm.parentList.add(0, new LabelValueBean());

    if (!StringUtil.hasLength(deptId)) {
      return;
    }

    List<DeptDto> deptDtoList = this.deptService.convertEntityToDto(deptList);
    for (DeptDto dto : deptDtoList) {
      if (!deptId.equals(dto.deptId)) {
        continue;
      }

      List<DeptDto> descDeptList = dto.getDescDetp();

      Iterator<LabelValueBean> ite = this.editDeptForm.parentList.iterator();
      while (ite.hasNext()) {
        LabelValueBean bean = ite.next();
        if (bean.getValue() == null) {

          continue;
        }

        if (bean.getValue().equals(deptId)) {

          ite.remove();
          continue;
        }

        for (DeptDto desc : descDeptList) {
          if (bean.getValue().equals(desc.deptId)) {

            ite.remove();
            break;
          }
        }
      }
    }

    Dept dept = this.deptService.findById(deptId);
    if (dept == null) {
      return;
    }
    Beans.copy(dept, this.editDeptForm)
        .timestampConverter(Constants.FORMAT.TIMESTAMP)
        .dateConverter(Constants.FORMAT.DATE)
        .execute();

    this.editDeptForm.creDatetmShow =
        StringUtil.getDateString(Constants.FORMAT.DATE, dept.creDatetm);
    this.editDeptForm.updDatetmShow =
        StringUtil.getDateString(Constants.FORMAT.DATE, dept.updDatetm);

    this.editDeptForm.editMode = true;
  }
コード例 #11
0
ファイル: EmpAction.java プロジェクト: yuroyoro/s2conAutumn
 @Execute(input = "edit.jsp", redirect = true)
 public String update() {
   Emp entity = Beans.createAndCopy(Emp.class, empForm).dateConverter("yyyy-MM-dd").execute();
   empService.update(entity);
   return "/emp/";
 }
コード例 #12
0
ファイル: EmpAction.java プロジェクト: yuroyoro/s2conAutumn
 @Execute(validator = false, urlPattern = "delete/{id}/{versionNo}", redirect = true)
 public String delete() {
   Emp entity = Beans.createAndCopy(Emp.class, empForm).dateConverter("yyyy-MM-dd").execute();
   empService.delete(entity);
   return "/emp/";
 }
コード例 #13
0
ファイル: EmpAction.java プロジェクト: yuroyoro/s2conAutumn
 @Execute(validator = false, urlPattern = "edit/{id}")
 public String edit() {
   Emp entity = empService.findById(Long.valueOf(empForm.id));
   Beans.copy(entity, empForm).dateConverter("yyyy-MM-dd").execute();
   return "edit.jsp";
 }
コード例 #14
0
 @Execute(validator = false)
 public String index() {
   Lesson lesson = lessonService.findById(Integer.parseInt(lessonForm.lessonId));
   Beans.copy(lesson, lessonForm).dateConverter("yyyy-MM-dd HH:mm:ss", "lessonDate").execute();
   return "confirm.jsp";
 }