![JAR search and dependency download from the Maven repository](/logo.png)
it.eng.spago.security.xmlauthorizations.XMLAuthorizationsBusinessMapper Maven / Gradle / Ivy
/**
Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A.
This file is part of Spago.
Spago is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
any later version.
Spago is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Spago; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
package it.eng.spago.security.xmlauthorizations;
import it.eng.spago.base.Constants;
import it.eng.spago.base.SourceBean;
import it.eng.spago.configuration.ConfigSingleton;
import it.eng.spago.tracing.TracerSingleton;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
/**
* DATE CONTRIBUTOR/DEVELOPER NOTE
* 13-12-2004 Butano SOurceBean restituisce ArrayList
*
**/
/**
* @author zoppello
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class XMLAuthorizationsBusinessMapper {
private static XMLAuthorizationsBusinessMapper _instance = null;
private HashMap _mapActions = null;
private HashMap _mapPages = null;
private HashMap _mapPagesModules = null;
public XMLAuthorizationsBusinessMapper() {
SourceBean mapSourceBean = (SourceBean)ConfigSingleton.getInstance().getAttribute("BUSINESS_MAP");
_mapActions = new HashMap();
List actions = mapSourceBean.getAttributeAsList("MAP_ACTIONS.MAP_ACTION");
Iterator it = actions.iterator();
while (it.hasNext()) {
SourceBean mapAction = (SourceBean)it.next();
String actionName = (String)mapAction.getAttribute("actionName");
String businessProcessName = (String)mapAction.getAttribute("businessProcess");
String actStr = "ACTION[" + actionName + "]";
_mapActions.put(actStr.toUpperCase(), businessProcessName);
} // while (it.hasNext())
_mapPages = new HashMap();
_mapPagesModules = new HashMap();
List pageModules = mapSourceBean.getAttributeAsList("MAP_PAGE_MODULES.MAP_PAGE_MODULE");
it = pageModules.iterator();
while (it.hasNext()) {
SourceBean mapPageModule = (SourceBean)it.next();
String pageName = (String)mapPageModule.getAttribute("pageName");
String moduleName = (String)mapPageModule.getAttribute("moduleName");
String businessProcessName = (String)mapPageModule.getAttribute("businessProcess");
if (moduleName == null) {
String pgStr = "PAGE[" + pageName + "]";
_mapPages.put(pgStr.toUpperCase(), businessProcessName);
} // if (moduleName == null)
else {
String pgMdlStr = "PAGE[" + pageName + "]MODULE[" + moduleName + "]";
_mapPagesModules.put(pgMdlStr.toUpperCase(), businessProcessName);
} // if (moduleName == null) else
} // while (it.hasNext())
} // public XMLAuthorizationsBusinessMapper()
public static XMLAuthorizationsBusinessMapper getInstance() {
if (_instance == null) {
synchronized(XMLAuthorizationsBusinessMapper.class) {
if (_instance == null) {
try {
_instance = new XMLAuthorizationsBusinessMapper();
} // try
catch (Exception ex) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.CRITICAL,
"XMLAuthorizationsBusinessMapper::getInstance: ", ex);
} // catch(Exception ex) try
} // if (_instance == null)
} // synchronized(ConfigSingleton.class)
} // if (_instance == null)
return _instance;
} // public static ConfigSingleton getInstance()
public String mapActionToBusinessProcess(String actionName) {
String actStr = "ACTION[" + actionName + "]";
String businessProcessName = (String)_mapActions.get(actStr.toUpperCase());
if (businessProcessName == null) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
"XMLAuthorizationsBusinessMapper::mapPageModuleToBusinessProcess: mapping per action [" +
actionName + "] non trovato");
} // if (businessProcessName == null)
return businessProcessName;
} // public String mapActionToBusinessProcess(String actionName)
public String mapPageModuleToBusinessProcess(String pageName, String moduleName) {
String pgMdlStr = "PAGE[" + pageName + "]MODULE[" + moduleName + "]";
String businessProcessName = (String)_mapPagesModules.get(pgMdlStr.toUpperCase());
if (businessProcessName == null) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
"XMLAuthorizationsBusinessMapper::mapPageModuleToBusinessProcess: mapping per page [" + pageName +
"] e module [" + moduleName + "] non trovato");
String pgStr = "PAGE[" + pageName + "]";
businessProcessName = (String)_mapPages.get(pgStr.toUpperCase());
if (businessProcessName == null) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
"XMLAuthorizationsBusinessMapper::mapPageModuleToBusinessProcess: mapping per page [" +
pageName + "] non trovato");
} // if (businessProcessName == null)
} // if (businessProcessName == null)
return businessProcessName;
} // public String mapPageModuleToBusinessProcess(String pageName, String moduleName)
} // public class XMLAuthorizationsBusinessMapper
© 2015 - 2025 Weber Informatics LLC | Privacy Policy