Search in sources :

Example 1 with SelectViewRowsAction

use of de.metas.ui.web.process.ProcessInstanceResult.SelectViewRowsAction in project metasfresh-webui-api by metasfresh.

the class JSONProcessInstanceResult method toJSONResultAction.

/**
 * Converts {@link ResultAction} to JSON
 */
private static final JSONResultAction toJSONResultAction(final ResultAction resultAction) {
    if (resultAction == null) {
        return null;
    } else if (resultAction instanceof OpenReportAction) {
        final OpenReportAction openReportAction = (OpenReportAction) resultAction;
        return new JSONOpenReportAction(openReportAction.getFilename(), openReportAction.getContentType());
    } else if (resultAction instanceof OpenViewAction) {
        final OpenViewAction openViewAction = (OpenViewAction) resultAction;
        return new JSONOpenViewAction(openViewAction.getViewId());
    } else if (resultAction instanceof OpenIncludedViewAction) {
        final OpenIncludedViewAction openIncludedViewAction = (OpenIncludedViewAction) resultAction;
        return new JSONOpenIncludedViewAction(openIncludedViewAction.getViewId(), openIncludedViewAction.getProfileId());
    } else if (resultAction instanceof OpenSingleDocument) {
        final OpenSingleDocument openDocumentAction = (OpenSingleDocument) resultAction;
        final DocumentPath documentPath = openDocumentAction.getDocumentPath();
        return new JSONOpenSingleDocumentAction(documentPath.getWindowId(), documentPath.getDocumentId().toJson(), openDocumentAction.isModal());
    } else if (resultAction instanceof SelectViewRowsAction) {
        final SelectViewRowsAction selectViewRowsAction = (SelectViewRowsAction) resultAction;
        return new JSONSelectViewRowsAction(selectViewRowsAction.getViewId(), selectViewRowsAction.getRowIds());
    } else {
        logger.warn("Unknown result action: {}. Ignoring it.", resultAction);
        return null;
    }
}
Also used : OpenSingleDocument(de.metas.ui.web.process.ProcessInstanceResult.OpenSingleDocument) OpenIncludedViewAction(de.metas.ui.web.process.ProcessInstanceResult.OpenIncludedViewAction) OpenViewAction(de.metas.ui.web.process.ProcessInstanceResult.OpenViewAction) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) SelectViewRowsAction(de.metas.ui.web.process.ProcessInstanceResult.SelectViewRowsAction) OpenReportAction(de.metas.ui.web.process.ProcessInstanceResult.OpenReportAction)

Aggregations

OpenIncludedViewAction (de.metas.ui.web.process.ProcessInstanceResult.OpenIncludedViewAction)1 OpenReportAction (de.metas.ui.web.process.ProcessInstanceResult.OpenReportAction)1 OpenSingleDocument (de.metas.ui.web.process.ProcessInstanceResult.OpenSingleDocument)1 OpenViewAction (de.metas.ui.web.process.ProcessInstanceResult.OpenViewAction)1 SelectViewRowsAction (de.metas.ui.web.process.ProcessInstanceResult.SelectViewRowsAction)1 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)1