Example #1
0
  @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;
  }
Example #2
0
  /**
   * 变量影响表单中的控制组件状态
   *
   * @param btnList
   * @param simpleContainer
   * @param vcId
   * @param bcId
   */
  public static final void var2Btn(
      Map<String, CommandButton> btnList,
      SimpleContainer simpleContainer,
      String vcId,
      String bcId) {
    Map<String, SimpleBtn> simpleBtnList = simpleContainer.getBtnList();
    if (ContainerUtil.isNull(simpleBtnList) || ContainerUtil.isNull(btnList)) return;

    for (Entry<String, SimpleBtn> entry : simpleBtnList.entrySet()) {
      String btnName = VCUtil.createOperateName(vcId, bcId, entry.getKey());
      if (!btnList.containsKey(btnName)) continue;
      OperateBOP bop = btnList.get(btnName).getBc();
      if (bop == null) continue;

      bop.getStatus().setDisable(entry.getValue().isDisable());
      bop.getStatus().setHidden(entry.getValue().isHidden());
      bop.getStatus().setReadonly(entry.getValue().isReadonly());
    }
  }
Example #3
0
  /**
   * 变量影响表单中的细粒度组件的值、状态
   *
   * @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());
    }
  }
Example #4
0
  @SuppressWarnings("unchecked")
  @Override
  public DemoMobileBaseBO find(String comparateId, Class<? extends DemoMobileBaseBO> calsz)
      throws Exception {
    QewebDetachedCriteria detachedCriteria =
        (QewebDetachedCriteria) QewebDetachedCriteria.forClass(calsz);
    detachedCriteria.add(Restrictions.eq("comparateId", comparateId));

    List<DemoMobileBaseBO> result = findByCriteria(detachedCriteria);

    return ContainerUtil.isNull(result) ? calsz.newInstance() : result.get(0);
  }
Example #5
0
  @SuppressWarnings("unchecked")
  @Override
  public DemoMobileBaseBO findSaveInfo(
      long shopId, long vistorId, Class<? extends DemoMobileBaseBO> calsz) throws Exception {
    QewebDetachedCriteria detachedCriteria =
        (QewebDetachedCriteria) QewebDetachedCriteria.forClass(calsz);
    detachedCriteria.add(Restrictions.eq("submitFlag", StringUtils.convertToInt(SubmitBOP.NO)));
    detachedCriteria.add(Restrictions.eq(IBaseDao.FIELD_DELETEFLAG, IBaseDao.UNDELETE_SIGNE));
    detachedCriteria.add(Restrictions.eq("shopBO.id", shopId));
    detachedCriteria.add(Restrictions.eq("visitor.id", vistorId));

    List<DemoMobileBaseBO> result = findByCriteria(detachedCriteria);

    return ContainerUtil.isNull(result) ? calsz.newInstance() : result.get(0);
  }
Example #6
0
  @SuppressWarnings("unchecked")
  @Override
  public void update(ProjectModuleBO module) {
    Element rootElement = getRootElement();
    if (rootElement == null) return;

    List<Element> elements = getElmentsByXpath(getXPath_ModuleId(module.getId()), rootElement);
    if (ContainerUtil.isNull(elements)) return;

    // 修改moduleElement节点
    Element moduleElement = elements.get(0);
    moduleElement.setAttribute(ATTR_NAME, module.getModuleName());
    moduleElement.setAttribute(ATTR_REMARK, module.getRemark());

    // 修改developers节点
    Element developElement = moduleElement.getChild(NODE_DEV);
    developElement.setAttribute(ATTR_ID, module.getDevelopers());

    // 修改package节点
    Element packageElement = moduleElement.getChild(NODE_PACKAGE);
    List<Element> childElements = packageElement.getChildren();
    for (Element packElement : childElements) {
      if (StringUtils.isEqual(NODE_SRC, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getSrcPackage());
      else if (StringUtils.isEqual(NODE_JSP, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getJspPackage());
      else if (StringUtils.isEqual(NODE_HBM, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getHbmPackage());
      else if (StringUtils.isEqual(NODE_SPRING, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getSpringPackage());
      else if (StringUtils.isEqual(NODE_PAGEFLOW, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getPageflowPackage());
      else if (StringUtils.isEqual(NODE_VAR, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getVarPackage());
      else if (StringUtils.isEqual(NODE_I18N, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getI18nPackage());
    }

    saveXML(rootElement);
  }