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()));
});
}
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();
}
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()));
}
Aggregations