final IExecutionListener execListener, final boolean collateMessages, final boolean manageHibernate ) {
if ( manageHibernate ) {
PentahoSystem.systemEntryPoint();
}
ISolutionEngine solutionEngine = null;
try {
solutionEngine = PentahoSystem.get( ISolutionEngine.class, session );
solutionEngine.init( session );
solutionEngine.setlistener( execListener );
SimpleParameterProvider parameterProvider = new SimpleParameterProvider( parameters );
IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
String url = requestContext.getContextPath();
// Modifications by Ezequiel Cuellar
// Old code.
// String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
// New code. Since the SubActionComponent is being instantiated below to return feedback
// it is necesary to configure the baseUrl to include the ViewAction.
Object actionUrlComponent = parameters.get( StandardSettings.ACTION_URL_COMPONENT );
if ( ( actionUrlComponent != null ) && ( actionUrlComponent.toString().length() > 0 ) ) {
url += actionUrlComponent.toString();
} else {
url += "ViewAction?"; //$NON-NLS-1$
}
HashMap<String, IParameterProvider> parameterProviderMap = new HashMap<String, IParameterProvider>();
parameterProviderMap.put( IParameterProvider.SCOPE_REQUEST, parameterProvider );
IPentahoUrlFactory urlFactory = new SimpleUrlFactory( url );
String processName = description;
boolean persisted = false;
// for now, the messages list needs to be untyped since we may put exceptions as well as strings in it
List<?> messages = null;
if ( collateMessages ) {
messages = new ArrayList();
}
if ( outputStream == null ) {
outputStream = new ByteArrayOutputStream( 0 );
}
SimpleOutputHandler outputHandler = null;
if ( outputStream != null ) {
// Modifications by Ezequiel Cuellar
// Old code.
// outputHandler = new SimpleOutputHandler(outputStream, false);
// New code. Without setting the allowFeedback parameter to true it is assumed that SubActionComponent
// instances
// are never capable of returning feedback which may not always be the case.
outputHandler = new SimpleOutputHandler( outputStream, true );
outputHandler.setOutputPreference( IOutputHandler.OUTPUT_TYPE_DEFAULT );
}
solutionEngine.execute( actionSequence, processName, false, true, null, persisted, parameterProviderMap,
outputHandler, null, urlFactory, messages );
} finally {
if ( manageHibernate ) {
PentahoSystem.systemExitPoint();