Пример #1
0
 public String getHtmlLink() {
   if (StringUtil.isBlank(getNameKey())) {
     return "";
   }
   StringBuffer _sbLink = new StringBuffer();
   _sbLink.append("<a href='");
   if (StringUtil.isNotBlank(getAction())) {
     if (getAction().startsWith("/")) {
       _sbLink.append(this.m_request.getContextPath());
     }
     _sbLink.append(getAction().trim());
   }
   if (getLabelValueBeans().length > 0) {
     _sbLink.append("?");
   }
   for (int i = 0; i < getLabelValueBeans().length; i++) {
     _sbLink.append(getLabelValueBeans()[i].getLabel()).append("=");
     if (getLabelValueBeans()[i].getValue() != null
         && !getLabelValueBeans()[i].getValue().equals("null")) {
       _sbLink.append(getLabelValueBeans()[i].getValue());
     }
     _sbLink.append("&");
   }
   _sbLink.deleteCharAt(_sbLink.length() - 1);
   if (StringUtil.isNotBlank(getTarget())) {
     _sbLink.append("' target='").append(getTarget().trim());
   }
   _sbLink.append("'>").append(getButtonName()).append("</a>");
   return _sbLink.toString();
 }
Пример #2
0
  public String getButton() {
    if (StringUtil.isBlank(getNameKey())) {
      return "";
    }
    StringBuffer _sbButton = new StringBuffer();
    _sbButton.append("<form method='").append(getMethod().trim()).append("'");
    if (StringUtil.isNotBlank(getAction())) {
      _sbButton.append(" action='");
      if (getAction().startsWith("/")) {
        _sbButton.append(this.m_request.getContextPath());
      }
      _sbButton.append(getAction().trim()).append("'");
    }
    if (StringUtil.isNotBlank(getTarget())) {
      _sbButton.append(" target='").append(getTarget().trim()).append("'");
    }
    _sbButton.append(">").append(SystemUtils.LINE_SEPARATOR);
    for (int i = 0; i < getLabelValueBeans().length; i++) {
      _sbButton
          .append("<input type='hidden' name='")
          .append(getLabelValueBeans()[i].getLabel().trim())
          .append("' value='");
      if (getLabelValueBeans()[i].getValue() != null
          && !getLabelValueBeans()[i].getValue().equals("null")) {
        _sbButton.append(getLabelValueBeans()[i].getValue().trim());
      }
      _sbButton.append("'>").append(SystemUtils.LINE_SEPARATOR);
    }
    _sbButton.append("<input type='submit' value='").append(getButtonName().trim()).append("'>");
    _sbButton
        .append(SystemUtils.LINE_SEPARATOR)
        .append("</form>")
        .append(SystemUtils.LINE_SEPARATOR);

    return _sbButton.toString();
  }
Пример #3
0
 public static Long genLongkey(String tableName, String tableSchema, String keyVol) {
   String _str = tableName;
   if (StringUtil.isNotBlank(tableSchema)) {
     _str = tableSchema + "." + tableName;
   }
   if (m_mapSerials.get(_str) == null) {
     m_mapSerials.put(
         _str,
         ((RetrieveMaxKeyFromDB) BeansLocator.getBeanResource("retrieveMaxKeyFromDB"))
             .getLongMaxKey(tableName, tableSchema, keyVol));
   }
   Long _llTemp = new Long(((Long) m_mapSerials.get(_str)).longValue() + 1L);
   m_mapSerials.put(_str, _llTemp);
   return _llTemp;
 }
Пример #4
0
 public static String genStringkey(
     String tableName, String tableSchema, String keyVol, int keyLength) {
   String _str = tableName;
   if (StringUtil.isNotBlank(tableSchema)) {
     _str = tableSchema + "." + tableName;
   }
   if (m_mapSerials.get(_str) == null) {
     m_mapSerials.put(
         _str,
         ((RetrieveMaxKeyFromDB) BeansLocator.getBeanResource("retrieveMaxKeyFromDB"))
             .getStringMaxKey(tableName, tableSchema, keyVol));
   }
   String _strKey = stringIncrease((String) m_mapSerials.get(_str), keyLength);
   m_mapSerials.put(_str, _strKey);
   return _strKey;
 }
