use of de.metas.ui.web.view.descriptor.ViewLayout in project metasfresh-webui-api by metasfresh.
the class ViewRestController method getViewLayout.
@GetMapping("/layout")
public ResponseEntity<JSONViewLayout> getViewLayout(@PathVariable(PARAM_WindowId) final String windowIdStr, @RequestParam(name = PARAM_ViewDataType, required = true) final JSONViewDataType viewDataType, @RequestParam(name = "profileId", required = false) final String profileIdStr, final WebRequest request) {
userSession.assertLoggedIn();
final WindowId windowId = WindowId.fromJson(windowIdStr);
final ViewLayout viewLayout = viewsRepo.getViewLayout(windowId, viewDataType, ViewProfileId.fromJson(profileIdStr));
return ETagResponseEntityBuilder.ofETagAware(request, viewLayout).includeLanguageInETag().cacheMaxAge(userSession.getHttpCacheMaxAge()).jsonOptions(() -> newJSONOptions()).toJson(JSONViewLayout::of);
}
use of de.metas.ui.web.view.descriptor.ViewLayout in project metasfresh-webui-api by metasfresh.
the class SqlViewFactory method createViewLayout.
private ViewLayout createViewLayout(final SqlViewBindingKey sqlViewBindingKey, final JSONViewDataType viewDataType) {
final ViewLayout viewLayoutOrig = documentDescriptorFactory.getDocumentDescriptor(sqlViewBindingKey.getWindowId()).getViewLayout(viewDataType);
final SqlViewBinding sqlViewBinding = getViewBinding(sqlViewBindingKey);
final Collection<DocumentFilterDescriptor> filters = sqlViewBinding.getViewFilterDescriptors().getAll();
final boolean hasTreeSupport = sqlViewBinding.hasGroupingFields();
final ViewLayout.ChangeBuilder viewLayoutBuilder = viewLayoutOrig.toBuilder().profileId(sqlViewBindingKey.getProfileId()).filters(filters).treeSupport(hasTreeSupport, true, /* treeCollapsible */
ViewLayout.TreeExpandedDepth_AllCollapsed);
final SqlViewCustomizer sqlViewCustomizer = getSqlViewCustomizer(sqlViewBindingKey.getWindowId(), sqlViewBindingKey.getProfileId());
if (sqlViewCustomizer != null) {
sqlViewCustomizer.customizeViewLayout(viewLayoutBuilder);
}
return viewLayoutBuilder.build();
}
use of de.metas.ui.web.view.descriptor.ViewLayout in project metasfresh-webui-api by metasfresh.
the class BoardRestController method getNewCardsViewLayout.
@GetMapping("/{boardId}/newCardsView/layout")
public JSONNewCardsViewLayout getNewCardsViewLayout(@PathVariable("boardId") final int boardId) {
userSession.assertLoggedIn();
final BoardDescriptor boardDescriptor = boardsRepo.getBoardDescriptor(boardId);
final ViewLayout documentsViewLayout = viewsRepo.getViewLayout(boardDescriptor.getDocumentWindowId(), JSONViewDataType.list, ViewProfileId.NULL);
final JSONOptions jsonOpts = newJSONOptions();
final String adLanguage = jsonOpts.getAD_Language();
return JSONNewCardsViewLayout.builder().caption(documentsViewLayout.getCaption(adLanguage)).description(documentsViewLayout.getDescription(adLanguage)).emptyResultHint(documentsViewLayout.getEmptyResultHint(adLanguage)).emptyResultText(documentsViewLayout.getEmptyResultText(adLanguage)).filters(JSONDocumentFilterDescriptor.ofCollection(documentsViewLayout.getFilters(), jsonOpts)).orderBys(boardDescriptor.getCardFields().stream().map(cardField -> JSONBoardCardOrderBy.builder().fieldName(cardField.getFieldName()).caption(cardField.getCaption().translate(adLanguage)).build()).collect(ImmutableList.toImmutableList())).build();
}
Aggregations