Search in sources :

Example 1 with RowEditingContext

use of de.metas.ui.web.view.IEditableView.RowEditingContext in project metasfresh-webui-api by metasfresh.

the class ViewRowEditRestController method patchRow.

@PatchMapping
public JSONViewRow patchRow(@PathVariable(PARAM_WindowId) final String windowIdStr, @PathVariable(PARAM_ViewId) final String viewIdStr, @PathVariable(PARAM_RowId) final String rowIdStr, @RequestBody final List<JSONDocumentChangedEvent> fieldChangeRequests) {
    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);
    view.patchViewRow(editingCtx, fieldChangeRequests);
    final IViewRow row = view.getById(rowId);
    final IViewRowOverrides rowOverrides = ViewRowOverridesHelper.getViewRowOverrides(view);
    return JSONViewRow.ofRow(row, rowOverrides, userSession.getAD_Language());
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RowEditingContext(de.metas.ui.web.view.IEditableView.RowEditingContext) PatchMapping(org.springframework.web.bind.annotation.PatchMapping)

Example 2 with RowEditingContext

use of de.metas.ui.web.view.IEditableView.RowEditingContext 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 3 with RowEditingContext

use of de.metas.ui.web.view.IEditableView.RowEditingContext 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

RowEditingContext (de.metas.ui.web.view.IEditableView.RowEditingContext)3 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)3 JSONLookupValuesList (de.metas.ui.web.window.datatypes.json.JSONLookupValuesList)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 PatchMapping (org.springframework.web.bind.annotation.PatchMapping)1