Search in sources :

Example 1 with DetailId

use of de.metas.ui.web.window.descriptor.DetailId in project metasfresh-webui-api by metasfresh.

the class QuickInputDescriptorFactoryService method hasQuickInputEntityDescriptor.

public boolean hasQuickInputEntityDescriptor(@NonNull final DocumentEntityDescriptor includedDocumentDescriptor) {
    final DocumentType documentType = includedDocumentDescriptor.getDocumentType();
    final DocumentId documentTypeId = includedDocumentDescriptor.getDocumentTypeId();
    final String tableName = includedDocumentDescriptor.getTableNameOrNull();
    final DetailId detailId = includedDocumentDescriptor.getDetailId();
    final Optional<Boolean> soTrx = includedDocumentDescriptor.getIsSOTrx();
    return getQuickInputEntityDescriptorOrNull(documentType, documentTypeId, tableName, detailId, soTrx) != null;
}
Also used : DetailId(de.metas.ui.web.window.descriptor.DetailId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) DocumentType(de.metas.ui.web.window.datatypes.DocumentType)

Example 2 with DetailId

use of de.metas.ui.web.window.descriptor.DetailId in project metasfresh-webui-api by metasfresh.

the class QuickInputPath method of.

public static final // 
QuickInputPath of(// 
final String windowIdStr, // 
final String documentIdStr, // 
final String tabIdStr, // 
final String quickInputIdStr) {
    final DocumentPath rootDocumentPath = DocumentPath.rootDocumentPath(WindowId.fromJson(windowIdStr), documentIdStr);
    final DetailId detailId = DetailId.fromJson(tabIdStr);
    final DocumentId quickInputId = DocumentId.of(quickInputIdStr);
    return new QuickInputPath(rootDocumentPath, detailId, quickInputId);
}
Also used : DetailId(de.metas.ui.web.window.descriptor.DetailId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath)

Example 3 with DetailId

use of de.metas.ui.web.window.descriptor.DetailId in project metasfresh-webui-api by metasfresh.

the class JSONCreateProcessInstanceRequest method createSelectedIncludedDocumentPaths.

private static final List<DocumentPath> createSelectedIncludedDocumentPaths(final WindowId windowId, final String documentIdStr, final JSONSelectedIncludedTab selectedTab) {
    if (windowId == null || Check.isEmpty(documentIdStr, true) || selectedTab == null) {
        return ImmutableList.of();
    }
    final DocumentId documentId = DocumentId.of(documentIdStr);
    final DetailId selectedTabId = DetailId.fromJson(selectedTab.getTabId());
    return selectedTab.getRowIds().stream().map(DocumentId::of).map(rowId -> DocumentPath.includedDocumentPath(windowId, documentId, selectedTabId, rowId)).collect(ImmutableList.toImmutableList());
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) ViewRowIdsSelection(de.metas.ui.web.view.ViewRowIdsSelection) ImmutableSet(com.google.common.collect.ImmutableSet) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) NonNull(lombok.NonNull) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) Set(java.util.Set) Visibility(com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility) MoreObjects(com.google.common.base.MoreObjects) WindowId(de.metas.ui.web.window.datatypes.WindowId) JsonAutoDetect(com.fasterxml.jackson.annotation.JsonAutoDetect) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ProcessId(de.metas.ui.web.process.ProcessId) Check(de.metas.printing.esb.base.util.Check) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) DetailId(de.metas.ui.web.window.descriptor.DetailId) Data(lombok.Data) JsonInclude(com.fasterxml.jackson.annotation.JsonInclude) ViewId(de.metas.ui.web.view.ViewId) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) DetailId(de.metas.ui.web.window.descriptor.DetailId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 4 with DetailId

use of de.metas.ui.web.window.descriptor.DetailId in project metasfresh-webui-api by metasfresh.

the class JSONCreateViewRequest method getReferencingDocumentPaths.

public Set<DocumentPath> getReferencingDocumentPaths() {
    if (referencing == null) {
        return ImmutableSet.of();
    }
    final Set<String> documentIds = referencing.getDocumentIds();
    if (documentIds == null || documentIds.isEmpty()) {
        return ImmutableSet.of();
    }
    final WindowId windowId = WindowId.fromJson(referencing.getDocumentType());
    final String tabIdStr = referencing.getTabId();
    if (tabIdStr == null) {
        return documentIds.stream().map(id -> DocumentPath.rootDocumentPath(windowId, id)).collect(ImmutableSet.toImmutableSet());
    } else {
        final DocumentId documentId = DocumentId.of(ListUtils.singleElement(documentIds));
        final DetailId tabId = DetailId.fromJson(tabIdStr);
        final Set<String> rowIds = referencing.getRowIds();
        return rowIds.stream().map(DocumentId::of).map(rowId -> DocumentPath.includedDocumentPath(windowId, documentId, tabId, rowId)).collect(ImmutableSet.toImmutableSet());
    }
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) ImmutableSet(com.google.common.collect.ImmutableSet) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) ViewProfileId(de.metas.ui.web.view.ViewProfileId) Set(java.util.Set) Visibility(com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility) WindowId(de.metas.ui.web.window.datatypes.WindowId) JsonAutoDetect(com.fasterxml.jackson.annotation.JsonAutoDetect) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ListUtils(org.adempiere.util.collections.ListUtils) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) DetailId(de.metas.ui.web.window.descriptor.DetailId) JsonInclude(com.fasterxml.jackson.annotation.JsonInclude) Preconditions(com.google.common.base.Preconditions) JSONDocumentFilter(de.metas.ui.web.document.filter.json.JSONDocumentFilter) DetailId(de.metas.ui.web.window.descriptor.DetailId) WindowId(de.metas.ui.web.window.datatypes.WindowId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 5 with DetailId

use of de.metas.ui.web.window.descriptor.DetailId in project metasfresh-webui-api by metasfresh.

the class WindowRestController method getDocumentActions.

@GetMapping("/{windowId}/{documentId}/actions")
public JSONDocumentActionsList getDocumentActions(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentId, @RequestParam(name = "selectedTabId", required = false) final String selectedTabIdStr, @RequestParam(name = "selectedRowIds", required = false) final String selectedRowIdsAsStr, @RequestParam(name = "disabled", defaultValue = "false") final boolean returnDisabled) {
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentId);
    final DetailId selectedTabId = DetailId.fromJson(selectedTabIdStr);
    final DocumentIdsSelection selectedRowIds = DocumentIdsSelection.ofCommaSeparatedString(selectedRowIdsAsStr);
    final Set<TableRecordReference> selectedIncludedRecords = selectedRowIds.stream().map(rowId -> documentPath.createChildPath(selectedTabId, rowId)).map(documentCollection::getTableRecordReference).collect(ImmutableSet.toImmutableSet());
    return getDocumentActions(documentPath, selectedIncludedRecords, returnDisabled);
}
Also used : DetailId(de.metas.ui.web.window.descriptor.DetailId) WindowId(de.metas.ui.web.window.datatypes.WindowId) TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

DetailId (de.metas.ui.web.window.descriptor.DetailId)11 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)6 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)5 WindowId (de.metas.ui.web.window.datatypes.WindowId)5 JsonAutoDetect (com.fasterxml.jackson.annotation.JsonAutoDetect)2 Visibility (com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility)2 JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)2 JsonInclude (com.fasterxml.jackson.annotation.JsonInclude)2 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)2 DocumentType (de.metas.ui.web.window.datatypes.DocumentType)2 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)2 List (java.util.List)2 Set (java.util.Set)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 MoreObjects (com.google.common.base.MoreObjects)1 Preconditions (com.google.common.base.Preconditions)1