use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class WindowQuickInputRestController method getLayout.
@GetMapping("/layout")
public JSONQuickInputLayoutDescriptor getLayout(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentIdStr_NOTUSED, //
@PathVariable("tabId") final String tabIdStr) {
userSession.assertLoggedIn();
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentEntityDescriptor includedDocumentDescriptor = documentsCollection.getDocumentEntityDescriptor(windowId).getIncludedEntityByDetailId(DetailId.fromJson(tabIdStr));
final QuickInputDescriptor quickInputDescriptor = quickInputDescriptors.getQuickInputEntityDescriptor(includedDocumentDescriptor);
if (quickInputDescriptor == null) {
return null;
}
final QuickInputLayoutDescriptor layout = quickInputDescriptor.getLayout();
return JSONQuickInputLayoutDescriptor.fromNullable(layout, newJSONOptions());
}
use of de.metas.ui.web.window.datatypes.WindowId 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.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class SqlViewFactory method makeViewInvalidationAdvisorsMap.
private ImmutableMap<WindowId, IViewInvalidationAdvisor> makeViewInvalidationAdvisorsMap(final List<IViewInvalidationAdvisor> viewInvalidationAdvisors) {
try {
return Maps.uniqueIndex(viewInvalidationAdvisors, advisor -> {
final WindowId windowId = advisor.getWindowId();
Check.assumeNotNull(windowId, "windowId shall not be null for {}", advisor);
return windowId;
});
} catch (IllegalArgumentException e) {
final String message = "The given collection of " + IViewInvalidationAdvisor.class + " implementors contains more than one element with the same window-id";
throw new AdempiereException(message, e).setParameter("viewInvalidationAdvisors", viewInvalidationAdvisors).appendParametersToMessage();
}
}
use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class SqlViewFactory method createViewBinding.
private SqlViewBinding createViewBinding(@NonNull final SqlViewBindingKey key) {
final WindowId windowId = key.getWindowId();
final DocumentEntityDescriptor entityDescriptor = documentDescriptorFactory.getDocumentEntityDescriptor(windowId);
final Set<String> displayFieldNames = entityDescriptor.getFieldNamesWithCharacteristic(key.getRequiredFieldCharacteristic());
final SqlDocumentEntityDataBindingDescriptor entityBinding = SqlDocumentEntityDataBindingDescriptor.cast(entityDescriptor.getDataBinding());
final DocumentFilterDescriptorsProvider filterDescriptors = entityDescriptor.getFilterDescriptors();
final SqlViewBinding.Builder builder = createBuilderForEntityBindingAndFieldNames(entityBinding, displayFieldNames).filterDescriptors(filterDescriptors).viewInvalidationAdvisor(getViewInvalidationAdvisor(windowId));
if (windowId2SqlDocumentFilterConverterDecorator.containsKey(windowId)) {
builder.filterConverterDecorator(windowId2SqlDocumentFilterConverterDecorator.get(windowId));
}
final SqlViewCustomizer sqlViewCustomizer = getSqlViewCustomizer(windowId, key.getProfileId());
if (sqlViewCustomizer != null) {
final ViewRowCustomizer rowCustomizer = sqlViewCustomizer;
builder.rowCustomizer(rowCustomizer);
sqlViewCustomizer.customizeSqlViewBinding(builder);
}
return builder.build();
}
use of de.metas.ui.web.window.datatypes.WindowId in project metasfresh-webui-api by metasfresh.
the class WindowRestController method deleteIncludedDocument.
@DeleteMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> deleteIncludedDocument(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentId, //
@PathVariable("tabId") final String tabId, //
@PathVariable("rowId") final String rowId) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentId, tabId, rowId);
return deleteDocuments(ImmutableList.of(documentPath));
}
Aggregations