Examples of AjaxFormResult


Examples of com.iisigroup.cap.response.AjaxFormResult

  @SuppressWarnings("rawtypes")
  public IResult queryByKeys(IRequest request) {
    String locale = CapSecurityContext.getLocale().toString();
    String[] keys = request.getParamsAsStringArray("keys");
    String[] aKeys = request.getParamsAsStringArray("akeys");
    AjaxFormResult mresult = new AjaxFormResult();
    if (keys.length > 0 && !CapString.isEmpty(keys[0])) {
      Set<String> k = new HashSet<String>(Arrays.asList(keys));// 排除重覆的key
      Map<String, AjaxFormResult> m = codeTypeService.getCodeTypeByTypes(
          k.toArray(new String[k.size()]), locale);
      mresult.setResultMap(m);
    }
    if (aKeys.length > 0 && !CapString.isEmpty(aKeys[0])) {
      Class[] paramTypes = { IRequest.class };
      IResult rtn = null;
      for (String key : aKeys) {
        if (mresult.containsKey(key)) {
          continue;
        }
        Method method = ReflectionUtils.findMethod(this.getClass(),
            key, paramTypes);
        if (method != null) {
          try {
            rtn = (IResult) method.invoke(this, request);
          } catch (Exception e) {
            logger.error("load ComboBox error : key = " + key, e);
          }
          mresult.set(key, (AjaxFormResult) rtn);
        }
      }
    }
    return mresult;
  }// ;
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

        search.getFirstResult(), search.getMaxResults());
    return new MapGridResult(page.getContent(), page.getTotalRow());
  }// ;

  public IResult getNewSeq(IRequest params) {
    AjaxFormResult result = new AjaxFormResult();
    String seqNode = params.get("seqNode");
    int theSeq = seqSrv.getNextSeqNo(seqNode, 1, 1, Integer.MAX_VALUE);
    result.set("theSeq", theSeq);
    return result;
  }// ;
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

    Page<Reminds> page = commonSrv.findPage(Reminds.class, search);
    return new GridResult(page.getContent(), page.getTotalRow(), fmt);
  }// ;

  public IResult queryForm(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    String oid = request.get("oid");
    Remind remind = null;

    if (!CapString.isEmpty(oid)) {
      remind = commonSrv.findById(Remind.class, oid);
    }

    if (remind != null) {
      Map<String, IFormatter> fmt = new HashMap<String, IFormatter>();
      fmt.put("startDate", new ADDateFormatter());
      fmt.put("endDate", new ADDateFormatter());

      result.set("startTime", new ADDateTimeFormatter("HH:mm")
          .reformat(remind.getStartDate()));
      result.set("endTime", new ADDateTimeFormatter("HH:mm")
          .reformat(remind.getEndDate()));
      result.putAll(new AjaxFormResult(remind.toJSONObject(
          CapEntityUtil.getColumnName(remind), fmt)));
    }

    return result;
  }
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

    List<DivRlItm> ftList = rlItmDao.findByDivRlNoAndInputFlg(nos, "1");
    Map<String, AjaxFormResult> m = new LinkedHashMap<String, AjaxFormResult>();
    if (!ftList.isEmpty()) {
      for (DivRlItm c : ftList) {
        String rlItmNo = c.getDivRlNo();
        AjaxFormResult sm = m.get(rlItmNo);
        if (sm == null) {
          sm = new AjaxFormResult();
        }
        sm.set(c.getDivRlNo(), c.getDivRlNm());
        m.put(rlItmNo, sm);
      }
    }
    return m;
  }
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

   */
  @HandlerType(HandlerTypeEnum.FORM)
  public IResult query(IRequest request) {
    String oid = request.get("mainOid");
    String factorNo = request.get("factorNo");
    AjaxFormResult result = new AjaxFormResult();
    DivFtItm ftItm = null;
    if(!CapString.isEmpty(oid)){
      ftItm = factorMntService.getById(oid);
    }else if(!CapString.isEmpty(factorNo)){
      ftItm = factorMntService.findByDivFtItmNo(factorNo);
    }
    if(ftItm!=null){
      result.putAll(ftItm.toJSONObject(new String[]{"factorNo", "factorNm", "dataType"
          , "oid", "tableNm", "columnNm"}, null));
    }
    return result;
  }// ;
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

   * modify Factor Item and Detail
   * @param request request
   * @return IResult
   */
  public IResult saveFactorDtl(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    String type = request.get("type");
    String divFtItmNo = request.get("factorNo");
    String[] sary = request.getParamsAsStringArray("grid[]");
    DivFtItm ftItm = factorMntService.findByDivFtItmNo(divFtItmNo);

    if ("A".equals(type)) {
      if (ftItm != null) {
        // factorMnt.0001 代碼重覆!
        throw new CapMessageException(
            CapAppContext.getMessage("factorMntPage.0001"), getClass());
      }
      ftItm = new DivFtItm();
    } else {
      if (ftItm != null && !ftItm.getOid().equals(request.get("oid"))) {
        // factorMnt.0001 代碼重覆!
        throw new CapMessageException(
            CapAppContext.getMessage("factorMntPage.0001"), getClass());
      } else if (ftItm == null && !CapString.isEmpty(request.get("oid"))) {
        ftItm = factorMntService.getById(request.get("oid"));
      } else if (ftItm == null){
        ftItm = new DivFtItm();
      }
    }
    CapBeanUtil.map2Bean(request, ftItm);
    if ("A".equals(type)) {
      ftItm.setOid(null);
    }
    List<DivFtDtl> delFtDtl = new ArrayList<DivFtDtl>()
    if(ftItm.getDivFtDtls()!=null&&!ftItm.getDivFtDtls().isEmpty()){
      delFtDtl = ftItm.getDivFtDtls();
    }
    if(sary!=null){
      List<DivFtDtl> ftDtls = new ArrayList<DivFtDtl>();
      for(int i = 0 ; i<sary.length; i++){
        JSONObject gridData = JSONObject.fromObject(sary[i]);
        DivFtDtl ftDtl = new DivFtDtl();
        CapBeanUtil.map2Bean(gridData, ftDtl);
        ftDtl.setFactorNo(ftItm.getFactorNo());
        if(!CapString.isEmpty(gridData.optString("rangeNo"))){
          ftDtl.setRangeNo(gridData.optString("rangeNo"));
        }else{
          ftDtl.setRangeNo(CapString.fillString(String.valueOf(i), 5, true, '0'));
        }
        if(!CapString.isEmpty(gridData.optString("oid"))){
          ftDtl.setOid(gridData.optString("oid"));
        }
        ftDtl.setRangeSor(new BigDecimal(i));
        ftDtl.setDivFtItm(ftItm);
        ftDtls.add(ftDtl);
      }
      ftItm.setDivFtDtls(ftDtls);
    }
    String userId = CapSecurityContext.getUserId();
    if(userId.length()>6)userId = userId.substring(0,6);
    ftItm.setUpdater(userId);
    ftItm.setUpdateTime(CapDate.getCurrentTimestamp());
    factorMntService.saveDivFtItm(ftItm);
    if(!delFtDtl.isEmpty())
      factorMntService.deleteFtDtlByList(delFtDtl);
    result.set(Constants.AJAX_NOTIFY_MESSAGE, CapAppContext.getMessage("factorMntPage.0002"));
    return result;
  }
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

   * delete Division Factor Item and Detail
   * @param request request
   * @return IResult
   */
  public IResult delete(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    factorMntService.deleteById(request.get("oid"));
    result.set(Constants.AJAX_NOTIFY_MESSAGE, CapAppContext.getMessage("factorMntPage.0003"));
    return result;
  }
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

    result.set(Constants.AJAX_NOTIFY_MESSAGE, CapAppContext.getMessage("factorMntPage.0003"));
    return result;
  }

  public IResult insertTestCases(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    factorMntService.insertTestCaseInfoData();
    return result;
  }
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

   */
  @HandlerType(HandlerTypeEnum.FORM)
  public IResult query(IRequest request) {
    String oid = request.get("mainOid");
    String divCtNo = request.get("divCtNo");
    AjaxFormResult result = new AjaxFormResult();
    DivCtItm ctItm = null;
    if(!CapString.isEmpty(oid)){
      ctItm = conditionMntService.getById(oid);
    }else if(!CapString.isEmpty(divCtNo)){
      ctItm = conditionMntService.findByDivCtItmNo(divCtNo);
    }
    if(ctItm!=null){
      result.putAll(ctItm.toJSONObject(new String[]{"divCtNo", "divCtNm"
          , "divCtTyp", "divCtSetting", "divCtAction", "oid"}, null));
//      if(ctItm.getDivCtDtls()!=null && !ctItm.getDivCtDtls().isEmpty()){
//        DivCtDtl ctDtl = ctItm.getDivCtDtls().get(0);
//        JSONObject jsObj = JSONObject.fromObject(ctDtl.getDivCtJson());
//        String rangeNoKey = jsObj.optString("gridData");
View Full Code Here

Examples of com.iisigroup.cap.response.AjaxFormResult

   * modify Condition Item and Detail
   * @param request request
   * @return IResult
   */
  public IResult saveConditionDtl(IRequest request) {
    AjaxFormResult result = new AjaxFormResult();
    String type = request.get("type");
    String divCtNo = request.get("divCtNo");
    //Factor DETAIL
    String[] ftGridData = request.getParamsAsStringArray("grid[]");
    DivCtItm ctItm = conditionMntService.findByDivCtItmNo(divCtNo);

    if ("A".equals(type)) {
      if (ctItm != null) {
        // conditionMnt.0001 條件代碼重覆!
        throw new CapMessageException(
            CapAppContext.getMessage("condition.0001"), getClass());
      }
      ctItm = new DivCtItm();
    } else {
      if (ctItm != null && !ctItm.getOid().equals(request.get("oid"))) {
        // conditionMnt.0001 條件代碼重覆!
        throw new CapMessageException(
            CapAppContext.getMessage("condition.0001"), getClass());
      } else if (ctItm == null && !CapString.isEmpty(request.get("oid"))) {
        ctItm = conditionMntService.getById(request.get("oid"));
      } else if (ctItm == null){
        ctItm = new DivCtItm();
      }
    }
    CapBeanUtil.map2Bean(request, ctItm);
    if ("A".equals(type)) {
      ctItm.setOid(null);
    }
    List<DivCtDtl> delCtDtl = new ArrayList<DivCtDtl>();
    if(ftGridData!=null){
      List<DivCtDtl> ctDtls = new LinkedList<DivCtDtl>();
      if(ctItm.getDivCtDtls()!=null&&!ctItm.getDivCtDtls().isEmpty()){
        delCtDtl = ctItm.getDivCtDtls();
      }
      for(int i = 0; i<ftGridData.length; i++){
        JSONObject jsData = JSONObject.fromObject(ftGridData[i]);
        DivCtDtl ctDtl = new DivCtDtl();
//        int j = 0;
//        boolean haveOld = false;
//        if(!CapString.isEmpty(jsData.getString("oid")) && !ctItm.getDivCtDtls().isEmpty()){
//          for(DivCtDtl ctDtl2 : ctDtls){
//            j++;
//            if(ctDtl2.getOid().equals(jsData.opt("oid"))){
//              ctDtl = ctDtl2;
//              haveOld = true;
//              break;
//            }
//          }
//        }
        CapBeanUtil.map2Bean(jsData, ctDtl);
        ctDtl.setDivCtNo(ctItm.getDivCtNo());
        ctDtl.setDivCtSor(new BigDecimal(i+1));
        ctDtl.setRangeNo(jsData.optString("rangeNo"));
        DivFtDtl ftDtl = factorMntService.findByFactorNoAndRangeNo(
            jsData.optString("factorNo"), jsData.optString("rangeNo"));
        ctDtl.setDivFtDtl(ftDtl);
        ctDtl.setDivCtItm(ctItm);
//        if(haveOld){
//          ctDtls.set(j, ctDtl);
//        }else{
          ctDtls.add(ctDtl);
//        }
      }
     
      ctItm.setDivCtDtls(ctDtls);
    }
    String userId = CapSecurityContext.getUserId();
    if(userId.length()>6)userId = userId.substring(0,6);
    ctItm.setUpdater(userId);
    ctItm.setUpdateTime(CapDate.getCurrentTimestamp());
    ctItm.setDivCtTyp("C");
    conditionMntService.saveDivCtItm(ctItm);
    if(!delCtDtl.isEmpty())
      conditionMntService.deleteCtDtlByList(delCtDtl);
    result.set(Constants.AJAX_NOTIFY_MESSAGE, CapAppContext.getMessage("condition.0002"));
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.