Search in sources :

Example 1 with DocumentPreconditionsAsContext

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

the class WindowRestController method getDocumentActions.

private JSONDocumentActionsList getDocumentActions(final DocumentPath documentPath, final Set<TableRecordReference> selectedIncludedRecords, final boolean returnDisabled) {
    userSession.assertLoggedIn();
    final Predicate<WebuiRelatedProcessDescriptor> filter;
    if (returnDisabled) {
        filter = WebuiRelatedProcessDescriptor::isEnabledOrNotSilent;
    } else {
        filter = WebuiRelatedProcessDescriptor::isEnabled;
    }
    return documentCollection.forDocumentReadonly(documentPath, document -> {
        final DocumentPreconditionsAsContext preconditionsContext = DocumentPreconditionsAsContext.of(document, selectedIncludedRecords);
        return processRestController.streamDocumentRelatedProcesses(preconditionsContext).filter(filter).collect(JSONDocumentActionsList.collect(newJSONOptions().build()));
    });
}
Also used : WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) DocumentPreconditionsAsContext(de.metas.ui.web.process.DocumentPreconditionsAsContext)

Aggregations

DocumentPreconditionsAsContext (de.metas.ui.web.process.DocumentPreconditionsAsContext)1 WebuiRelatedProcessDescriptor (de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor)1