예제 #1
0
  protected DataList getDataList() throws BeansException {
    if (cacheDataList == null) {
      // get datalist
      ApplicationContext ac = AppUtil.getApplicationContext();
      AppService appService = (AppService) ac.getBean("appService");
      DataListService dataListService = (DataListService) ac.getBean("dataListService");
      DatalistDefinitionDao datalistDefinitionDao =
          (DatalistDefinitionDao) ac.getBean("datalistDefinitionDao");
      String id = getPropertyString("datalistId");
      AppDefinition appDef =
          appService.getAppDefinition(
              getRequestParameterString("appId"), getRequestParameterString("appVersion"));
      DatalistDefinition datalistDefinition = datalistDefinitionDao.loadById(id, appDef);

      if (datalistDefinition != null) {
        cacheDataList = dataListService.fromJson(datalistDefinition.getJson());

        if (getPropertyString(Userview.USERVIEW_KEY_NAME) != null
            && getPropertyString(Userview.USERVIEW_KEY_NAME).trim().length() > 0) {
          cacheDataList.addBinderProperty(
              Userview.USERVIEW_KEY_NAME, getPropertyString(Userview.USERVIEW_KEY_NAME));
        }
        if (getKey() != null && getKey().trim().length() > 0) {
          cacheDataList.addBinderProperty(Userview.USERVIEW_KEY_VALUE, getKey());
        }

        cacheDataList.setActionPosition(getPropertyString("buttonPosition"));
        cacheDataList.setSelectionType(getPropertyString("selectionType"));
        cacheDataList.setCheckboxPosition(getPropertyString("checkboxPosition"));
      }
    }
    return cacheDataList;
  }
예제 #2
0
  protected void storeToForm(WorkflowAssignment wfAssignment, Map properties, Map object) {
    String formDefId = (String) properties.get("formDefId");
    if (formDefId != null && formDefId.trim().length() > 0) {
      ApplicationContext ac = AppUtil.getApplicationContext();
      AppService appService = (AppService) ac.getBean("appService");
      AppDefinition appDef = (AppDefinition) properties.get("appDef");

      Object[] fieldMapping = (Object[]) properties.get("fieldMapping");
      String multirowBaseObjectName = (String) properties.get("multirowBaseObject");

      FormRowSet rowSet = new FormRowSet();

      if (multirowBaseObjectName != null && multirowBaseObjectName.trim().length() > 0) {
        Object[] baseObjectArray = (Object[]) getObjectFromMap(multirowBaseObjectName, object);
        if (baseObjectArray != null && baseObjectArray.length > 0) {
          rowSet.setMultiRow(true);
          for (int i = 0; i < baseObjectArray.length; i++) {
            rowSet.add(getRow(wfAssignment, multirowBaseObjectName, i, fieldMapping, object));
          }
        }
      } else {
        rowSet.add(getRow(wfAssignment, null, null, fieldMapping, object));
      }

      if (rowSet.size() > 0) {
        appService.storeFormData(
            appDef.getId(), appDef.getVersion().toString(), formDefId, rowSet, null);
      }
    }
  }
예제 #3
0
  protected void storeToWorkflowVariable(
      WorkflowAssignment wfAssignment, Map properties, Map object) {
    Object[] wfVariableMapping = (Object[]) properties.get("wfVariableMapping");
    if (wfVariableMapping != null && wfVariableMapping.length > 0) {
      ApplicationContext ac = AppUtil.getApplicationContext();
      WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");

      for (Object o : wfVariableMapping) {
        Map mapping = (HashMap) o;
        String variable = mapping.get("variable").toString();
        String jsonObjectName = mapping.get("jsonObjectName").toString();

        String value = (String) getObjectFromMap(jsonObjectName, object);

        if (value != null) {
          workflowManager.activityVariable(wfAssignment.getActivityId(), variable, value);
        }
      }
    }
  }
  public String getHtml() {
    Map<String, Object> data = new HashMap<String, Object>();
    data.put("params", userview.getParams());
    data.put("userview", userview);
    data.put("is_login_page", isLoginPage);
    if (isLoginPage) {
      data.put("login_form_footer", DirectoryUtil.getLoginFormFooter());

      if (request.getSession() != null) {
        Throwable exception =
            (Throwable) request.getSession().getAttribute("SPRING_SECURITY_LAST_EXCEPTION");
        if (exception != null) {
          data.put("login_exception", exception.getMessage());
        }
      }
      data.put("login_error_classes", "form-errors alert alert-warning");
    }
    data.put("context_path", request.getContextPath());
    data.put("build_number", ResourceBundleUtil.getMessage("build.number"));
    String rightToLeft = WorkflowUtil.getSystemSetupValue("rightToLeft");
    data.put("right_to_left", "true".equalsIgnoreCase(rightToLeft));
    String locale = AppUtil.getAppLocale();
    data.put("locale", locale);
    data.put("embed", "true".equalsIgnoreCase(userview.getParamString("embed")));
    data.put("body_id", getBodyId());
    data.put("body_classes", getBodyClasses(rightToLeft, locale));
    data.put("base_link", request.getContextPath() + getBaseLink());
    data.put("home_page_link", request.getContextPath() + getHomePageLink());
    data.put("title", getTitle());
    data.put("hide_nav", false);
    data.put("nav_id", "navigation");
    data.put("nav_classes", "nav-collapse sidebar-nav");
    data.put("categories_container_id", "category-container");
    data.put("categories_container_classes", "nav nav-tabs nav-stacked main-menu");
    data.put("category_classes", "category");
    data.put("first_category_classes", "first");
    data.put("last_category_classes", "last");
    data.put("current_category_classes", "current-category active");
    data.put("combine_single_menu_category", false);
    data.put("menus_container_classes", "menu-container");
    data.put("menu_classes", "menu");
    data.put("first_menu_classes", "first");
    data.put("last_menu_classes", "last");
    data.put("current_menu_classes", "current active");
    data.put("main_container_id", "main");
    data.put("sidebar_id", "sidebar");
    data.put("content_id", "content");

    String username = WorkflowUtil.getCurrentUsername();
    boolean isLoggedIn = username != null && !WorkflowUserManager.ROLE_ANONYMOUS.equals(username);
    data.put("is_logged_in", isLoggedIn);
    if (isLoggedIn) {
      ExtDirectoryManager directoryManager =
          (ExtDirectoryManager) AppUtil.getApplicationContext().getBean("directoryManager");
      User user = directoryManager.getUserByUsername(username);
      data.put("username", username);
      data.put("user", user);
      data.put("logout_link", request.getContextPath() + "/j_spring_security_logout");
    } else {
      data.put("login_link", request.getContextPath() + getLoginLink());
    }

    data.put("content", getContent(data));

    String handleMenuResponse = handleMenuResponse();
    if (handleMenuResponse != null) {
      return handleMenuResponse;
    }

    data.put("metas", getMetas(data));
    data.put("joget_header", getJogetHeader());
    data.put("js_css_lib", getJsCssLib(data));
    data.put("fav_icon_link", getFavIconLink(data));
    data.put("js", getJs(data));
    data.put("css", getCss(data));
    data.put("head", getHead(data));
    if (!"true".equalsIgnoreCase(userview.getParamString("embed"))) {
      data.put("header", getHeader(data));
      if (isAuthorized) {
        data.put("menus", getMenus(data));
      }
      data.put("footer", getFooter(data));
    }
    data.put("joget_footer", getJogetFooter());
    data.put("content_container", getContentContainer(data));

    return getLayout(data);
  }