/** 删除操作 */
 @RequestMapping("delete")
 public void deleteBpmFormDef(HttpServletRequest request) {
   String ids = StringUtils.getNullBlankStr(request.getParameter("ids"));
   if (StringUtils.isNotEmpty(ids)) {
     String[] idArr = ids.split(",");
     for (String id : idArr) {
       bpmFormDefService.deleteBpmFormDef(id);
     }
   }
 }
 /** Grid数据源 */
 @RequestMapping("list")
 public @ResponseBody GridData bpmFormDefList(HttpServletRequest request) {
   String catalogId = StringUtils.getNullBlankStr(request.getParameter("catalogId"));
   String formKey = StringUtils.getNullBlankStr(request.getParameter("formKey"));
   String subject = StringUtils.getNullBlankStr(request.getParameter("subject"));
   Map<String, Object> queryMap = new HashMap<String, Object>();
   queryMap.put("catalogId", catalogId);
   queryMap.put("formKey", formKey);
   queryMap.put("subject", subject);
   List<BpmFormDef> result = bpmFormDefService.findBpmFormDefPaging(queryMap);
   Page page = PageContextHolder.getPage();
   return new GridData(result, page.getPage(), page.getTotalPages(), page.getTotalItems());
 }
 @Before(value = "execution(* com.kcp*..*Service.*(..))")
 public void clearBeforeExcute(JoinPoint pjp) {
   if (StringUtils.isEmpty(SqlContextHolder.getJoinPoint())) {
     // 清空sql上下文信息
     SqlContextHolder.clear();
     SqlContextHolder.setJoinPoint(pjp.toLongString());
   }
 }
 /** 跳转至新增页面 */
 @RequestMapping("toAdd")
 public ModelAndView toAdd(HttpServletRequest request) throws Exception {
   String catalogId = StringUtils.getNullBlankStr(request.getParameter("catalogId"));
   String formKey =
       URLDecoder.decode(StringUtils.getNullBlankStr(request.getParameter("formKey")), "utf-8");
   ;
   String subject =
       URLDecoder.decode(StringUtils.getNullBlankStr(request.getParameter("subject")), "utf-8");
   String formDesc =
       URLDecoder.decode(StringUtils.getNullBlankStr(request.getParameter("formDesc")), "utf-8");
   String tableId = StringUtils.getNullBlankStr(request.getParameter("tableId"));
   String tableDesc =
       URLDecoder.decode(StringUtils.getNullBlankStr(request.getParameter("tableDesc")), "utf-8");
   String mainTmplId = StringUtils.getNullBlankStr(request.getParameter("mainTmplId"));
   BpmFormDef bpmFormDef = new BpmFormDef();
   bpmFormDef.setCatalogId(catalogId);
   bpmFormDef.setFormKey(formKey);
   bpmFormDef.setSubject(subject);
   bpmFormDef.setFormDesc(formDesc);
   bpmFormDef.setTableId(tableId);
   bpmFormDef.setTableDesc(tableDesc);
   String reult = genTemplate(tableId, mainTmplId);
   bpmFormDef.setHtml(reult);
   return new ModelAndView("workflow/form/bpmFormDefEdit")
       .addObject("bpmFormDef", bpmFormDef)
       .addObject("type", "add");
 }
 /** 跳转至查看页面 */
 @RequestMapping("toView")
 public ModelAndView toView(HttpServletRequest request) {
   String id = StringUtils.getNullBlankStr(request.getParameter("id"));
   BpmFormDef bpmFormDef = bpmFormDefService.getBpmFormDefById(id);
   if (bpmFormDef == null) {
     throw new BusinessException("选择的记录不存在!");
   }
   return new ModelAndView("workflow/form/bpmFormDefView").addObject("bpmFormDef", bpmFormDef);
 }
 @RequestMapping("validateFormKey")
 public @ResponseBody Object[] validateFormKey(HttpServletRequest request) {
   String formDefId = StringUtils.getNullBlankStr(request.getParameter("formDefId"));
   String formKey = StringUtils.getNullBlankStr(request.getParameter("fieldValue"));
   String filedId = StringUtils.getNullBlankStr(request.getParameter("fieldId"));
   BpmFormDef bpmFormDef = new BpmFormDef();
   bpmFormDef.setFormDefId(formDefId);
   bpmFormDef.setFormKey(formKey);
   int count = bpmFormDefService.countBpmFormDef(bpmFormDef);
   Object[] result = new Object[2];
   result[0] = filedId;
   if (count > 0) {
     result[1] = false;
   } else {
     result[1] = true;
   }
   return result;
 }
Esempio n. 7
0
  public static Map<String, String> getDecisionConditions(
      String processXml, String decisionNodeId) {
    Map<String, String> map = new HashMap<String, String>();
    processXml =
        processXml.replace(
            "xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\"", "xmlns:bpm='hotent'");
    Document doc = Dom4jUtil.loadXml(processXml);
    Element root = doc.getRootElement();

    List<Element> nodes = root.selectNodes("//sequenceFlow[@sourceRef='" + decisionNodeId + "']");
    for (Element el : nodes) {
      String id = el.attributeValue("targetRef");
      String condition = "";
      Element conditionNode = el.element("conditionExpression");
      if (conditionNode != null) {
        condition = conditionNode.getText().trim();
        condition = StringUtils.trimPrefix(condition, "${");
        condition = StringUtils.trimSufffix(condition, "}");
      }
      map.put(id, condition);
    }
    return map;
  }
 /** 组装页面传递过来的参数 */
 private BpmFormDef assembleBpmFormDef(HttpServletRequest request) {
   String formDefId = StringUtils.getNullBlankStr(request.getParameter("formDefId"));
   String catalogId = StringUtils.getNullBlankStr(request.getParameter("catalogId"));
   String formKey = StringUtils.getNullBlankStr(request.getParameter("formKey"));
   String subject = StringUtils.getNullBlankStr(request.getParameter("subject"));
   String formDesc = StringUtils.getNullBlankStr(request.getParameter("formDesc"));
   String html = StringUtils.getNullBlankStr(request.getParameter("html"));
   BpmFormDef bpmFormDef = null;
   if (StringUtils.isEmpty(formDefId)) {
     bpmFormDef = new BpmFormDef();
   } else {
     bpmFormDef = bpmFormDefService.getBpmFormDefById(formDefId);
   }
   bpmFormDef.setCatalogId(catalogId);
   bpmFormDef.setFormKey(formKey);
   bpmFormDef.setSubject(subject);
   bpmFormDef.setFormDesc(formDesc);
   bpmFormDef.setHtml(html);
   return bpmFormDef;
 }
 @RequestMapping("/toList")
 public ModelAndView toList(HttpServletRequest request) {
   String catalogId = StringUtils.getNullBlankStr(request.getParameter("catalogId"));
   return new ModelAndView("workflow/form/bpmFormDefList").addObject("catalogId", catalogId);
 }