Search in sources :

Example 1 with JSONDocumentActionsList

use of de.metas.ui.web.process.json.JSONDocumentActionsList 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(PARAM_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, @RequestParam(name = "viewProfileId", required = false) final String viewProfileIdStr, @RequestParam(name = "all", required = false) final boolean all) {
    userSession.assertLoggedIn();
    final WebuiPreconditionsContext preconditionsContext = newPreconditionsContextBuilder().windowId(windowId).viewIdString(viewIdStr).viewProfileIdStr(viewProfileIdStr).selectedIdsList(selectedIdsListStr).parentViewId(parentViewIdStr).parentViewSelectedIdsList(parentViewSelectedIdsListStr).childViewId(childViewIdStr).childViewSelectedIdsList(childViewSelectedIdsListStr).displayPlace(DisplayPlace.ViewQuickActions).build();
    return processRestController.streamDocumentRelatedProcesses(preconditionsContext).filter(// shall be already filtered out, but just to make sure
    descriptor -> descriptor.isDisplayedOn(preconditionsContext.getDisplayPlace())).filter(// only those which are enabled or not silent
    descriptor -> all || descriptor.isEnabledOrNotSilent()).collect(JSONDocumentActionsList.collect(newJSONOptions()));
}
Also used : MimeType(org.compiere.util.MimeType) PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) DisplayPlace(de.metas.process.RelatedProcessDescriptor.DisplayPlace) WebRequest(org.springframework.web.context.request.WebRequest) ApiParam(io.swagger.annotations.ApiParam) JSONZoomInto(de.metas.ui.web.window.datatypes.json.JSONZoomInto) Evaluatee(org.compiere.util.Evaluatee) InputStreamResource(org.springframework.core.io.InputStreamResource) ViewLayout(de.metas.ui.web.view.descriptor.ViewLayout) JSONViewLayout(de.metas.ui.web.view.json.JSONViewLayout) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) ExcelFormat(de.metas.impexp.excel.ExcelFormat) Resource(org.springframework.core.io.Resource) PostMapping(org.springframework.web.bind.annotation.PostMapping) WindowRestController(de.metas.ui.web.window.controller.WindowRestController) JSONDocumentLayoutOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutOptions) LookupDataSourceContext(de.metas.ui.web.window.model.lookup.LookupDataSourceContext) HttpHeaders(org.springframework.http.HttpHeaders) NonNull(lombok.NonNull) MediaType(org.springframework.http.MediaType) ProcessRestController(de.metas.ui.web.process.ProcessRestController) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) Objects(java.util.Objects) UserSession(de.metas.ui.web.session.UserSession) JSONViewRow(de.metas.ui.web.view.json.JSONViewRow) List(java.util.List) Builder(lombok.Builder) JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) WebConfig(de.metas.ui.web.config.WebConfig) ViewAsPreconditionsContext(de.metas.ui.web.process.ViewAsPreconditionsContext) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) JSONViewDataType(de.metas.ui.web.view.json.JSONViewDataType) RequestBody(org.springframework.web.bind.annotation.RequestBody) JSONViewProfilesList(de.metas.ui.web.view.json.JSONViewProfilesList) ImmutableList(com.google.common.collect.ImmutableList) GetMapping(org.springframework.web.bind.annotation.GetMapping) JSONFilterViewRequest(de.metas.ui.web.view.json.JSONFilterViewRequest) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) Api(io.swagger.annotations.Api) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) Evaluatees(org.compiere.util.Evaluatees) FileOutputStream(java.io.FileOutputStream) WindowId(de.metas.ui.web.window.datatypes.WindowId) FileInputStream(java.io.FileInputStream) ETagResponseEntityBuilder(de.metas.ui.web.cache.ETagResponseEntityBuilder) File(java.io.File) HttpStatus(org.springframework.http.HttpStatus) JSONDocumentActionsList(de.metas.ui.web.process.json.JSONDocumentActionsList) JSONCreateViewRequest(de.metas.ui.web.view.json.JSONCreateViewRequest) AdempiereException(org.adempiere.exceptions.AdempiereException) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) JSONViewResult(de.metas.ui.web.view.json.JSONViewResult) ResponseEntity(org.springframework.http.ResponseEntity) ExcelFormats(de.metas.impexp.excel.ExcelFormats) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with JSONDocumentActionsList