Пример #5
0
 public String getButtonName() {
   if (StringUtil.isNotBlank(getNameKey())) {
     return this.m_messageResources.getMessage(getNameKey());
   }
   return "";
 }
Пример #6
0
  public ActionForward queryPaperFeeByPaperNumber(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    if (logger.isDebugEnabled()) {
      logger.debug(
          "queryPaperFeeByPaperNumber(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) - start");
    }

    ActionMessages _messages = new ActionMessages();
    ActionForward _forward = mapping.findForward("paperFeeInput");
    try {
      ManagerFeeService _service = ApplicationServiceLocator.getManagerFeeService();
      String _strPaperNumber = RequestUtil.getRequiredStringParameter(request, "paperNumber");
      String _strPaperLNumber = RequestUtil.getRequiredStringParameter(request, "paperLNumber");
      SearchService _searchService = ApplicationServiceLocator.getSearchService();
      PaperView _paperView = _searchService.serachByPaperNumber(_strPaperNumber);
      SmallPaperView _smallPaperView = _paperView.getSmallPaperView();
      SmallAuthorView[] _smallAuthorViews = _paperView.getAuthors();

      for (int i = 0; i < _smallAuthorViews.length; i++) {
        if (StringUtil.isNotBlank(_smallAuthorViews[i].getChrPartiNo())) {
          _smallAuthorViews[i].setCurrentPaperLNumber(_strPaperLNumber);
          _smallAuthorViews[i].setRegFeeReceived(
              ServicesUtil.isRegFeeReceivedOfParticipant(_smallAuthorViews[i].getChrPartiNo()));
        }
      }

      TpaperPresented _tpaperPresented = _paperView.getPaperPresented();
      if (_tpaperPresented != null
          && StringUtil.isNotBlank(_tpaperPresented.getChrPresenterPartiNo())) {
        ParticipantDao _participantDao =
            (ParticipantDao) BeansLocator.getBeanResource("participantDao");
        Tparticipant _tparticipant =
            _participantDao.findByParticipantNo(_tpaperPresented.getChrPresenterPartiNo());
        SmallUserView _smallUserView = new SmallUserView();
        BeanUtils.copyProperties(_smallUserView, _tparticipant);
        _smallUserView.setCurrentPaperLNumber(_strPaperLNumber);
        _smallUserView.setRegFeeReceived(
            ServicesUtil.isRegFeeReceivedOfParticipant(_smallUserView.getChrPartiNo()));
        request.setAttribute("presented", _smallUserView);
      }

      request.setAttribute("paperView", _smallPaperView);
      request.setAttribute("authors", _smallAuthorViews);
      TpaperRegistation _tpaperRegistation =
          _service.loadPaperRegistrationByPaperNumber(_strPaperNumber);
      if (_tpaperRegistation == null) {
        _tpaperRegistation = new TpaperRegistation();
        _tpaperRegistation.setChvPaperLNumber(_strPaperLNumber);
        _tpaperRegistation.setChvPaperNumber(_strPaperNumber);
        _tpaperRegistation.setChrPaymentMethodNo("1");
        _tpaperRegistation.setBitIsAppJuniorAward(
            _paperView.getSmallPaperView().getBitIsJuniorAward());
        _tpaperRegistation.setBitIsAppJaegerPrize(
            _paperView.getSmallPaperView().getBitIsPaperPrize());
        _service.createPaperRegistration(_tpaperRegistation);
        _tpaperRegistation = _service.loadPaperRegistrationByPaperNumber(_strPaperNumber);
      }
      PaperFeeForm _form = (PaperFeeForm) form;
      _form.setPaperFee(_tpaperRegistation);

    } catch (BusinessServiceException e) {
      logger.error(
          "queryPaperFeeByPaperNumber(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)",
          e);

      _messages.add("paperFeeError", new ActionMessage("errors.code." + e.getErrCode()));
      saveErrors(request, _messages);
      _forward = mapping.findForward("error");
    } catch (CannotFoundRequestParameterException e) {
      logger.error(
          "queryPaperFeeByPaperNumber(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)",
          e);

      _messages.add("paperFeeError", new ActionMessage("errors.code.132"));
      saveErrors(request, _messages);
      _forward = mapping.findForward("error");
    } catch (Exception e) {
      logger.error(
          "queryPaperFeeByPaperNumber(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)",
          e);

      _messages.add("paperFeeError", new ActionMessage("errors.code.97"));
      saveErrors(request, _messages);
      _forward = mapping.findForward("error");
    }

    if (logger.isDebugEnabled()) {
      logger.debug(
          "queryPaperFeeByPaperNumber(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) - end");
    }
    return _forward;
  }
