Package com.iisigroup.cap.base.model

Examples of com.iisigroup.cap.base.model.ErrorCode


    MemoryUsage heap1 = ManagementUtils.getCurrentMemUsage();

    errorCodeCache.clear();
    List<ErrorCode> list = errorCodeDao.findByAll();
    for (ErrorCode origin : list) {
      ErrorCode targe = new ErrorCode();
      try {
        CapBeanUtil.copyBean(origin, targe);
        errorCodeCache.put(
            getCacheKey(origin.getCode(), origin.getLocale()),
            targe);
View Full Code Here


   * @return Map
   *
   */
  @Override
  public ErrorCode getErrorCode(String code, String locale) {
    ErrorCode errorCode = (ErrorCode) errorCodeCache.get(this.getCacheKey(
        code, locale));

    if (errorCode == null) {
      LOGGER.warn("[getErrorCode]!!! GET_ERRORCODE_FROM_DB !!!");
      errorCode = errorCodeDao.findByCode(code, locale);
View Full Code Here

      Object[] params) {
    String msgstr = null;
    if (isDBSource) {
      String localeStr = SimpleContextHolder.get(CapWebUtil.localeKey).toString();
      // String localeStr = "zh_TW";
      ErrorCode errorCode = RespMsgFactory.getInstance().getErrorCode(
          key, localeStr);

      if (errorCode == null) {
        msgstr = StrUtils.concat("WARN", SEPARATOR, key, SEPARATOR, "");
      } else {
        String msg = errorCode.getMessage();
        if (params != null) {
          msg = msg.replace("$\\{", "${").replace("\\}", "}");
          msg = MessageFormat.format(msg, params);
        }
        msgstr = StrUtils.concat(errorCode.getSeverity(), SEPARATOR,
            msg, SEPARATOR, errorCode.getSuggestion());
      }

    } else {
      if (workComp instanceof IRequest) {
        IRequest request = (IRequest) workComp;
View Full Code Here

      return "[RespMsgHelper][getMessage]ErrorCode is null!!";
    }
  }

  public static ErrorCode splitMessage(String msg) {
    ErrorCode errorCode = null;
    try {
      if (msg != null) {
        int idx = msg.indexOf("EFD");
        if (idx != -1) {
          errorCode = new ErrorCode();
          errorCode.setSeverity(msg.substring(0, idx));
          errorCode.setCode(msg.substring(idx, idx + 7));
          int idx2 = msg.indexOf(OUT_SEPARATOR, idx);
          int idx3 = msg.indexOf("|", idx2);
          if (idx2 != -1) {
            if (idx3 != -1) {
              errorCode.setMessage(msg.substring(idx2 + 1, idx3));
              errorCode.setSuggestion(msg.substring(idx3
                  + OUT_SUG_SEPARATOR.length()));
            } else {
              errorCode.setMessage(msg.substring(idx2 + 1));
              errorCode.setSuggestion("");
            }
          }
        }
      }
    } catch (Exception ex) {
View Full Code Here

  public IResult save(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    String oid = request.get("oid");
    String code = request.get("code").toUpperCase();
    String locale = request.get("locale");
    ErrorCode errorCode = null;

    if (CapString.isEmpty(oid)) {
      errorCode = errorCodeService.getErrorCode(code, locale);
      if (errorCode != null) {
        result.set("exist", Boolean.TRUE);
        return result;
      }
    } else {
      errorCode = commonSrv.findById(ErrorCode.class, oid);
    }

    if (errorCode == null) {
      errorCode = new ErrorCode();
      errorCode.setOid(null);
    }
    CapBeanUtil.map2Bean(request, errorCode, ErrorCode.class);
    errorCode.setCode(errorCode.getCode().toUpperCase());
    errorCode.setLastModifyBy(CapSecurityContext.getUserId());
    errorCode.setLastModifyTime(CapDate.getCurrentTimestamp());
    errorCodeService.save(errorCode);

    return result;
  }
View Full Code Here

   * @return {@link tw.com.iisi.cap.response.IResult}
   * @throws CapException
   */
  public IResult delete(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    ErrorCode code = commonSrv
        .findById(ErrorCode.class, request.get("oid"));
    if (code != null) {
      commonSrv.delete(code);
    }
    return result;
View Full Code Here

TOP

Related Classes of com.iisigroup.cap.base.model.ErrorCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.