use of de.metas.ui.web.process.json.JSONDocumentActionsList 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(PARAM_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, @RequestParam(name = "all", required = false) final boolean all) {
    userSession.assertLoggedIn();
    final WebuiPreconditionsContext preconditionsContext = newPreconditionsContextBuilder().windowId(windowId).viewIdString(viewIdStr).selectedIdsList(selectedIdsListStr).parentViewId(parentViewIdStr).parentViewSelectedIdsList(parentViewSelectedIdsListStr).childViewId(childViewIdStr).childViewSelectedIdsList(childViewSelectedIdsListStr).displayPlace(DisplayPlace.ViewActionsMenu).build();
    return processRestController.streamDocumentRelatedProcesses(preconditionsContext).filter(// shall be already filtered out, but just to make sure
    descriptor -> descriptor.isDisplayedOn(preconditionsContext.getDisplayPlace())).filter(// only those which are enabled and not internally rejected
    descriptor -> all || descriptor.isEnabled()).collect(JSONDocumentActionsList.collect(newJSONOptions()));
}
Also used : MimeType(org.compiere.util.MimeType) PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) DisplayPlace(de.metas.process.RelatedProcessDescriptor.DisplayPlace) WebRequest(org.springframework.web.context.request.WebRequest) ApiParam(io.swagger.annotations.ApiParam) JSONZoomInto(de.metas.ui.web.window.datatypes.json.JSONZoomInto) Evaluatee(org.compiere.util.Evaluatee) InputStreamResource(org.springframework.core.io.InputStreamResource) ViewLayout(de.metas.ui.web.view.descriptor.ViewLayout) JSONViewLayout(de.metas.ui.web.view.json.JSONViewLayout) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) ExcelFormat(de.metas.impexp.excel.ExcelFormat) Resource(org.springframework.core.io.Resource) PostMapping(org.springframework.web.bind.annotation.PostMapping) WindowRestController(de.metas.ui.web.window.controller.WindowRestController) JSONDocumentLayoutOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutOptions) LookupDataSourceContext(de.metas.ui.web.window.model.lookup.LookupDataSourceContext) HttpHeaders(org.springframework.http.HttpHeaders) NonNull(lombok.NonNull) MediaType(org.springframework.http.MediaType) ProcessRestController(de.metas.ui.web.process.ProcessRestController) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) Objects(java.util.Objects) UserSession(de.metas.ui.web.session.UserSession) JSONViewRow(de.metas.ui.web.view.json.JSONViewRow) List(java.util.List) Builder(lombok.Builder) JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) WebConfig(de.metas.ui.web.config.WebConfig) ViewAsPreconditionsContext(de.metas.ui.web.process.ViewAsPreconditionsContext) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) JSONViewDataType(de.metas.ui.web.view.json.JSONViewDataType) RequestBody(org.springframework.web.bind.annotation.RequestBody) JSONViewProfilesList(de.metas.ui.web.view.json.JSONViewProfilesList) ImmutableList(com.google.common.collect.ImmutableList) GetMapping(org.springframework.web.bind.annotation.GetMapping) JSONFilterViewRequest(de.metas.ui.web.view.json.JSONFilterViewRequest) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) Api(io.swagger.annotations.Api) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) Evaluatees(org.compiere.util.Evaluatees) FileOutputStream(java.io.FileOutputStream) WindowId(de.metas.ui.web.window.datatypes.WindowId) FileInputStream(java.io.FileInputStream) ETagResponseEntityBuilder(de.metas.ui.web.cache.ETagResponseEntityBuilder) File(java.io.File) HttpStatus(org.springframework.http.HttpStatus) JSONDocumentActionsList(de.metas.ui.web.process.json.JSONDocumentActionsList) JSONCreateViewRequest(de.metas.ui.web.view.json.JSONCreateViewRequest) AdempiereException(org.adempiere.exceptions.AdempiereException) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) JSONViewResult(de.metas.ui.web.view.json.JSONViewResult) ResponseEntity(org.springframework.http.ResponseEntity) ExcelFormats(de.metas.impexp.excel.ExcelFormats) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)2 ExcelFormat (de.metas.impexp.excel.ExcelFormat)2 ExcelFormats (de.metas.impexp.excel.ExcelFormats)2 DisplayPlace (de.metas.process.RelatedProcessDescriptor.DisplayPlace)2 ETagResponseEntityBuilder (de.metas.ui.web.cache.ETagResponseEntityBuilder)2 WebConfig (de.metas.ui.web.config.WebConfig)2 ProcessRestController (de.metas.ui.web.process.ProcessRestController)2 ViewAsPreconditionsContext (de.metas.ui.web.process.ViewAsPreconditionsContext)2 WebuiPreconditionsContext (de.metas.ui.web.process.WebuiPreconditionsContext)2 JSONDocumentActionsList (de.metas.ui.web.process.json.JSONDocumentActionsList)2 UserSession (de.metas.ui.web.session.UserSession)2 ViewLayout (de.metas.ui.web.view.descriptor.ViewLayout)2 JSONCreateViewRequest (de.metas.ui.web.view.json.JSONCreateViewRequest)2 JSONFilterViewRequest (de.metas.ui.web.view.json.JSONFilterViewRequest)2 JSONViewDataType (de.metas.ui.web.view.json.JSONViewDataType)2 JSONViewLayout (de.metas.ui.web.view.json.JSONViewLayout)2 JSONViewProfilesList (de.metas.ui.web.view.json.JSONViewProfilesList)2 JSONViewResult (de.metas.ui.web.view.json.JSONViewResult)2 JSONViewRow (de.metas.ui.web.view.json.JSONViewRow)2 WindowRestController (de.metas.ui.web.window.controller.WindowRestController)2