Search in sources :

Example 1 with WebuiPreconditionsContext

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

the class ViewRestController method getDocumentActions.

@GetMapping("/{viewId}/actions")
public JSONDocumentActionsList getDocumentActions(@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(// only those which are enabled or not silent
    WebuiRelatedProcessDescriptor::isEnabled).collect(JSONDocumentActionsList.collect(newJSONOptions()));
}
Also used : WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with WebuiPreconditionsContext

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

WebuiPreconditionsContext (de.metas.ui.web.process.WebuiPreconditionsContext)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 WebuiRelatedProcessDescriptor (de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor)1