Search in sources :

Example 1 with JSONLookupValuesList

use of de.metas.ui.web.window.datatypes.json.JSONLookupValuesList in project metasfresh-webui-api by metasfresh.

the class ViewRowAttributesRestController method getAttributeDropdown.

@GetMapping("/attribute/{attributeName}/dropdown")
public JSONLookupValuesList getAttributeDropdown(// 
@PathVariable(PARAM_WindowId) final String windowIdStr, // 
@PathVariable(PARAM_ViewId) final String viewIdStr, // 
@PathVariable(PARAM_RowId) final String rowIdStr, // 
@PathVariable("attributeName") final String attributeName) {
    userSession.assertLoggedIn();
    final ViewId viewId = ViewId.of(windowIdStr, viewIdStr);
    final DocumentId rowId = DocumentId.of(rowIdStr);
    return viewsRepo.getView(viewId).getById(rowId).getAttributes().getAttributeDropdown(attributeName).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with JSONLookupValuesList

use of de.metas.ui.web.window.datatypes.json.JSONLookupValuesList in project metasfresh-webui-api by metasfresh.

the class ProcessRestController method getParameterTypeahead.

@RequestMapping(value = "/{processId}/{pinstanceId}/field/{parameterName}/typeahead", method = RequestMethod.GET)
public JSONLookupValuesList getParameterTypeahead(// 
@PathVariable("processId") final String processIdStr, // 
@PathVariable("pinstanceId") final String pinstanceIdStr, // 
@PathVariable("parameterName") final String parameterName, // 
@RequestParam(name = "query", required = true) final String query) {
    userSession.assertLoggedIn();
    final ProcessId processId = ProcessId.fromJson(processIdStr);
    final DocumentId pinstanceId = DocumentId.of(pinstanceIdStr);
    final IProcessInstancesRepository instancesRepository = getRepository(processId);
    return instancesRepository.forProcessInstanceReadonly(pinstanceId, processInstance -> processInstance.getParameterLookupValuesForQuery(parameterName, query)).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) WebRequest(org.springframework.web.context.request.WebRequest) Env(org.compiere.util.Env) Autowired(org.springframework.beans.factory.annotation.Autowired) DocumentCollection(de.metas.ui.web.window.model.DocumentCollection) OpenReportAction(de.metas.ui.web.process.ProcessInstanceResult.OpenReportAction) ReasonSupplier(de.metas.ui.web.window.model.IDocumentChangesCollector.ReasonSupplier) IView(de.metas.ui.web.view.IView) ProcessDescriptor(de.metas.ui.web.process.descriptor.ProcessDescriptor) Util(org.compiere.util.Util) HttpHeaders(org.springframework.http.HttpHeaders) NonNull(lombok.NonNull) Collection(java.util.Collection) MediaType(org.springframework.http.MediaType) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) UserSession(de.metas.ui.web.session.UserSession) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException) List(java.util.List) Stream(java.util.stream.Stream) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) JSONDocument(de.metas.ui.web.window.datatypes.json.JSONDocument) JSONProcessLayout(de.metas.ui.web.process.json.JSONProcessLayout) IViewsRepository(de.metas.ui.web.view.IViewsRepository) LogManager(de.metas.logging.LogManager) JSONProcessInstanceResult(de.metas.ui.web.process.json.JSONProcessInstanceResult) JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) WebConfig(de.metas.ui.web.config.WebConfig) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) Execution(de.metas.ui.web.window.controller.Execution) JSONDocumentChangedEvent(de.metas.ui.web.window.datatypes.json.JSONDocumentChangedEvent) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) NullDocumentChangesCollector(de.metas.ui.web.window.model.NullDocumentChangesCollector) RequestBody(org.springframework.web.bind.annotation.RequestBody) JSONCreateProcessInstanceRequest(de.metas.ui.web.process.json.JSONCreateProcessInstanceRequest) JSONProcessInstance(de.metas.ui.web.process.json.JSONProcessInstance) Api(io.swagger.annotations.Api) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) ViewRowIdsSelection(de.metas.ui.web.view.ViewRowIdsSelection) Logger(org.slf4j.Logger) ETagResponseEntityBuilder(de.metas.ui.web.cache.ETagResponseEntityBuilder) ApplicationContext(org.springframework.context.ApplicationContext) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) HttpStatus(org.springframework.http.HttpStatus) Check(org.adempiere.util.Check) ResponseEntity(org.springframework.http.ResponseEntity) ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with JSONLookupValuesList

use of de.metas.ui.web.window.datatypes.json.JSONLookupValuesList in project metasfresh-webui-api by metasfresh.

the class BoardRestController method getFilterParameterTypeahead.

