Examples of DivCtItm


Examples of com.iisigroup.cap.rule.model.DivCtItm

    return ctItmDao.find(oid);
  }

  @Override
  public void deleteById(String oid) {
    DivCtItm ctItm = ctItmDao.find(oid);
    if (ctItm != null) {
      if(ctItm.getDivCtDtls()!=null){
        ctDtlDao.delete(ctItm.getDivCtDtls());
      }
      ctItmDao.delete(ctItm);
    }
  }
View Full Code Here

Examples of com.iisigroup.cap.rule.model.DivCtItm

    @SuppressWarnings("unchecked")
    public String reformat(Object in) throws CapFormatException {
      StringBuffer result = new StringBuffer();
      if (in instanceof DivRlDtl) {
        DivRlDtl rlDtl = ((DivRlDtl) in);
        DivCtItm ctItm =
            conditionMntService.findByDivCtItmNo(rlDtl.getDivCtNo());
        if(ctItm!=null){
          result.append(ctItm.getDivCtNm());
        }
      }
      return result.toString();
    }
View Full Code Here

Examples of com.iisigroup.cap.rule.model.DivCtItm

  @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.rule.model.DivCtItm

    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

Examples of com.iisigroup.cap.rule.model.DivCtItm

    @SuppressWarnings("unchecked")
    public String reformat(Object in) throws CapFormatException {
      StringBuffer result = new StringBuffer();
      if (in instanceof DivCtItm) {
        DivCtItm ctItm = ((DivCtItm) in);
        if(ctItm.getDivCtDtls()!=null && !ctItm.getDivCtDtls().isEmpty()){
          for(DivCtDtl ctDtl : ctItm.getDivCtDtls()){
            DivFtDtl ftDtl =
                factorMntService2.findByFactorNoAndRangeNo(ctDtl.getFactorNo(), ctDtl.getRangeNo());               
            result.append(ftDtl.getRangeNm()+",");
          }
          result.deleteCharAt(result.lastIndexOf(","));
View Full Code Here

Examples of com.iisigroup.cap.rule.model.DivCtItm

//        }
        CapBeanUtil.map2Bean(jsData, rlDtl);
        rlDtl.setDivRlNo(rlItm.getDivRlNo());
        rlDtl.setDivRlSor(new BigDecimal(i+1));
        rlDtl.setDivCtNo(jsData.optString("divCtNo"));
        DivCtItm ctItm = conditionMntService.getById(jsData.optString("divCtOid"));
//        rlDtl.setDivCtItm(ctItm);
        rlDtl.setDivRlItm(rlItm);
//        if(haveOld){
//          rlDtls.set(j, rlDtl);
//        }else{
View Full Code Here

Examples of com.iisigroup.cap.rule.model.DivCtItm

      List<String> tableNms = new ArrayList<String>();
      Map<String, DivCtDtl> colNms = new LinkedHashMap<String, DivCtDtl>();
      //排序的條件明細把它放到一個總集合,之後要填條件內容值($param)
      List<DivCtItm> ctItmList = new ArrayList<DivCtItm>();
      for(DivRlDtl rlDtl : rlDtls){
        DivCtItm ctItm = conditionMntService.findByDivCtItmNo(rlDtl.getDivCtNo());
        if(ctItm.getDivCtDtls()!=null && ctItm.getDivCtDtls().size()>conditionMaxCount){
          conditionMaxCount = ctItm.getDivCtDtls().size();
        }
        //排序的條件明細
        List<DivCtDtl> ctDtls = conditionMntService.findCtDtlsByCtNoAndSort(ctItm.getDivCtNo());
        //算出有幾種因子(因子和條件為1to1)
        for(DivCtDtl ctDtl : ctDtls){
          if(ctDtl.getDivFtDtl()!=null && ctDtl.getDivFtDtl().getDivFtItm()!=null){
            DivFtItm ftItm = ctDtl.getDivFtDtl().getDivFtItm();
            String tableNm = ftItm.getTableNm();
            String colNm = ftItm.getColumnNm();
            //每一種因子只會出現在CONDITION欄位一次
            if(!tableNms.contains(tableNm)){
              tableNms.add(tableNm);
            }
            if(!colNms.containsKey(colNm)){
              colNms.put(colNm, ctDtl);
            }
          }
        }
        ctItmList.add(ctItm);
      }//算完rule detail的內容

      //開始寫RuleTable第二行(抬頭)
      int i = 0, j = 0 ;
      Map<String, Integer> colSortNo = new HashMap<String, Integer>();
      for(String key : colNms.keySet()){
        DivCtDtl ctDtl = colNms.get(key);
        //CONDITOIN宣告欄位
        sheet1.addCell(new Label(1+j, 10, DroolsConstants.CONDITION_COL, setCellFmt));
        //資料型別宣告
        sheet1.addCell(new Label(1+j, 11, "beanClz:"+tableNms.get(0), setCellFmt));
        //這一行要擺 物件.屬性 + "比較運算元" + param/$1,$2
        String operand = "";
        if(ctDtl.getDivFtDtl()!=null){
          DivFtDtl ftDtl = ctDtl.getDivFtDtl();
          if(!CapString.isEmpty(ftDtl.getRange1()) && !CapString.isEmpty(ftDtl.getRange2())){
            operand = "$1<"+key+"&&"+key+"<=$2";
          }else{
            operand = key+"==$param";
          }
        }
        sheet1.addCell(new Label(1+j, 12, operand, setCellFmt));
        sheet1.addCell(new Label(1+j, 13, key, blueCellFmt));
        colSortNo.put(key, 1+j);
        i++;
        j++;
      }
      //Bean 宣告合併欄位
      sheet1.mergeCells(1, 11, j, 11);
     
      //宣告完CONDITION欄位,在宣告ACTIVITION-GROUP&NO-LOOP&PRIORITY
      int actGpColNo = 1+j;
      sheet1.addCell(new Label(actGpColNo, 10, DroolsConstants.ACTIVATION_GROUP, setCellFmt));
      sheet1.addCell(new Label(actGpColNo, 11, "", setCellFmt));
      sheet1.addCell(new Label(actGpColNo, 12, "", setCellFmt));
      sheet1.addCell(new Label(actGpColNo, 13, "activation group", blueCellFmt));
      int noLpColNo = actGpColNo+1;
      sheet1.addCell(new Label(noLpColNo, 10, DroolsConstants.NO_LOOP, setCellFmt));
      sheet1.addCell(new Label(noLpColNo, 11, "", setCellFmt));
      sheet1.addCell(new Label(noLpColNo, 12, "", setCellFmt));
      sheet1.addCell(new Label(noLpColNo, 13, "no loop", blueCellFmt));
      int priColNo = noLpColNo+1;
      sheet1.addCell(new Label(priColNo, 10, DroolsConstants.PRIORITY, setCellFmt));
      sheet1.addCell(new Label(priColNo, 11, "", setCellFmt));
      sheet1.addCell(new Label(priColNo, 12, "", setCellFmt));
      sheet1.addCell(new Label(priColNo, 13, "priority", blueCellFmt));
     
      //最後宣告ACTION
      int actColNo1 = priColNo+1;
      sheet1.addCell(new Label(actColNo1, 10, DroolsConstants.ACTION_COL, setCellFmt));
      sheet1.addCell(new Label(actColNo1, 11, "", setCellFmt));
      sheet1.addCell(new Label(actColNo1, 12, "beanClz.setGrpUppId(\"$param\");", setCellFmt));
      sheet1.addCell(new Label(actColNo1, 13, "", yellowCellFmt));

      int actColNo2 = actColNo1+1;
      sheet1.addCell(new Label(actColNo2, 10, DroolsConstants.ACTION_COL, setCellFmt));
      sheet1.addCell(new Label(actColNo2, 11, "", setCellFmt));
      sheet1.addCell(new Label(actColNo2, 12, "beanClz.setDocStatus(\"$param\");", setCellFmt));
      sheet1.addCell(new Label(actColNo2, 13, "", yellowCellFmt));
     
      int actColNo3 = actColNo2+1;
      sheet1.addCell(new Label(actColNo3, 10, DroolsConstants.ACTION_COL, setCellFmt));
      sheet1.addCell(new Label(actColNo3, 11, "", setCellFmt));
      sheet1.addCell(new Label(actColNo3, 12, "System.out.println(\"$param\"+ \" CASEINFO IS "
          + "\" +beanClz.getCasNo()+\" ** 分組結果 = "
          + "\" +beanClz.getGrpUppId() );", setCellFmt));
      sheet1.addCell(new Label(actColNo3, 13, "", yellowCellFmt));
      sheet1.addCell(new Label(0, 13, "Base rules", greenCellFmt));

      /*
       * 將總明細資料一筆一筆拆開來,將condition-->factor的值域填到Excel
       */
      if(!ctItmList.isEmpty()){
        int rowNo = 14, count = 0;
        for(DivCtItm ctItm : ctItmList){
          if(ctItm.getDivCtDtls()!=null){
            //CtItm list對應到自己的CtDtl,所以一筆CtItm就是一行Rule Row
            for(DivCtDtl ctDtl : ctItm.getDivCtDtls()){
              ctItm = ctDtl.getDivCtItm();
              //設定Action動作
              sheet1.addCell(new Label(actColNo1, rowNo, ctItm.getDivCtAction(), bodyCellFmt));
              sheet1.addCell(new Label(actColNo2, rowNo, ctItm.getDivCtSetting(), bodyCellFmt));
              sheet1.addCell(new Label(actColNo3, rowNo, "Test Condition::"+ctItm.getDivCtNm(), bodyCellFmt));

              DivFtDtl ftDtl = ctDtl.getDivFtDtl();
              String colNm = ftDtl.getDivFtItm().getColumnNm();
              //取得要放到第幾個cell
              Integer colNo = colSortNo.get(colNm);
View Full Code Here

Examples of com.iisigroup.cap.rule.model.DivCtItm

    @SuppressWarnings("unchecked")
    public String reformat(Object in) throws CapFormatException {
      StringBuffer result = new StringBuffer();
      if (in instanceof DivCtItm) {
        DivCtItm ctItm = ((DivCtItm) in);
        if(ctItm.getDivCtDtls()!=null){
          for(DivCtDtl ctDtl : ctItm.getDivCtDtls()){
            result.append(ctDtl.getDivFtDtl().getRangeNm()+",");
          }
          if(result.length()>0)
            result.deleteCharAt(result.lastIndexOf(","));
        }
View Full Code Here

Examples of com.iisigroup.cap.rule.model.DivCtItm

      StringBuffer result = new StringBuffer();
      if (in instanceof DivRlItm) {
        DivRlItm rlItm = ((DivRlItm) in);
        if(rlItm.getDivRlDtls()!=null && !rlItm.getDivRlDtls().isEmpty()){
          for(DivRlDtl rlDtl : rlItm.getDivRlDtls()){
            DivCtItm ctItm =
                conditionMntService.findByDivCtItmNo(rlDtl.getDivCtNo());
            if(ctItm!=null)
              result.append(ctItm.getDivCtNm()+",");
          }
          if(result.length()>0)
            result.deleteCharAt(result.lastIndexOf(","));
        }
      }
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.