use of org.pentaho.platform.api.engine.IActionSequence in project pentaho-platform by pentaho.
the class XactionUtil method createOutputFileName.
@SuppressWarnings("rawtypes")
public static void createOutputFileName(RepositoryFile file, IOutputHandler outputHandler) {
IPentahoSession userSession = PentahoSessionHolder.getSession();
ActionSequenceJCRHelper actionHelper = new ActionSequenceJCRHelper(userSession);
IActionSequence actionSequence = actionHelper.getActionSequence(file.getPath(), PentahoSystem.loggingLevel, RepositoryFilePermission.READ);
// $NON-NLS-1$
String fileName = "content";
if (actionSequence != null) {
String title = actionSequence.getTitle();
if ((title != null) && (title.length() > 0)) {
fileName = title;
} else {
String sequenceName = actionSequence.getSequenceName();
if ((sequenceName != null) && (sequenceName.length() > 0)) {
fileName = sequenceName;
} else {
List actionDefinitionsList = actionSequence.getActionDefinitionsAndSequences();
int i = 0;
boolean done = false;
while ((actionDefinitionsList.size() > i) && (!done)) {
IActionDefinition actionDefinition = (IActionDefinition) actionDefinitionsList.get(i);
String componentName = actionDefinition.getComponentName();
if ((componentName != null) && (componentName.length() > 0)) {
fileName = componentName;
done = true;
} else {
++i;
}
}
}
}
}
IMimeTypeListener mimeTypeListener = outputHandler.getMimeTypeListener();
if (mimeTypeListener != null) {
mimeTypeListener.setName(fileName);
}
}
use of org.pentaho.platform.api.engine.IActionSequence in project pentaho-platform by pentaho.
the class ViewAction method doGet.
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
PentahoSystem.systemEntryPoint();
try {
IPentahoSession userSession = getPentahoSession(request);
if (!doBackgroundExecution(request, response, userSession)) {
OutputStream outputStream = getOutputStream(response, doMessages(request));
ActionSequenceJCRHelper actionHelper = new ActionSequenceJCRHelper(userSession);
// $NON-NLS-1$
String actionPath = request.getParameter("path");
IActionSequence actionSequence = actionHelper.getActionSequence(actionPath, PentahoSystem.loggingLevel, RepositoryFilePermission.READ);
String fileName = null;
if (actionSequence != null) {
String title = actionSequence.getTitle();
if ((title != null) && (title.length() > 0)) {
fileName = title;
} else {
String sequenceName = actionSequence.getSequenceName();
if ((sequenceName != null) && (sequenceName.length() > 0)) {
fileName = sequenceName;
} else {
List actionDefinitionsList = actionSequence.getActionDefinitionsAndSequences();
int i = 0;
boolean done = false;
while ((actionDefinitionsList.size() > i) && !done) {
IActionDefinition actionDefinition = (IActionDefinition) actionDefinitionsList.get(i);
String componentName = actionDefinition.getComponentName();
if ((componentName != null) && (componentName.length() > 0)) {
fileName = componentName;
done = true;
} else {
i++;
}
}
}
}
}
IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
HttpOutputHandler outputHandler = createOutputHandler(response, outputStream);
outputHandler.setSession(userSession);
IMimeTypeListener listener = new HttpMimeTypeListener(request, response, fileName);
outputHandler.setMimeTypeListener(listener);
// $NON-NLS-1$
SimpleUrlFactory urlFactory = new SimpleUrlFactory(requestContext.getContextPath() + "ViewAction?");
IParameterProvider requestParameters = new HttpRequestParameterProvider(request);
HttpServletRequestHandler requestHandler = getRequestHandler(request, response, userSession, requestParameters, outputStream, outputHandler, urlFactory);
handleActionRequest(request, response, outputHandler, requestHandler, outputStream, null);
}
} finally {
PentahoSystem.systemExitPoint();
}
}
use of org.pentaho.platform.api.engine.IActionSequence in project pentaho-platform by pentaho.
the class ActionSequenceJCRHelper method getActionSequence.
public IActionSequence getActionSequence(String actionPath, int loggingLevel, RepositoryFilePermission actionOperation) {
Document actionSequenceDocument = getSolutionDocument(actionPath, actionOperation);
if (actionSequenceDocument == null) {
return null;
}
IActionSequence actionSequence = SequenceDefinition.ActionSequenceFactory(actionSequenceDocument, actionPath, pentahoSession, PentahoSystem.getApplicationContext(), loggingLevel);
if (actionSequence == null) {
return null;
}
return actionSequence;
}
Aggregations