use of de.metas.process.RelatedProcessDescriptor.DisplayPlace 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()));
}
use of de.metas.process.RelatedProcessDescriptor.DisplayPlace in project metasfresh-webui-api by metasfresh.
the class WebuiAccountingConfig method registerRepostProcessForSingleDocuments.
private void registerRepostProcessForSingleDocuments() {
final IADProcessDAO adProcessesRepo = Services.get(IADProcessDAO.class);
final IADTableDAO adTablesRepo = Services.get(IADTableDAO.class);
final AdProcessId repostProcessId = adProcessesRepo.retrieveProcessIdByClassIfUnique(WEBUI_Fact_Acct_Repost_SingleDocument.class);
if (repostProcessId == null) {
logger.warn("No AD_Process_ID found for {}", WEBUI_Fact_Acct_Repost_SingleDocument.class);
return;
}
//
final List<String> linkToTableNames = new ArrayList<>();
linkToTableNames.addAll(acctDocRegistry.getDocTableNames());
linkToTableNames.add(WEBUI_Fact_Acct_Repost_ViewRows.TABLENAME_RV_UnPosted);
//
// Link Repost process to all accountable documents
linkToTableNames.stream().map(adTablesRepo::retrieveTableId).filter(adTableId -> adTableId > 0).forEach(adTableId -> adProcessesRepo.registerTableProcess(RelatedProcessDescriptor.builder().processId(repostProcessId).tableId(adTableId).anyWindow().displayPlace(DisplayPlace.SingleDocumentActionsMenu).build()));
logger.info("Registered {} ({}) to {} tables", WEBUI_Fact_Acct_Repost_SingleDocument.class.getName(), repostProcessId, linkToTableNames.size());
}
use of de.metas.process.RelatedProcessDescriptor.DisplayPlace in project metasfresh-webui-api by metasfresh.
the class WebuiAccountingConfig method registerRepostProcessForViewRows.
private void registerRepostProcessForViewRows() {
final IADProcessDAO adProcessesRepo = Services.get(IADProcessDAO.class);
final IADTableDAO adTablesRepo = Services.get(IADTableDAO.class);
final AdProcessId repostProcessId = adProcessesRepo.retrieveProcessIdByClassIfUnique(WEBUI_Fact_Acct_Repost_ViewRows.class);
if (repostProcessId == null) {
logger.warn("No AD_Process_ID found for {}", WEBUI_Fact_Acct_Repost_ViewRows.class);
return;
}
//
final List<String> linkToTableNames = new ArrayList<>();
linkToTableNames.addAll(acctDocRegistry.getDocTableNames());
linkToTableNames.add(WEBUI_Fact_Acct_Repost_ViewRows.TABLENAME_RV_UnPosted);
//
// Link Repost process to all accountable documents
linkToTableNames.stream().map(adTablesRepo::retrieveTableId).filter(adTableId -> adTableId > 0).forEach(adTableId -> adProcessesRepo.registerTableProcess(RelatedProcessDescriptor.builder().processId(repostProcessId).tableId(adTableId).anyWindow().displayPlace(DisplayPlace.ViewQuickActions).displayPlace(DisplayPlace.ViewActionsMenu).build()));
logger.info("Registered {} ({}) to {} tables", WEBUI_Fact_Acct_Repost_ViewRows.class.getName(), repostProcessId, linkToTableNames.size());
}
use of de.metas.process.RelatedProcessDescriptor.DisplayPlace 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()));
}
Aggregations