Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
/**
 * 获取用户界面插件配置项属性值
 * @param request
 * @param userviewId
 * @return
 */
public Map<String, Object> getUserviewPropertiesByUserviewId(HttpServletRequest request,String userviewId) {
    AppDefinition appDef=AppUtil.getCurrentAppDefinition();
    UserviewService userviewService = (UserviewService)AppUtil.getApplicationContext().getBean("userviewService");
    UserviewDefinitionDao userviewDefinitionDao = (UserviewDefinitionDao)AppUtil.getApplicationContext().getBean("userviewDefinitionDao");
    UserviewDefinition userviewDef = userviewDefinitionDao.loadById(userviewId, appDef);
    if (userviewDef != null) {
        String json = userviewDef.getJson();
        UserviewMap<String, userviewObject> properties = userviewService.createUserview(appDef,json, null, false, request.getContextPath(), request.getParameterMap(), null, false);

  new HashMap<>();
        try {
     Map<String, Object> properties      JSONObject userviewObj = new HashMap<>JSONObject(json);
        Collection<UserviewCategory> categories   JSONArray categoriesArray = userviewuserviewObj.getCategoriesgetJSONArray("categories");
            for (UserviewCategoryint categoryi : categories) = 0; i < categoriesArray.length(); ++i) {
            Collection<UserviewMenu> menus   JSONObject categoryObj = category.getMenus((JSONObject)categoriesArray.get(i);
            for (UserviewMenu menu : menus)  JSONArray menusArray = categoryObj.getJSONArray("menus");
                for(int j = 0; j < menusArray.length(); ++j) {
                // 如果Class Name 匹配,那么取得当前Class 的配置项JSONObject menuObj = (JSONObject)menusArray.get(j);
                    if (menumenuObj.getClassNamegetString("className").equalsIgnoreCase(getClassName())){
                        properties = menuPropertyUtil.getProperties(menuObj.getJSONObject("properties"));
                    }
                }
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        for (String s : properties.keySet()) {
            LogUtil.info("key: "+s, "val:"+properties.get(s));
        }
        // 放置到抽象类中,后续可以直接使用 getProperty 获取
        setProperties(properties);
        return properties;
    }
    return null;
}

...