use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class HUsToPickViewBasedProcess method getSingleSelectedPackageableRow.
protected final PackageableRow getSingleSelectedPackageableRow() {
final PickingSlotView pickingSlotView = getPickingSlotView();
final ViewId packageablesViewId = pickingSlotView.getParentViewId();
if (packageablesViewId == null) {
throw new AdempiereException("Packageables view is not available");
}
final DocumentId packageableRowId = pickingSlotView.getParentRowId();
if (packageableRowId == null) {
throw new AdempiereException("There is no single packageable row selected");
}
final PackageableView packageableView = PackageableView.cast(viewsRepo.getView(packageablesViewId));
return packageableView.getById(packageableRowId);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class HUsToPickViewBasedProcess method getPickingSlotRow.
protected PickingSlotRow getPickingSlotRow() {
final HUEditorView huView = getView();
final DocumentId pickingSlotRowId = huView.getParentRowId();
final PickingSlotView pickingSlotView = getPickingSlotView();
return pickingSlotView.getById(pickingSlotRowId);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class MenuTree method getTopLevelMenuGroupOrNull.
public MenuNode getTopLevelMenuGroupOrNull(final WindowId windowId) {
final DocumentId elementId = windowId.toDocumentId();
final MenuNode node = getFirstNodeByElementIdOrNull(MenuNodeType.Window, elementId);
if (node == null) {
return null;
}
final List<MenuNode> path = getPath(node);
// NOTE: the top level menu group is at index "1" because on index "0" we have the menu root node.
if (path.size() < 2) {
return null;
}
return path.get(1);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class MenuTree method getNewRecordNodeForWindowId.
public Optional<MenuNode> getNewRecordNodeForWindowId(final WindowId windowId) {
final DocumentId elementId = windowId.toDocumentId();
final ArrayKey key = mkTypeAndElementIdKey(MenuNodeType.NewRecord, elementId);
final List<MenuNode> nodes = nodesByTypeAndElementId.get(key);
if (nodes == null || nodes.isEmpty()) {
return Optional.empty();
}
final MenuNode newRecordNode = nodes.get(0);
return Optional.of(newRecordNode);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class MenuRestController method getPath.
@GetMapping("/elementPath")
public JSONMenuNode getPath(@RequestParam(name = PARAM_Type, required = true) final JSONMenuNodeType jsonType, @RequestParam(name = PARAM_ElementId, required = true) final String elementIdStr, @RequestParam(name = PARAM_IncludeLastNode, required = false, defaultValue = "false") @ApiParam("Shall we include the last node") final boolean includeLastNode) {
userSession.assertLoggedIn();
final MenuNodeType menuNodeType = jsonType.toMenuNodeType();
final DocumentId elementId = DocumentId.of(elementIdStr);
final List<MenuNode> path = getMenuTree().getPath(menuNodeType, elementId).orElseGet(() -> getPathOfMissingElement(menuNodeType, elementId, userSession.getAD_Language()));
final boolean skipRootNode = true;
return JSONMenuNode.ofPath(path, skipRootNode, includeLastNode, menuTreeRepository);
}
Aggregations