Search in sources :

Example 36 with DocumentId

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);
}
Also used : PickingSlotView(de.metas.ui.web.picking.pickingslot.PickingSlotView) AdempiereException(org.adempiere.exceptions.AdempiereException) PackageableView(de.metas.ui.web.picking.packageable.PackageableView) ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 37 with DocumentId

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);
}
Also used : PickingSlotView(de.metas.ui.web.picking.pickingslot.PickingSlotView) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView)

Example 38 with DocumentId

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);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 39 with DocumentId

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);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) ArrayKey(org.compiere.util.Util.ArrayKey)

Example 40 with DocumentId

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);
}
Also used : MenuNodeType(de.metas.ui.web.menu.MenuNode.MenuNodeType) JSONMenuNodeType(de.metas.ui.web.menu.datatypes.json.JSONMenuNodeType) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONMenuNode(de.metas.ui.web.menu.datatypes.json.JSONMenuNode) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

DocumentId (de.metas.ui.web.window.datatypes.DocumentId)99 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)18 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)14 List (java.util.List)14 ImmutableList (com.google.common.collect.ImmutableList)12 GetMapping (org.springframework.web.bind.annotation.GetMapping)12 AdempiereException (org.adempiere.exceptions.AdempiereException)11 JSONLookupValuesList (de.metas.ui.web.window.datatypes.json.JSONLookupValuesList)9 ArrayList (java.util.ArrayList)9 Set (java.util.Set)9 NonNull (lombok.NonNull)9 Test (org.junit.Test)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 UserSession (de.metas.ui.web.session.UserSession)8 ViewId (de.metas.ui.web.view.ViewId)8 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)8 Document (de.metas.ui.web.window.model.Document)8 IDocumentChangesCollector (de.metas.ui.web.window.model.IDocumentChangesCollector)8 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)8 Autowired (org.springframework.beans.factory.annotation.Autowired)8