Пример #7
0
  public ActionForward updatePaperGranted(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    if (logger.isDebugEnabled()) {
      logger.debug(
          "updatePaperGranted(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) - start");
    }

    ActionMessages _messages = new ActionMessages();
    ActionForward _forward = mapping.findForward("success");
    try {
      if (isCancelled(request)) {
        if (logger.isDebugEnabled()) {
          logger.debug("updatePaperGranted() - Cancelled end.");
        }
        cancelledAction(mapping, request, response);
        return null;
      }
      saveBackButton(request, response);
      String _strPaperNumber =
          RequestUtil.getRequiredStringParameter(request, "paperFee.chvPaperNumber");
      String _strPaperLNumber =
          RequestUtil.getRequiredStringParameter(request, "paperFee.chvPaperLNumber");
      String _strPartiNo = RequestUtil.getStringParameter(request, "partiNo", "none");
      String _strOldPartiNo = RequestUtil.getStringParameter(request, "oldPartiNo", null);
      boolean _isRegFeeIsRecieved =
          RequestUtil.getBooleanParameter(request, "regFeeIsRecieved", false);
      if (_isRegFeeIsRecieved) {
        throw new BusinessServiceException(
            141,
            "Granted author has pay all fee. Can't update granted author of paper "
                + _strPaperLNumber);
      }
      ManagerFeeService _service = ApplicationServiceLocator.getManagerFeeService();
      if (StringUtil.isNotBlank(_strOldPartiNo)) {
        TregistrationFee _tregistrationFeeOld =
            _service.loadRegistrationFeeByPartiNo(_strOldPartiNo);
        _tregistrationFeeOld.setBitIsGranted(new Boolean(false));
        _tregistrationFeeOld.setChvPaperNumber("");
        _service.updateRegistrationFee(_tregistrationFeeOld);
      }
      if (!_strPartiNo.equals("none")) {
        TregistrationFee _tregistrationFeeNew = _service.loadRegistrationFeeByPartiNo(_strPartiNo);
        _tregistrationFeeNew.setBitIsGranted(new Boolean(true));
        _tregistrationFeeNew.setChvPaperNumber(_strPaperLNumber);
        _service.updateRegistrationFee(_tregistrationFeeNew);
      }
      TpaperRegistation _tpaperRegistation =
          _service.loadPaperRegistrationByPaperNumber(_strPaperNumber);
      if (_strPartiNo.equals("none")) {
        _tpaperRegistation.setChrGrantedPartiNo("");
      } else {
        _tpaperRegistation.setChrGrantedPartiNo(_strPartiNo);
      }
      _service.updatePaperRegistration(_tpaperRegistation);
      _messages.add(
          ActionMessages.GLOBAL_MESSAGE,
          new ActionMessage("success.modify.paper.registration.granted.message"));
      saveMessages(request, _messages);
    } catch (BusinessServiceException e) {
      logger.error(
          "updatePaperGranted(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)",
          e);

      _messages.add("paperFeeError", new ActionMessage("errors.code." + e.getErrCode()));
      saveErrors(request, _messages);
      _forward = mapping.findForward("error");
    } catch (CannotFoundRequestParameterException e) {
      logger.error(
          "updatePaperGranted(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)",
          e);

      _messages.add("paperFeeError", new ActionMessage("errors.code.132"));
      saveErrors(request, _messages);
      _forward = mapping.findForward("error");
    } catch (Exception e) {
      logger.error(
          "updatePaperGranted(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)",
          e);

      _messages.add("paperFeeError", new ActionMessage("errors.code.97"));
      saveErrors(request, _messages);
      _forward = mapping.findForward("error");
    }

    if (logger.isDebugEnabled()) {
      logger.debug(
          "updatePaperGranted(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) - end");
    }
    return _forward;
  }