Search in sources :

Example 6 with JSONLookupValuesList

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

the class ASIRestController method getAttributeTypeahead.

@GetMapping("/{asiDocId}/field/{attributeName}/typeahead")
public JSONLookupValuesList getAttributeTypeahead(// 
@PathVariable("asiDocId") final String asiDocIdStr, // 
@PathVariable("attributeName") final String attributeName, // 
@RequestParam(name = "query", required = true) final String query) {
    userSession.assertLoggedIn();
    final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
    return asiRepo.forASIDocumentReadonly(asiDocId, asiDoc -> asiDoc.getFieldLookupValuesForQuery(attributeName, query)).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) PathVariable(org.springframework.web.bind.annotation.PathVariable) PostMapping(org.springframework.web.bind.annotation.PostMapping) RequestParam(org.springframework.web.bind.annotation.RequestParam) WebConfig(de.metas.ui.web.config.WebConfig) 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) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) JSONCreateASIRequest(de.metas.ui.web.pattribute.json.JSONCreateASIRequest) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) PatchMapping(org.springframework.web.bind.annotation.PatchMapping) RequestBody(org.springframework.web.bind.annotation.RequestBody) UserSession(de.metas.ui.web.session.UserSession) List(java.util.List) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) GetMapping(org.springframework.web.bind.annotation.GetMapping) JSONASILayout(de.metas.ui.web.pattribute.json.JSONASILayout) Api(io.swagger.annotations.Api) JSONDocument(de.metas.ui.web.window.datatypes.json.JSONDocument) JSONLookupValue(de.metas.ui.web.window.datatypes.json.JSONLookupValue) 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 7 with JSONLookupValuesList

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

the class ASIRestController method getAttributeDropdown.

@GetMapping("/{asiDocId}/field/{attributeName}/dropdown")
public JSONLookupValuesList getAttributeDropdown(// 
@PathVariable("asiDocId") final String asiDocIdStr, // 
@PathVariable("attributeName") final String attributeName) {
    userSession.assertLoggedIn();
    final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
    return asiRepo.forASIDocumentReadonly(asiDocId, asiDoc -> asiDoc.getFieldLookupValues(attributeName)).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) PathVariable(org.springframework.web.bind.annotation.PathVariable) PostMapping(org.springframework.web.bind.annotation.PostMapping) RequestParam(org.springframework.web.bind.annotation.RequestParam) WebConfig(de.metas.ui.web.config.WebConfig) 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) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) JSONCreateASIRequest(de.metas.ui.web.pattribute.json.JSONCreateASIRequest) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) PatchMapping(org.springframework.web.bind.annotation.PatchMapping) RequestBody(org.springframework.web.bind.annotation.RequestBody) UserSession(de.metas.ui.web.session.UserSession) List(java.util.List) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) GetMapping(org.springframework.web.bind.annotation.GetMapping) JSONASILayout(de.metas.ui.web.pattribute.json.JSONASILayout) Api(io.swagger.annotations.Api) JSONDocument(de.metas.ui.web.window.datatypes.json.JSONDocument) JSONLookupValue(de.metas.ui.web.window.datatypes.json.JSONLookupValue) 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 8 with JSONLookupValuesList

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

the class ViewRowAttributesRestController method getAttributeTypeahead.

@GetMapping("/attribute/{attributeName}/typeahead")
public JSONLookupValuesList getAttributeTypeahead(// 
@PathVariable(PARAM_WindowId) final String windowIdStr, // 
@PathVariable(PARAM_ViewId) final String viewIdStr, // 
@PathVariable(PARAM_RowId) final String rowIdStr, // 
@PathVariable("attributeName") final String attributeName, // 
@RequestParam(name = "query", required = true) final String query) {
    userSession.assertLoggedIn();
    final ViewId viewId = ViewId.of(windowIdStr, viewIdStr);
    final DocumentId rowId = DocumentId.of(rowIdStr);
    return viewsRepo.getView(viewId).getById(rowId).getAttributes().getAttributeTypeahead(attributeName, query).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 9 with JSONLookupValuesList

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

the class ViewRowEditRestController method getFieldTypeahead.

@GetMapping("/{fieldName}/typeahead")
public JSONLookupValuesList getFieldTypeahead(@PathVariable(PARAM_WindowId) final String windowIdStr, @PathVariable(PARAM_ViewId) final String viewIdStr, @PathVariable(PARAM_RowId) final String rowIdStr, @PathVariable(PARAM_FieldName) final String fieldName, @RequestParam("query") final String query) {
    userSession.assertLoggedIn();
    final ViewId viewId = ViewId.of(windowIdStr, viewIdStr);
    final DocumentId rowId = DocumentId.of(rowIdStr);
    final IEditableView view = getEditableView(viewId);
    final RowEditingContext editingCtx = createRowEditingContext(rowId);
    return view.getFieldTypeahead(editingCtx, fieldName, query).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RowEditingContext(de.metas.ui.web.view.IEditableView.RowEditingContext) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 10 with JSONLookupValuesList

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

the class ViewRowEditRestController method getFieldDropdown.

@GetMapping("/{fieldName}/dropdown")
public JSONLookupValuesList getFieldDropdown(@PathVariable(PARAM_WindowId) final String windowIdStr, @PathVariable(PARAM_ViewId) final String viewIdStr, @PathVariable(PARAM_RowId) final String rowIdStr, @PathVariable(PARAM_FieldName) final String fieldName) {
    userSession.assertLoggedIn();
    final ViewId viewId = ViewId.of(windowIdStr, viewIdStr);
    final DocumentId rowId = DocumentId.of(rowIdStr);
    final IEditableView view = getEditableView(viewId);
    final RowEditingContext editingCtx = createRowEditingContext(rowId);
    return view.getFieldDropdown(editingCtx, fieldName).transform(JSONLookupValuesList::ofLookupValuesList);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RowEditingContext(de.metas.ui.web.view.IEditableView.RowEditingContext) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

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