Search in sources :

Example 1 with WebuiRelatedProcessDescriptor

use of de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor 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)

Example 2 with WebuiRelatedProcessDescriptor

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

the class ADProcessDescriptorsFactory method toWebuiRelatedProcessDescriptor.

private WebuiRelatedProcessDescriptor toWebuiRelatedProcessDescriptor(@NonNull final RelatedProcessDescriptor relatedProcessDescriptor, @NonNull final IProcessPreconditionsContext preconditionsContext) {
    final ProcessId processId = ProcessId.ofAD_Process_ID(relatedProcessDescriptor.getProcessId());
    final ProcessDescriptor processDescriptor = getProcessDescriptor(processId);
    final ProcessPreconditionsResolutionSupplier preconditionsResolutionSupplier = ProcessPreconditionsResolutionSupplier.builder().preconditionsContext(preconditionsContext).processPreconditionsCheckers(relatedProcessDescriptor.getProcessPreconditionsCheckers()).processDescriptor(processDescriptor).build();
    return WebuiRelatedProcessDescriptor.builder().processId(processDescriptor.getProcessId()).processCaption(processDescriptor.getCaption()).processDescription(processDescriptor.getDescription()).debugProcessClassname(processDescriptor.getProcessClassname()).quickAction(relatedProcessDescriptor.isWebuiQuickAction()).defaultQuickAction(relatedProcessDescriptor.isWebuiDefaultQuickAction()).preconditionsResolutionSupplier(preconditionsResolutionSupplier).build();
}
Also used : ProcessDescriptor(de.metas.ui.web.process.descriptor.ProcessDescriptor) RelatedProcessDescriptor(de.metas.process.RelatedProcessDescriptor) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) ProcessId(de.metas.ui.web.process.ProcessId)

Example 3 with WebuiRelatedProcessDescriptor

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

the class ViewRestController method getDocumentQuickActions.

@GetMapping("/{viewId}/quickActions")
public JSONDocumentActionsList getDocumentQuickActions(@PathVariable(PARAM_WindowId) final String windowId, @PathVariable("viewId") final String viewIdStr, @RequestParam(name = "selectedIds", required = false) @ApiParam("comma separated IDs") final String selectedIdsListStr, @RequestParam(name = "parentViewId", required = false) final String parentViewIdStr, @RequestParam(name = "parentViewSelectedIds", required = false) @ApiParam("comma separated IDs") final String parentViewSelectedIdsListStr, @RequestParam(name = "childViewId", required = false) final String childViewIdStr, @RequestParam(name = "childViewSelectedIds", required = false) @ApiParam("comma separated IDs") final String childViewSelectedIdsListStr) {
    userSession.assertLoggedIn();
    final WebuiPreconditionsContext preconditionsContext = newPreconditionsContextBuilder().windowId(windowId).viewIdString(viewIdStr).selectedIdsList(selectedIdsListStr).parentViewId(parentViewIdStr).parentViewSelectedIdsList(parentViewSelectedIdsListStr).childViewId(childViewIdStr).childViewSelectedIdsList(childViewSelectedIdsListStr).build();
    return processRestController.streamDocumentRelatedProcesses(preconditionsContext).filter(WebuiRelatedProcessDescriptor::isQuickAction).filter(// only those which are enabled or not silent
    WebuiRelatedProcessDescriptor::isEnabledOrNotSilent).collect(JSONDocumentActionsList.collect(newJSONOptions()));
}
Also used : WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

WebuiRelatedProcessDescriptor (de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor)3 RelatedProcessDescriptor (de.metas.process.RelatedProcessDescriptor)1 DocumentPreconditionsAsContext (de.metas.ui.web.process.DocumentPreconditionsAsContext)1 ProcessId (de.metas.ui.web.process.ProcessId)1 WebuiPreconditionsContext (de.metas.ui.web.process.WebuiPreconditionsContext)1 ProcessDescriptor (de.metas.ui.web.process.descriptor.ProcessDescriptor)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1