Skip to content

Commit ae9ecd6

Browse files
committed
Deleted some loading files /WEB-INF/conf/webapp in master.xml (messages,authorizations,technical_user_menu,final_users_functionalities,actions,business_map,validation)
1 parent 3804f00 commit ae9ecd6

3 files changed

Lines changed: 45 additions & 110 deletions

File tree

knowage-core/src/main/java/it/eng/spagobi/commons/serializer/v3/MenuHelper.java

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@
2525
import org.apache.commons.lang3.StringUtils;
2626
import org.apache.log4j.Logger;
2727

28-
import it.eng.spago.base.SourceBean;
29-
import it.eng.spago.configuration.ConfigSingleton;
3028
import it.eng.spago.error.EMFUserError;
3129
import it.eng.spagobi.analiticalmodel.functionalitytree.bo.LowFunctionality;
3230
import it.eng.spagobi.commons.constants.CommunityFunctionalityConstants;
3331
import it.eng.spagobi.commons.dao.DAOFactory;
34-
import it.eng.spagobi.commons.utilities.GeneralUtilities;
3532
import it.eng.spagobi.wapp.bo.Menu;
3633

3734
/**
@@ -41,6 +38,9 @@ public class MenuHelper {
4138

4239
private static Logger logger = Logger.getLogger(MenuHelper.class);
4340

41+
private static final String urlDocumentUserBrowser = "/document-browser";
42+
private static final String urlWorkspaceManagement = "/workspace";
43+
4444
public static String findFunctionalityUrl(Menu menu, String contextPath) {
4545
logger.debug("IN");
4646
String url = null;
@@ -49,37 +49,31 @@ public static String findFunctionalityUrl(Menu menu, String contextPath) {
4949
if (functionality == null || functionality.trim().equals("")) {
5050
logger.error("Input menu is not associated to a SpagoBI functionality");
5151
} else {
52-
SourceBean config = (SourceBean) ConfigSingleton.getInstance().getFilteredSourceBeanAttribute("FINAL_USER_FUNCTIONALITIES.APPLICATION",
53-
"functionality", functionality);
54-
if (config != null) {
55-
url = (String) config.getAttribute("link");
56-
url = url.replaceAll("\\$\\{SPAGOBI_CONTEXT\\}", contextPath);
57-
url = url.replaceAll("\\$\\{SPAGO_ADAPTER_HTTP\\}", GeneralUtilities.getSpagoAdapterHttpUrl());
58-
if (functionality.equals(CommunityFunctionalityConstants.DOCUMENT_BROWSER_USER)) {
59-
String initialPath = menu.getInitialPath();
60-
if (initialPath != null && !initialPath.trim().equals("")) {
61-
// url += "&" + BIObjectsModule.MODALITY + "=" + BIObjectsModule.FILTER_TREE + "&" + TreeObjectsModule.PATH_SUBTREE + "="
62-
// + initialPath;
63-
64-
String idsPath = convertPathInIds(initialPath);
52+
53+
if (functionality.equals(CommunityFunctionalityConstants.DOCUMENT_BROWSER_USER)) {
54+
url = urlDocumentUserBrowser;
55+
String initialPath = menu.getInitialPath();
56+
if (initialPath != null && !initialPath.trim().equals("")) {
57+
// url += "&" + BIObjectsModule.MODALITY + "=" + BIObjectsModule.FILTER_TREE + "&" + TreeObjectsModule.PATH_SUBTREE + "="
58+
// + initialPath;
59+
60+
String idsPath = convertPathInIds(initialPath);
6561
// url += "&" + BIObjectsModule.MODALITY + "=" + BIObjectsModule.FILTER_TREE + "&" + TreeObjectsModule.PATH_SUBTREE + "=" + initialPath
6662
// + idsPath;
67-
url = String.format("%s/%s", url, idsPath);
68-
}
69-
} else if (functionality.equals(CommunityFunctionalityConstants.WORKSPACE_MANAGEMENT)) {
70-
String initialPath = menu.getInitialPath();
71-
if (initialPath != null && initialPath.equals("documents")) {
72-
url += "/recent";
73-
} else if (initialPath != null && initialPath.equals("datasets")) {
74-
url += "/data";
75-
} else if (initialPath != null && initialPath.equals("models")) {
76-
url += "/models";
77-
}
63+
url = String.format("%s/%s", url, idsPath);
64+
}
65+
} else if (functionality.equals(CommunityFunctionalityConstants.WORKSPACE_MANAGEMENT)) {
66+
url = urlWorkspaceManagement;
67+
String initialPath = menu.getInitialPath();
68+
if (initialPath != null && initialPath.equals("documents")) {
69+
url += "/recent";
70+
} else if (initialPath != null && initialPath.equals("datasets")) {
71+
url += "/data";
72+
} else if (initialPath != null && initialPath.equals("models")) {
73+
url += "/models";
7874
}
79-
80-
} else {
81-
logger.warn("No configuration found for SpagoBI functionality [" + menu.getFunctionality() + "]");
8275
}
76+
8377
}
8478
} catch (Exception e) {
8579
logger.error(e);

knowage-core/src/main/java/it/eng/spagobi/wapp/util/MenuUtilities.java

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.apache.log4j.Logger;
3030

3131
import it.eng.spago.base.SourceBean;
32-
import it.eng.spago.configuration.ConfigSingleton;
3332
import it.eng.spago.error.EMFErrorSeverity;
3433
import it.eng.spago.error.EMFInternalError;
3534
import it.eng.spago.error.EMFUserError;
@@ -38,7 +37,6 @@
3837
import it.eng.spagobi.commons.bo.UserProfile;
3938
import it.eng.spagobi.commons.constants.AdmintoolsConstants;
4039
import it.eng.spagobi.commons.dao.DAOFactory;
41-
import it.eng.spagobi.commons.utilities.UserUtilities;
4240
import it.eng.spagobi.commons.utilities.messages.MessageBuilder;
4341
import it.eng.spagobi.wapp.bo.Menu;
4442

@@ -77,8 +75,9 @@ public static String getMenuPath(List filteredMenuList, Menu menu, Locale locale
7775
break;
7876
}
7977
}
80-
if (parent == null)
78+
if (parent == null) {
8179
parent = DAOFactory.getMenuDAO().loadMenuByID(menu.getParentId());
80+
}
8281
// can happen that parent is not found
8382
if (parent == null) {
8483
if (menu.getName().startsWith("#")) {
@@ -101,7 +100,7 @@ public static String getMenuPath(List filteredMenuList, Menu menu, Locale locale
101100
public static void checkAndSetNotClickableMenus(Menu menu, IEngUserProfile userProfile) {
102101
if (menu.getObjId() != null) {
103102
boolean clickable = MenuAccessVerifier.checkClickable(menu, userProfile);
104-
if (clickable == false) {
103+
if (!clickable) {
105104
menu.setClickable(false);
106105
}
107106
}
@@ -119,10 +118,12 @@ public static List filterListForUser(List menuList, IEngUserProfile userProfile)
119118
for (int i = 0; i < menuList.size(); i++) {
120119
Menu menuElem = (Menu) menuList.get(i);
121120
boolean canView = false;
122-
if (menuElem.getCode() == null)
121+
if (menuElem.getCode() == null) {
123122
canView = MenuAccessVerifier.canView(menuElem, userProfile);
124-
else
123+
}
124+
else {
125125
canView = true; // technical menu voice is ever visible if
126+
}
126127
// it's present
127128
if (canView) {
128129
filteredMenuList.add(menuElem);
@@ -147,71 +148,6 @@ public static void filterListForUserClickableElements(List menuList, IEngUserPro
147148
}
148149
}
149150

150-
151-
152-
/**
153-
* Gets the elements of menu relative by the user logged. It reaches the role from the request and asks to the DB all detail menu information, by calling
154-
* the method <code>loadMenuByRoleId</code>.
155-
*
156-
* @param request The request Source Bean
157-
* @param response The response Source Bean
158-
* @throws EMFUserError If an exception occurs
159-
*/
160-
public static void getMenuItems(SourceBean request, SourceBean response, IEngUserProfile profile) throws EMFUserError {
161-
try {
162-
List lstFinalMenu = new ArrayList();
163-
boolean technicalMenuLoaded = false;
164-
165-
Collection lstRolesForUser = ((UserProfile) profile).getRolesForUse();
166-
logger.debug("** Roles for user: " + lstRolesForUser.size());
167-
168-
Object[] arrRoles = lstRolesForUser.toArray();
169-
Integer levelItem = 1;
170-
for (int i = 0; i < arrRoles.length; i++) {
171-
logger.debug("*** arrRoles[i]): " + arrRoles[i]);
172-
Role role = DAOFactory.getRoleDAO().loadByName((String) arrRoles[i]);
173-
if (role != null) {
174-
175-
List menuItemsForARole = DAOFactory.getMenuRolesDAO().loadMenuByRoleId(role.getId());
176-
if (menuItemsForARole != null) {
177-
mergeMenuItems(lstFinalMenu, menuItemsForARole);
178-
} else {
179-
logger.debug("Not found menu items for user role " + (String) arrRoles[i]);
180-
}
181-
182-
if (!technicalMenuLoaded && UserUtilities.isTechnicalUser(profile)) {
183-
// list technical user menu
184-
technicalMenuLoaded = true;
185-
List firstLevelItems = ConfigSingleton.getInstance().getAttributeAsList("TECHNICAL_USER_MENU.ITEM");
186-
Iterator it = firstLevelItems.iterator();
187-
while (it.hasNext()) {
188-
SourceBean itemSB = (SourceBean) it.next();
189-
if (isAbleToSeeItem(itemSB, profile)) {
190-
191-
lstFinalMenu.add(getAdminItemRec(itemSB, levelItem, profile, null));
192-
levelItem++;
193-
}
194-
}
195-
}
196-
} else
197-
logger.debug("Role " + (String) arrRoles[i] + " not found on db");
198-
}
199-
response.setAttribute(LIST_MENU, lstFinalMenu);
200-
201-
logger.debug("List Menu Size " + lstFinalMenu.size());
202-
// String menuMode =
203-
// (configSingleton.getAttribute("SPAGOBI.MENU.mode")==null)?DEFAULT_LAYOUT_MODE:(String)configSingleton.getAttribute("SPAGOBI.MENU.mode");
204-
// response.setAttribute(MENU_MODE, menuMode);
205-
response.setAttribute(MENU_MODE, DEFAULT_LAYOUT_MODE);
206-
207-
} catch (Exception ex) {
208-
logger.error("Cannot fill response container" + ex.getLocalizedMessage());
209-
HashMap params = new HashMap();
210-
params.put(AdmintoolsConstants.PAGE, MODULE_PAGE);
211-
throw new EMFUserError(EMFErrorSeverity.ERROR, 500, new Vector(), params);
212-
}
213-
}
214-
215151
/**
216152
* Gets the elements of menu relative by the user logged. It reaches the role from the request and asks to the DB all detail menu information, by calling
217153
* the method <code>loadMenuByRoleId</code>.
@@ -261,8 +197,9 @@ public static List getMenuItems(IEngUserProfile profile, boolean menuRolesDaoReq
261197
// }
262198
// }
263199
// }
264-
} else
265-
logger.debug("Role " + (String) arrRole + " not found on db");
200+
} else {
201+
logger.debug("Role " + (String) arrRole + " not found on db");
202+
}
266203
}
267204

268205
logger.debug("List Menu Size " + lstFinalMenu.size());
@@ -321,8 +258,9 @@ private static boolean isAbleToSeeItem(SourceBean itemSB, IEngUserProfile profil
321258
*/
322259
private static boolean isAbleToSeeContainedItems(SourceBean itemSB, IEngUserProfile profile) throws EMFInternalError {
323260
List subItems = itemSB.getAttributeAsList("ITEM");
324-
if (subItems == null || subItems.isEmpty())
261+
if (subItems == null || subItems.isEmpty()) {
325262
return false;
263+
}
326264
Iterator it = subItems.iterator();
327265
while (it.hasNext()) {
328266
SourceBean subItem = (SourceBean) it.next();
@@ -370,16 +308,17 @@ private static Menu getAdminItemRec(SourceBean itemSB, Integer progStart, IEngUs
370308
node.setAdminsMenu(true);
371309
node.setIconCls(iconCls);
372310
node.setLinkType(linkType);
373-
if (groupingMenu != null)
311+
if (groupingMenu != null) {
374312
node.setGroupingMenu(groupingMenu);
313+
}
375314

376315
if (functionality == null) {
377316
// father node
378317
List subItems = itemSB.getAttributeAsList("ITEM");
379318
Iterator it = subItems.iterator();
380-
if (subItems == null || subItems.isEmpty())
319+
if (subItems == null || subItems.isEmpty()) {
381320
node.setHasChildren(false);
382-
else {
321+
} else {
383322
node.setHasChildren(true);
384323
List lstChildren = new ArrayList();
385324
while (it.hasNext()) {
@@ -412,8 +351,9 @@ private static Menu getAdminItemRec(SourceBean itemSB, Integer progStart, IEngUs
412351
* @return the index of the input menu item or -1 if it is not found in the list
413352
*/
414353
public static int indexOf(List lst, Menu menu) {
415-
if (lst == null)
354+
if (lst == null) {
416355
return -1;
356+
}
417357
for (int i = 0; i < lst.size(); i++) {
418358
Menu tmpMenu = (Menu) lst.get(i);
419359
if (tmpMenu.getMenuId().intValue() == menu.getMenuId().intValue()) {

knowage/src/main/webapp/WEB-INF/conf/master.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,19 @@
218218
-->
219219

220220
<!-- webapp -->
221-
222-
<CONFIGURATOR path="/WEB-INF/conf/webapp/messages.xml" />
223221
<CONFIGURATOR path="/WEB-INF/conf/webapp/modules.xml" />
224222
<CONFIGURATOR path="/WEB-INF/conf/webapp/pages.xml" />
225223
<CONFIGURATOR path="/WEB-INF/conf/webapp/presentation.xml" />
226224
<CONFIGURATOR path="/WEB-INF/conf/webapp/publishers.xml" />
225+
<!--
226+
<CONFIGURATOR path="/WEB-INF/conf/webapp/messages.xml" />
227227
<CONFIGURATOR path="/WEB-INF/conf/webapp/authorizations.xml" />
228228
<CONFIGURATOR path="/WEB-INF/conf/webapp/technical_user_menu.xml" />
229229
<CONFIGURATOR path="/WEB-INF/conf/webapp/final_users_functionalities.xml" />
230230
<CONFIGURATOR path="/WEB-INF/conf/webapp/actions.xml" />
231231
<CONFIGURATOR path="/WEB-INF/conf/webapp/business_map.xml" />
232232
<CONFIGURATOR path="/WEB-INF/conf/webapp/validation.xml" />
233+
-->
233234
<!--
234235
<CONFIGURATOR path="/WEB-INF/conf/webapp/static_menu.xml" />
235236
-->

0 commit comments

Comments
 (0)