@GetMapping("/{boardId}/newCardsView/{viewId}/filter/{filterId}/field/{parameterName}/typeahead")
public JSONLookupValuesList getFilterParameterTypeahead(@PathVariable("boardId") final int boardId, @PathVariable("viewId") final String viewIdStr, @PathVariable("filterId") final String filterId, @PathVariable("parameterName") final String parameterName, @RequestParam(name = "query", required = true) final String query) {
    userSession.assertLoggedIn();
    final ViewId viewId = ViewId.ofViewIdString(viewIdStr);
    return viewsRepo.getView(viewId).getFilterParameterTypeahead(filterId, parameterName, query, userSession.toEvaluatee()).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : ViewId(de.metas.ui.web.view.ViewId) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 4 with JSONLookupValuesList

use of de.metas.ui.web.window.datatypes.json.JSONLookupValuesList in project metasfresh-webui-api by metasfresh.

the class BoardRestController method getFilterParameterDropdown.

@GetMapping("/{boardId}/newCardsView/{viewId}/filter/{filterId}/field/{parameterName}/dropdown")
public JSONLookupValuesList getFilterParameterDropdown(@PathVariable("boardId") final int boardId, @PathVariable("viewId") final String viewIdStr, @PathVariable("filterId") final String filterId, @PathVariable("parameterName") final String parameterName) {
    userSession.assertLoggedIn();
    final ViewId viewId = ViewId.ofViewIdString(viewIdStr);
    return viewsRepo.getView(viewId).getFilterParameterDropdown(filterId, parameterName, userSession.toEvaluatee()).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : ViewId(de.metas.ui.web.view.ViewId) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 5 with JSONLookupValuesList

use of de.metas.ui.web.window.datatypes.json.JSONLookupValuesList in project metasfresh-webui-api by metasfresh.

the class ProcessRestController method getParameterDropdown.

@RequestMapping(value = "/{processId}/{pinstanceId}/field/{parameterName}/dropdown", method = RequestMethod.GET)
public JSONLookupValuesList getParameterDropdown(// 
@PathVariable("processId") final String processIdStr, // 
@PathVariable("pinstanceId") final String pinstanceIdStr, // 
@PathVariable("parameterName") final String parameterName) {
    userSession.assertLoggedIn();
    final ProcessId processId = ProcessId.fromJson(processIdStr);
    final DocumentId pinstanceId = DocumentId.of(pinstanceIdStr);
    final IProcessInstancesRepository instancesRepository = getRepository(processId);
    return instancesRepository.forProcessInstanceReadonly(pinstanceId, processInstance -> processInstance.getParameterLookupValues(parameterName)).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) WebRequest(org.springframework.web.context.request.WebRequest) Env(org.compiere.util.Env) Autowired(org.springframework.beans.factory.annotation.Autowired) DocumentCollection(de.metas.ui.web.window.model.DocumentCollection) OpenReportAction(de.metas.ui.web.process.ProcessInstanceResult.OpenReportAction) ReasonSupplier(de.metas.ui.web.window.model.IDocumentChangesCollector.ReasonSupplier) IView(de.metas.ui.web.view.IView) ProcessDescriptor(de.metas.ui.web.process.descriptor.ProcessDescriptor) Util(org.compiere.util.Util) HttpHeaders(org.springframework.http.HttpHeaders) NonNull(lombok.NonNull) Collection(java.util.Collection) MediaType(org.springframework.http.MediaType) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) UserSession(de.metas.ui.web.session.UserSession) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException) List(java.util.List) Stream(java.util.stream.Stream) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) JSONDocument(de.metas.ui.web.window.datatypes.json.JSONDocument) JSONProcessLayout(de.metas.ui.web.process.json.JSONProcessLayout) IViewsRepository(de.metas.ui.web.view.IViewsRepository) LogManager(de.metas.logging.LogManager) JSONProcessInstanceResult(de.metas.ui.web.process.json.JSONProcessInstanceResult) JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) WebConfig(de.metas.ui.web.config.WebConfig) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) Execution(de.metas.ui.web.window.controller.Execution) JSONDocumentChangedEvent(de.metas.ui.web.window.datatypes.json.JSONDocumentChangedEvent) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) NullDocumentChangesCollector(de.metas.ui.web.window.model.NullDocumentChangesCollector) RequestBody(org.springframework.web.bind.annotation.RequestBody) JSONCreateProcessInstanceRequest(de.metas.ui.web.process.json.JSONCreateProcessInstanceRequest) JSONProcessInstance(de.metas.ui.web.process.json.JSONProcessInstance) Api(io.swagger.annotations.Api) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) ViewRowIdsSelection(de.metas.ui.web.view.ViewRowIdsSelection) Logger(org.slf4j.Logger) ETagResponseEntityBuilder(de.metas.ui.web.cache.ETagResponseEntityBuilder) ApplicationContext(org.springframework.context.ApplicationContext) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) HttpStatus(org.springframework.http.HttpStatus) Check(org.adempiere.util.Check) ResponseEntity(org.springframework.http.ResponseEntity) ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JSONLookupValuesList (de.metas.ui.web.window.datatypes.json.JSONLookupValuesList)10 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)8 GetMapping (org.springframework.web.bind.annotation.GetMapping)8 WebConfig (de.metas.ui.web.config.WebConfig)4 UserSession (de.metas.ui.web.session.UserSession)4 ViewId (de.metas.ui.web.view.ViewId)4 Execution (de.metas.ui.web.window.controller.Execution)4 JSONDocument (de.metas.ui.web.window.datatypes.json.JSONDocument)4 JSONDocumentChangedEvent (de.metas.ui.web.window.datatypes.json.JSONDocumentChangedEvent)4 JSONOptions (de.metas.ui.web.window.datatypes.json.JSONOptions)4 IDocumentChangesCollector (de.metas.ui.web.window.model.IDocumentChangesCollector)4 Api (io.swagger.annotations.Api)4 List (java.util.List)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 PathVariable (org.springframework.web.bind.annotation.PathVariable)3 RequestBody (org.springframework.web.bind.annotation.RequestBody)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 RequestParam (org.springframework.web.bind.annotation.RequestParam)3 RestController (org.springframework.web.bind.annotation.RestController)3 LogManager (de.metas.logging.LogManager)2