Search in sources :

Example 1 with DocumentEntityDescriptor

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();
}
Also used : IMsgBL(de.metas.i18n.IMsgBL) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)

Example 2 with DocumentEntityDescriptor

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);
}
Also used : QuickInputLayoutDescriptor(de.metas.ui.web.quickinput.QuickInputLayoutDescriptor) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)

Example 3 with DocumentEntityDescriptor

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());
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) JSONQuickInputLayoutDescriptor(de.metas.ui.web.window.datatypes.json.JSONQuickInputLayoutDescriptor) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 4 with DocumentEntityDescriptor

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);
}
Also used : QuickInputLayoutDescriptor(de.metas.ui.web.quickinput.QuickInputLayoutDescriptor) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)

Example 5 with DocumentEntityDescriptor

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();
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) SqlDocumentEntityDataBindingDescriptor(de.metas.ui.web.window.descriptor.sql.SqlDocumentEntityDataBindingDescriptor) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) DocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.DocumentFilterDescriptorsProvider)

Aggregations

DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)33 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)9 WindowId (de.metas.ui.web.window.datatypes.WindowId)8 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)7 ArrayList (java.util.ArrayList)5 NonNull (lombok.NonNull)5 AdempiereException (org.adempiere.exceptions.AdempiereException)5 Services (org.adempiere.util.Services)5 ImmutableList (com.google.common.collect.ImmutableList)4 IMsgBL (de.metas.i18n.IMsgBL)4 ProcessId (de.metas.ui.web.process.ProcessId)4 QuickInputLayoutDescriptor (de.metas.ui.web.quickinput.QuickInputLayoutDescriptor)4 ViewId (de.metas.ui.web.view.ViewId)4 SqlDocumentEntityDataBindingDescriptor (de.metas.ui.web.window.descriptor.sql.SqlDocumentEntityDataBindingDescriptor)4 Document (de.metas.ui.web.window.model.Document)4 List (java.util.List)4 Env (org.compiere.util.Env)4 ITranslatableString (de.metas.i18n.ITranslatableString)3 SourceDocument (de.metas.letters.model.MADBoilerPlate.SourceDocument)3 EntityNotFoundException (de.metas.ui.web.exceptions.EntityNotFoundException)3