use of de.metas.ui.web.window.descriptor.DocumentEntityDescriptor in project metasfresh-webui-api by metasfresh.
the class InvoiceLineQuickInputDescriptorFactory method createEntityDescriptor.
private DocumentEntityDescriptor createEntityDescriptor(final DocumentType documentType, final DocumentId documentTypeId, final DetailId detailId, @NonNull final Optional<Boolean> soTrx) {
final IMsgBL msgBL = Services.get(IMsgBL.class);
final DocumentEntityDescriptor.Builder entityDescriptor = DocumentEntityDescriptor.builder().setDocumentType(DocumentType.QuickInput, documentTypeId).setIsSOTrx(soTrx).disableDefaultTableCallouts().setDetailId(detailId);
entityDescriptor.addField(DocumentFieldDescriptor.builder(IInvoiceLineQuickInput.COLUMNNAME_M_Product_ID).setCaption(msgBL.translatable(IInvoiceLineQuickInput.COLUMNNAME_M_Product_ID)).setWidgetType(DocumentFieldWidgetType.Lookup).setLookupDescriptorProvider(ProductLookupDescriptor.builderWithoutStockInfo().bpartnerParamName(I_C_Invoice.COLUMNNAME_C_BPartner_ID).pricingDateParamName(I_C_Invoice.COLUMNNAME_DateInvoiced).build()).setMandatoryLogic(true).setDisplayLogic(ConstantLogicExpression.TRUE).addCharacteristic(Characteristic.PublicField));
entityDescriptor.addField(DocumentFieldDescriptor.builder(IInvoiceLineQuickInput.COLUMNNAME_Qty).setCaption(msgBL.translatable(IInvoiceLineQuickInput.COLUMNNAME_Qty)).setWidgetType(DocumentFieldWidgetType.Quantity).setMandatoryLogic(true).addCharacteristic(Characteristic.PublicField));
return entityDescriptor.build();
}
use of de.metas.ui.web.window.descriptor.DocumentEntityDescriptor in project metasfresh-webui-api by metasfresh.
the class InvoiceLineQuickInputDescriptorFactory method createQuickInputEntityDescriptor.
@Override
public QuickInputDescriptor createQuickInputEntityDescriptor(final DocumentType documentType, final DocumentId documentTypeId, final DetailId detailId, @NonNull final Optional<Boolean> soTrx) {
final DocumentEntityDescriptor entityDescriptor = createEntityDescriptor(documentType, documentTypeId, detailId, soTrx);
final QuickInputLayoutDescriptor layout = createLayout(entityDescriptor);
return QuickInputDescriptor.of(entityDescriptor, layout, InvoiceLineQuickInputProcessor.class);
}
use of de.metas.ui.web.window.descriptor.DocumentEntityDescriptor 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.descriptor.DocumentEntityDescriptor in project metasfresh-webui-api by metasfresh.
the class EmptiesQuickInputDescriptorFactory method createQuickInputEntityDescriptor.
@Override
public QuickInputDescriptor createQuickInputEntityDescriptor(final DocumentType documentType, final DocumentId documentTypeId, final DetailId detailId, @NonNull final Optional<Boolean> soTrx) {
final DocumentEntityDescriptor entityDescriptor = createEntityDescriptor(documentTypeId, detailId, soTrx);
final QuickInputLayoutDescriptor layout = createLayout(entityDescriptor);
return QuickInputDescriptor.of(entityDescriptor, layout, EmptiesQuickInputProcessor.class);
}
use of de.metas.ui.web.window.descriptor.DocumentEntityDescriptor 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();
}
Aggregations