Commit c6a03314 authored by Alessandro Portosa's avatar Alessandro Portosa
Browse files

moved package it/eng/spago in each webapp and remove it from utils

parent 3e474a9c
package it.eng.spagobi.analiticalmodel.document.handlers;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
import it.eng.LightNavigationConstants;
import it.eng.spago.error.EMFErrorSeverity;
import it.eng.spago.error.EMFUserError;
import it.eng.spago.navigation.LightNavigationManager;
import it.eng.spago.security.IEngUserProfile;
import it.eng.spago.validation.EMFValidationError;
import it.eng.spagobi.analiticalmodel.document.bo.BIObject;
......@@ -39,26 +59,6 @@ import it.eng.spagobi.utilities.exceptions.SpagoBIRuntimeException;
import it.eng.spagobi.utilities.exceptions.SpagoBIServiceException;
import it.eng.spagobi.utilities.objects.Couple;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
public class DocumentUrlManager {
static private Logger logger = Logger.getLogger(DocumentUrlManager.class);
......@@ -157,7 +157,7 @@ public class DocumentUrlManager {
// identity string for context
UUIDGenerator uuidGen = UUIDGenerator.getInstance();
UUID uuid = uuidGen.generateRandomBasedUUID();
buffer.append("&" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + uuid.toString());
buffer.append("&" + LightNavigationConstants.LIGHT_NAVIGATOR_ID + "=" + uuid.toString());
List parameters = obj.getBiObjectParameters();
if (parameters != null && parameters.size() > 0) {
Iterator it = parameters.iterator();
......@@ -218,8 +218,8 @@ public class DocumentUrlManager {
List errorsOnChecks = getValidationErrorsOnChecks(biparam);
List values = biparam.getParameterValues();
if (biparam.isRequired() && (values == null || values.isEmpty() || normalizeList(values).size() == 0)) {
EMFValidationError error = SpagoBIValidationImpl.validateField(biparam.getParameterUrlName(), biparam.getLabel(), null, "MANDATORY", null,
null, null);
EMFValidationError error = SpagoBIValidationImpl.validateField(biparam.getParameterUrlName(), biparam.getLabel(), null, "MANDATORY", null, null,
null);
errorsOnChecks.add(error);
}
if (errorsOnChecks != null && errorsOnChecks.size() > 0) {
......
......@@ -17,6 +17,31 @@
*/
package it.eng.spagobi.analiticalmodel.document.handlers;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
import it.eng.LightNavigationConstants;
import it.eng.spago.base.SourceBean;
import it.eng.spago.error.EMFErrorSeverity;
import it.eng.spago.error.EMFInternalError;
......@@ -64,30 +89,6 @@ import it.eng.spagobi.utilities.exceptions.SpagoBIRuntimeException;
import it.eng.spagobi.utilities.exceptions.SpagoBIServiceException;
import it.eng.spagobi.utilities.objects.Couple;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
/**
* This class represents a document execution instance. This contains the following attributes: 1. execution flow id: it is the id of an execution flow
* (execution in cross navigation mode share the same flow id) 2. execution id: single execution id, it is unique for a single execution 3. the BIObject being
......@@ -127,8 +128,8 @@ public class ExecutionInstance implements Serializable {
* the execution role
* @throws Exception
*/
public ExecutionInstance(IEngUserProfile userProfile, String flowId, String executionId, Integer biobjectId, String executionRole,
String executionModality, Locale locale) throws Exception {
public ExecutionInstance(IEngUserProfile userProfile, String flowId, String executionId, Integer biobjectId, String executionRole, String executionModality,
Locale locale) throws Exception {
logger.debug("IN: input parameters: userProfile = [" + userProfile + "]; flowId = [" + flowId + "]; executionId = [" + executionId + "]; "
+ "biobjectId" + biobjectId + "]; executionRole = [" + executionRole + "]");
......@@ -147,14 +148,14 @@ public class ExecutionInstance implements Serializable {
initBIParameters();
}
public ExecutionInstance(IEngUserProfile userProfile, String flowId, String executionId, Integer biobjectId, String executionRole,
String executionModality, boolean displayToolbar, Locale locale) throws Exception {
public ExecutionInstance(IEngUserProfile userProfile, String flowId, String executionId, Integer biobjectId, String executionRole, String executionModality,
boolean displayToolbar, Locale locale) throws Exception {
this(userProfile, flowId, executionId, biobjectId, executionRole, executionModality, locale);
this.displayToolbar = displayToolbar;
}
public ExecutionInstance(IEngUserProfile userProfile, String flowId, String executionId, Integer biobjectId, String executionRole,
String executionModality, boolean displayToolbar, boolean displaySliders, Locale locale) throws Exception {
public ExecutionInstance(IEngUserProfile userProfile, String flowId, String executionId, Integer biobjectId, String executionRole, String executionModality,
boolean displayToolbar, boolean displaySliders, Locale locale) throws Exception {
this(userProfile, flowId, executionId, biobjectId, executionRole, executionModality, displayToolbar, locale);
this.displaySliders = displaySliders;
}
......@@ -603,9 +604,10 @@ public class ExecutionInstance implements Serializable {
logger.debug("OUT");
}
public List getParametersErrors() throws Exception{
public List getParametersErrors() throws Exception {
return getParametersErrors(false);
}
/**
* Checks if is single value.
*
......@@ -641,8 +643,8 @@ public class ExecutionInstance implements Serializable {
List values = biparam.getParameterValues();
if ((!onEditMode && biparam.isRequired()) && (values == null || values.isEmpty() || normalizeList(values).size() == 0)) {
EMFValidationError error = SpagoBIValidationImpl.validateField(biparam.getParameterUrlName(), biparam.getLabel(), null, "MANDATORY", null,
null, null);
EMFValidationError error = SpagoBIValidationImpl.validateField(biparam.getParameterUrlName(), biparam.getLabel(), null, "MANDATORY", null, null,
null);
errorsOnChecks.add(error);
}
......@@ -1280,7 +1282,7 @@ public class ExecutionInstance implements Serializable {
// identity string for context
UUIDGenerator uuidGen = UUIDGenerator.getInstance();
UUID uuid = uuidGen.generateRandomBasedUUID();
buffer.append("&" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + uuid.toString());
buffer.append("&" + LightNavigationConstants.LIGHT_NAVIGATOR_ID + "=" + uuid.toString());
List parameters = object.getBiObjectParameters();
if (parameters != null && parameters.size() > 0) {
......
/*
* Knowage, Open Source Business Intelligence suite
* Copyright (C) 2016 Engineering Ingegneria Informatica S.p.A.
*
*
* Knowage is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
......@@ -11,16 +11,12 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.eng.spagobi.commons.utilities.urls;
import it.eng.spago.configuration.ConfigSingleton;
import it.eng.spago.navigation.LightNavigationManager;
import it.eng.spagobi.commons.utilities.GeneralUtilities;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
......@@ -29,6 +25,10 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import it.eng.LightNavigationConstants;
import it.eng.spago.configuration.ConfigSingleton;
import it.eng.spagobi.commons.utilities.GeneralUtilities;
/**
* The implementation of IUrlBuilder used when SpagoBI is used as a STANDALONE WEB APPLICATION
*/
......@@ -41,7 +41,7 @@ public class WebUrlBuilder implements IUrlBuilder {
/**
* Inits the.
*
*
* @param aHttpServletRequest
* the a http servlet request
*/
......@@ -55,7 +55,7 @@ public class WebUrlBuilder implements IUrlBuilder {
/*
* (non-Javadoc)
*
*
* @see it.eng.spagobi.commons.utilities.urls.IUrlBuilder#getUrl(javax.servlet.http.HttpServletRequest, java.util.Map)
*/
@Override
......@@ -87,12 +87,12 @@ public class WebUrlBuilder implements IUrlBuilder {
}
}
// propagating light navigator id
String lightNavigatorId = aHttpServletRequest.getParameter(LightNavigationManager.LIGHT_NAVIGATOR_ID);
String lightNavigatorId = aHttpServletRequest.getParameter(LightNavigationConstants.LIGHT_NAVIGATOR_ID);
if (lightNavigatorId != null && !lightNavigatorId.trim().equals("")) {
if (sb.indexOf("?") != -1) {
sb.append("&" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + lightNavigatorId);
sb.append("&" + LightNavigationConstants.LIGHT_NAVIGATOR_ID + "=" + lightNavigatorId);
} else {
sb.append("?" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + lightNavigatorId);
sb.append("?" + LightNavigationConstants.LIGHT_NAVIGATOR_ID + "=" + lightNavigatorId);
}
}
String url = sb.toString();
......@@ -103,7 +103,7 @@ public class WebUrlBuilder implements IUrlBuilder {
/*
* (non-Javadoc)
*
*
* @see it.eng.spagobi.commons.utilities.urls.IUrlBuilder#getResourceLink(javax.servlet.http.HttpServletRequest, java.lang.String)
*/
@Override
......
......@@ -17,11 +17,26 @@
*/
package it.eng.spagobi.engines.documentcomposition.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.log4j.Logger;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
import it.eng.LightNavigationConstants;
import it.eng.spago.base.SessionContainer;
import it.eng.spago.base.SourceBean;
import it.eng.spago.error.EMFErrorSeverity;
import it.eng.spago.error.EMFUserError;
import it.eng.spago.navigation.LightNavigationManager;
import it.eng.spago.security.IEngUserProfile;
import it.eng.spagobi.analiticalmodel.document.bo.BIObject;
import it.eng.spagobi.analiticalmodel.document.bo.Snapshot;
......@@ -47,21 +62,6 @@ import it.eng.spagobi.engines.documentcomposition.configuration.DocumentComposit
import it.eng.spagobi.engines.drivers.IEngineDriver;
import it.eng.spagobi.monitoring.dao.AuditManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.log4j.Logger;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
/**
* @author Antonella Giachino (antonella.giachino@eng.it) Utility Class for document composition
*/
......@@ -124,11 +124,11 @@ public class DocumentCompositionUtils {
* DAOFactory.getDomainDAO().loadDomainById(engine.getBiobjTypeId()); } catch (EMFUserError error) {
* logger.error("Error retrieving document's engine information", error); return "1009|"; } catch (Exception error) {
* logger.error("Error retrieving document's engine information", error); return "1009|"; }
*
*
* String compatibleBiobjTypeCd = compatibleBiobjType.getValueCd(); String biobjTypeCd = obj.getBiObjectTypeCode();
*
*
* // CHECK IF THE BIOBJECT IS COMPATIBLE WITH THE TYPES SUITABLE FOR THE ENGINE
*
*
* if (!compatibleBiobjTypeCd.equalsIgnoreCase(biobjTypeCd)) { // the engine document type and the biobject type are not compatible
* logger.error("Engine cannot execute input document type: " + "the engine " + engine.getName() + " can execute '" + compatibleBiobjTypeCd +
* "' type documents " + "while the input document is a '" + biobjTypeCd + "'."); Vector params = new Vector(); params.add(engine.getName());
......@@ -229,7 +229,7 @@ public class DocumentCompositionUtils {
// identity string for context
UUIDGenerator uuidGen = UUIDGenerator.getInstance();
UUID uuid = uuidGen.generateRandomBasedUUID();
urlReturn += "&" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + uuid.toString();
urlReturn += "&" + LightNavigationConstants.LIGHT_NAVIGATOR_ID + "=" + uuid.toString();
if (document.getSnapshot() != null && document.getSnapshot()) {
Snapshot snap = DAOFactory.getSnapshotDAO().getLastSnapshot(objId);
if (snap != null) {
......@@ -394,11 +394,8 @@ public class DocumentCompositionUtils {
par.setParameterValues(values);
Parameter tmpPar = par.getParameter();
logger.debug("Manage parameter : " + tmpPar.getLabel() + "...");
if (tmpPar != null
&& values.size() > 1
&& tmpPar.getModalityValue() != null
&& ((!(par).isMultivalue()) || tmpPar.getModalityValue().getITypeCd()
.equalsIgnoreCase(SpagoBIConstants.INPUT_TYPE_MAN_IN_CODE))) {
if (tmpPar != null && values.size() > 1 && tmpPar.getModalityValue() != null && ((!(par).isMultivalue())
|| tmpPar.getModalityValue().getITypeCd().equalsIgnoreCase(SpagoBIConstants.INPUT_TYPE_MAN_IN_CODE))) {
logger.debug("Force the multivalue modality for parameter " + tmpPar.getLabel());
// force the multivalue management if the parameter has defined as MANUAL INPUT and the values is multiple.
tmpPar.getModalityValue().setMultivalue(true);
......
/*
* Knowage, Open Source Business Intelligence suite
* Copyright (C) 2016 Engineering Ingegneria Informatica S.p.A.
*
* Knowage is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Knowage 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.eng.spago.navigation;
import it.eng.spago.base.Constants;
import it.eng.spago.base.SourceBean;
import it.eng.spago.tracing.TracerSingleton;
import javax.portlet.PortletRequest;
import javax.portlet.PortletSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
public class LightNavigationManager {
public static final String LIGHT_NAVIGATOR_ID = "LIGHT_NAVIGATOR_ID";
public static final String LIGHT_NAVIGATOR_DESTROY = "LIGHT_NAVIGATOR_DESTROY";
public static final String LIGHT_NAVIGATOR_RESET = "LIGHT_NAVIGATOR_RESET";
public static final String LIGHT_NAVIGATOR_RESET_INSERT = "LIGHT_NAVIGATOR_RESET_INSERT";
public static final String LIGHT_NAVIGATOR_DISABLED = "LIGHT_NAVIGATOR_DISABLED";
public static final String LIGHT_NAVIGATOR_BACK_TO = "LIGHT_NAVIGATOR_BACK_TO";
public static final String LIGHT_NAVIGATOR_REPLACE_LAST = "LIGHT_NAVIGATOR_REPLACE_LAST";
public static final String LIGHT_NAVIGATOR_BACK_TO_MARK = "LIGHT_NAVIGATOR_BACK_TO_MARK";
public static final String LIGHT_NAVIGATOR_MARK = "LIGHT_NAVIGATOR_MARK";
private static final String _sessionAttributeBaseKey = "LIGHT_NAVIGATOR";
public static SourceBean controlLightNavigation (PortletRequest request, SourceBean serviceRequest) throws Exception {
Object o = (Object)request;
return controlLightNavigation(o, serviceRequest);
}
/**
* This method is responsible for the requests stack (the <code>LightNavigator</code>) modification.
* It controls if there is one of the following attributes in the service request:
* <code>LIGHT_NAVIGATOR_DESTROY</code> (requests stack is destroyed);
* <code>LIGHT_NAVIGATOR_RESET</code> (requests stack is resetted and current request is not put into stack);
* <code>LIGHT_NAVIGATOR_RESET_INSERT</code> (requests stack is resetted and current request is put into stack);
* <code>LIGHT_NAVIGATOR_DISABLED</code> (the navigator is disabled: the stack is not modified and the original request is returned);
* <code>LIGHT_NAVIGATOR_BACK_TO</code> (the request in the stack at position represented by this attribute is returned);
* <code>LIGHT_NAVIGATOR_BACK_TO_MARK</code> (the request in the stack marked by the string represented by this attribute is returned);
* <code>LIGHT_NAVIGATOR_MARK</code> (the request at input is marked with the string represented by this attribute and put in the stack).
* <code>LIGHT_NAVIGATOR_REPLACE_LAST</code> (the more recent request is replaced by the request at input).
* If any errors occur, the original request is returned.
*
* @param portletRequest The <code>PortletRequest</code> object
* @param serviceRequest The original service request <code>SourceBean</code>
* @return the service request <code>SourceBean</code>
* @throws Exception
*/
public static SourceBean controlLightNavigation (Object request, SourceBean serviceRequest) throws Exception {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "Method controlNavigation in LightNavigationManager class invoked with service request:\n" + serviceRequest);
if (request == null) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.CRITICAL, "LightNavigationManager: " +
"controlLightNavigation: request object at input is null.");
throw new Exception ("request object is null.");
}
if (serviceRequest == null) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.CRITICAL, "LightNavigationManager: " +
"controlLightNavigation: the service request SourceBean at input is null.");
throw new Exception ("Service request SourceBean is null.");
}
// Makes a clone of the serviceRequest, to be returned in case of errors
SourceBean savedServiceRequest = (SourceBean) serviceRequest.cloneObject();
LightNavigator lightNavigator = null;
try {
String lightNavigatorDestroy = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_DESTROY);
if ("true".equalsIgnoreCase(lightNavigatorDestroy)) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"Destroying light navigator.");
destroyLightNavigatorFromSession(request);
return serviceRequest;
}
// Retrieves the LightNavigator object from session; if it does not exist it creates a new one
lightNavigator = retrieveLightNavigatorFromSession(request);
// If LightNavigator is disabled return the serviceRequest unmodified
String lightNavigatorDisabled = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_DISABLED);
if ("true".equalsIgnoreCase(lightNavigatorDisabled)) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigator disabled; " +
"return from the method controlNavigation without any modifications to the original request.");
//TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack is not modified:\n" + lightNavigator.toString());
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack is not modified.");
return serviceRequest;
}
String lightNavigatorBackTo = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_BACK_TO);
if (lightNavigatorBackTo != null) {
int position = Integer.parseInt(lightNavigatorBackTo);
MarkedRequest markedRequest = lightNavigator.goBackToPosition(position);
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"returning request at position " + position + " of the stack.");
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is:\n" + lightNavigator.toString());
return markedRequest.getRequest();
}
String lightNavigatorReplaceLast = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_REPLACE_LAST);
if (lightNavigatorReplaceLast != null) {
String mark = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_MARK);
MarkedRequest markedRequest = new MarkedRequest(serviceRequest, mark);
lightNavigator.replaceLast(markedRequest);
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"substituted the more recent request (at position 0) of the stack with the input one.");
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is:\n" + lightNavigator.toString());
return markedRequest.getRequest();
}
String lightNavigatorBackToMark = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_BACK_TO_MARK);
if (lightNavigatorBackToMark != null) {
MarkedRequest markedRequest = lightNavigator.goBackToMark(lightNavigatorBackToMark);
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"returning request with mark " + lightNavigatorBackToMark + " of the stack.");
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is:\n" + lightNavigator.toString());
return markedRequest.getRequest();
}
String lightNavigatorReset = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_RESET);
if (lightNavigatorReset != null) {
lightNavigator.reset();
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"stack reset executed.");
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is empty.");
return serviceRequest;
}
String lightNavigatorResetInsert = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_RESET_INSERT);
if (lightNavigatorResetInsert != null) {
lightNavigator.reset();
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"stack reset executed.");
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is empty.");
}
String mark = (String) serviceRequest.getAttribute(LIGHT_NAVIGATOR_MARK);
MarkedRequest markedRequest = new MarkedRequest(serviceRequest, mark);
lightNavigator.add(markedRequest);
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "LightNavigationManager: controlLightNavigation: " +
"putting the request in the stack " +
(mark == null ? "without mark" : "with mark '" + mark + "'") + ". Returning unmodified request.");
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is:\n" + lightNavigator.toString());
return serviceRequest;
} catch (Exception e) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.MAJOR, "LightNavigationManager: " +
"controlLightNavigation: an exception occurred. " +
"Returning the original request.", e);
if (lightNavigator != null) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG, "The requests stack now is:\n" +
lightNavigator.toString());
}
return savedServiceRequest;
}
}
/**
* Retrieves the <code>LightNavigator</code> object from session; if it does not exist it creates a new one
*
* @param The request object (it can be a <code>HttpServletRequest</code> or a <code>PortletRequest</code> object)
* @throws Exception
*/
private static LightNavigator retrieveLightNavigatorFromSession (Object request) throws Exception {
if (!(request instanceof PortletRequest) && !(request instanceof HttpServletRequest)) {
TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.CRITICAL, "LightNavigationManager: " +
"retrieveLightNavigatorFromSession: request object is neither a PortletRequest " +
"nor an HttpServletRequest");
throw new Exception ("request object is neither a PortletRequest nor an HttpServletRequest");
}
LightNavigator lightNavigator = null;
</