use of de.metas.ui.web.process.ProcessInstanceResult.OpenViewAction 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;
}
}
Aggregations