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;
}
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);
}
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());
}
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());
}
}
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);
}
Aggregations