/** * 构造每个bop的布局样式 R2(C2(bop1, bop2)) 或 R2(bop3, C2(bop1, bop2)) * <li>1. 遍历表达式, 解析子元素; * <li>2. 遇到左括号,将R2, C2 表达式压入表达式栈顶; * <li>3. 遇到逗号, 如果栈不为空, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap; 如果栈为空, 直接略过; * <li>4. 遇到右括号, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap, 从表达式栈顶弹出一项. * * @param str */ private void interpertFormCell(String str) { // 表达式栈, 存储 R1, C1, R2, C2等合并单元格的表达式 Stack<String> stack = new Stack<String>(); // 表达式的元素 String atom = ""; // 遍历表达式, 解析子元素 for (int i = 0, length = str.length(); i < length; i++) { char ch = str.charAt(i); // 遇到左括号,将R2, C2 表达式压入表达式栈顶 if (LEFT_BRACKET == ch) { stack.push(atom); atom = ""; } // 遇到逗号, 如果栈不为空, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap; // 如果栈为空, 直接略过; else if (FC_SPLIT == ch) { if (ContainerUtil.isNotNull(stack)) formatCell(atom, stack); atom = ""; } // 遇到右括号, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap, 从表达式栈顶弹出一项 else if (RIGHT_BRACKET == ch) { if (StringUtils.isNotEmpty(atom)) formatCell(atom, stack); stack.pop(); atom = ""; } else { atom += ch; } } }
@Override public List<ProjectModuleBO> findModules(BOTemplate bot) { Element rootElement = getRootElement(); if (rootElement == null) return null; List<Element> moduleElements = getElmentsByXpath(getXPath_ModuleAll(), rootElement); if (ContainerUtil.isNull(moduleElements)) return null; List<ProjectModuleBO> modules = new LinkedList<ProjectModuleBO>(); for (Element element : moduleElements) { ProjectModuleBO module = convertElementToModule(element); if (bot == null || ContainerUtil.isNull(bot.getBotMap())) { modules.add(module); continue; } // 判断查询结果是否符合查询条件 boolean inQuery = true; // 模块名称 if (StringUtils.isNotEmpty((String) bot.getBotMap().get("moduleName"))) { if (!StringUtils.hasSubString( module.getModuleName(), bot.getBotMap().get("moduleName").toString())) { inQuery = false; } } // 开发人员 if (inQuery && StringUtils.isNotEmpty((String) bot.getBotMap().get("developers"))) { if (!StringUtils.hasSubString( module.getDevelopers(), bot.getBotMap().get("developers").toString())) { inQuery = false; } } // 模块ID if (inQuery && StringUtils.isNotEmpty((String) bot.getBotMap().get("id"))) { if (!StringUtils.isEqual(module.getId() + "", bot.getBotMap().get("id").toString())) { inQuery = false; } } if (inQuery) modules.add(module); } return modules; }
/** * 变量影响表单中的细粒度组件的值、状态 * * @param fcList * @param simpleContainer */ public static final void var2FC( Map<String, FinegrainedComponent> fcList, SimpleContainer simpleContainer) { Map<String, SimpleFC> simpleFCList = simpleContainer.getFcList(); if (ContainerUtil.isNull(simpleFCList) || ContainerUtil.isNull(fcList)) return; for (Entry<String, SimpleFC> entry : simpleFCList.entrySet()) { if (!fcList.containsKey(entry.getKey())) continue; BOProperty bop = fcList.get(entry.getKey()).getBc(); if (bop == null) continue; if (entry.getValue().isDisable() != null) bop.getStatus().setDisable(entry.getValue().isDisable()); if (entry.getValue().isHidden() != null) bop.getStatus().setHidden(entry.getValue().isHidden()); if (entry.getValue().isReadonly() != null) bop.getStatus().setReadonly(entry.getValue().isReadonly()); if (StringUtils.isNotEmpty(entry.getValue().getValueStr())) bop.setValue(entry.getValue().getValueStr()); } }