} catch (Exception e) {
LogUtil.debug(getClass().getName(), "set theme error.");
}
try {
JSONObject permissionObj = settingObj.getJSONObject("properties").getJSONObject("permission");
UserviewPermission permission = null;
String permissionClassName = permissionObj.getString("className");
if (permissionClassName != null && !permissionClassName.isEmpty()) {
permission = (UserviewPermission) pluginManager.getPlugin(permissionClassName);
}
if (permission != null) {
permission.setProperties(PropertyUtil.getPropertiesValueFromJson(permissionObj.getJSONObject("properties").toString()));
permission.setRequestParameters(requestParameters);
permission.setCurrentUser(currentUser);
setting.setPermission(permission);
}
} catch (Exception e) {
LogUtil.debug(getClass().getName(), "set permission error.");
}
userview.setSetting(setting);
//set categories
JSONArray categoriesArray = userviewObj.getJSONArray("categories");
Collection<UserviewCategory> categories = new ArrayList<UserviewCategory>();
for (int i = 0; i < categoriesArray.length(); i++) {
JSONObject categoryObj = (JSONObject) categoriesArray.get(i);
UserviewCategory category = new UserviewCategory();
category.setProperties(PropertyUtil.getPropertiesValueFromJson(categoryObj.getJSONObject("properties").toString()));
boolean hasPermis = false;
if (preview) {
hasPermis = true;
} else {
//check for permission
JSONObject permissionObj = null;
UserviewPermission permission = null;
try {
permissionObj = categoryObj.getJSONObject("properties").getJSONObject("permission");
String permissionClassName = permissionObj.getString("className");
if (permissionClassName != null && !permissionClassName.isEmpty()) {
permission = (UserviewPermission) pluginManager.getPlugin(permissionClassName);
}
} catch (Exception e) {
LogUtil.debug(getClass().getName(), "set category permission error.");
}
if (permission != null) {
permission.setProperties(PropertyUtil.getPropertiesValueFromJson(permissionObj.getJSONObject("properties").toString()));
permission.setRequestParameters(requestParameters);
permission.setCurrentUser(currentUser);
hasPermis = permission.isAuthorize();
} else {
hasPermis = true;
}
}