Search in sources :

Example 1 with AdTabId

use of org.adempiere.ad.element.api.AdTabId in project metasfresh-webui-api by metasfresh.

the class UserQueryDocumentFilterDescriptorsProviderFactory method createFiltersProvider.

@Override
public DocumentFilterDescriptorsProvider createFiltersProvider(@Nullable final AdTabId adTabId, @Nullable final String tableName, final Collection<DocumentFieldDescriptor> fields) {
    if (tableName == null || adTabId == null) {
        return NullDocumentFilterDescriptorsProvider.instance;
    }
    Check.assumeNotEmpty(tableName, "tableName is not empty");
    final int adTableId = adTablesRepo.retrieveTableId(tableName);
    final List<IUserQueryField> searchFields = fields.stream().map(field -> createUserQueryField(field)).collect(ImmutableList.toImmutableList());
    final UserQueryRepository repository = UserQueryRepository.builder().setAD_Tab_ID(adTabId.getRepoId()).setAD_Table_ID(adTableId).setAD_User_ID(// FIXME: hardcoded, see https://github.com/metasfresh/metasfresh-webui/issues/162
    UserId.METASFRESH.getRepoId()).setSearchFields(searchFields).setColumnDisplayTypeProvider(POInfo.getPOInfo(AdTableId.ofRepoId(adTableId))).build();
    return new UserQueryDocumentFilterDescriptorsProvider(repository);
}
Also used : UserId(de.metas.user.UserId) Check(de.metas.util.Check) Collection(java.util.Collection) NullDocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.NullDocumentFilterDescriptorsProvider) AdTableId(org.adempiere.ad.table.api.AdTableId) DocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.DocumentFilterDescriptorsProvider) DocumentFilterDescriptorsProviderFactory(de.metas.ui.web.document.filter.provider.DocumentFilterDescriptorsProviderFactory) Services(de.metas.util.Services) DocumentFieldDescriptor(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor) Component(org.springframework.stereotype.Component) List(java.util.List) AdTabId(org.adempiere.ad.element.api.AdTabId) ImmutableList(com.google.common.collect.ImmutableList) UserQueryRepository(org.compiere.apps.search.UserQueryRepository) IUserQueryField(org.compiere.apps.search.IUserQueryField) POInfo(org.compiere.model.POInfo) IADTableDAO(org.adempiere.ad.table.api.IADTableDAO) Nullable(javax.annotation.Nullable) IUserQueryField(org.compiere.apps.search.IUserQueryField) UserQueryRepository(org.compiere.apps.search.UserQueryRepository)

Example 2 with AdTabId

use of org.adempiere.ad.element.api.AdTabId in project metasfresh-webui-api by metasfresh.

the class ADProcessDescriptorsFactory method streamDocumentRelatedProcesses.

public Stream<WebuiRelatedProcessDescriptor> streamDocumentRelatedProcesses(@NonNull final WebuiPreconditionsContext preconditionsContext, @NonNull final IUserRolePermissions userRolePermissions) {
    final String tableName = preconditionsContext.getTableName();
    final int adTableId = !Check.isEmpty(tableName) ? adTableDAO.retrieveTableId(tableName) : -1;
    final AdWindowId adWindowId = preconditionsContext.getAdWindowId();
    final AdTabId adTabId = preconditionsContext.getAdTabId();
    final Stream<RelatedProcessDescriptor> relatedProcessDescriptors;
    {
        final Stream<RelatedProcessDescriptor> tableRelatedProcessDescriptors = adProcessDAO.retrieveRelatedProcessDescriptors(adTableId, adWindowId, adTabId).stream();
        final Stream<RelatedProcessDescriptor> additionalRelatedProcessDescriptors = preconditionsContext.getAdditionalRelatedProcessDescriptors().stream();
        relatedProcessDescriptors = Stream.concat(additionalRelatedProcessDescriptors, tableRelatedProcessDescriptors).collect(GuavaCollectors.distinctBy(RelatedProcessDescriptor::getProcessId));
    }
    return relatedProcessDescriptors.filter(relatedProcess -> isEligible(relatedProcess, preconditionsContext, userRolePermissions)).map(relatedProcess -> toWebuiRelatedProcessDescriptor(relatedProcess, preconditionsContext));
}
Also used : DisplayPlace(de.metas.process.RelatedProcessDescriptor.DisplayPlace) IExpression(org.adempiere.ad.expression.api.IExpression) DefaultValueExpressionsFactory(de.metas.ui.web.window.descriptor.factory.standard.DefaultValueExpressionsFactory) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) IRangeAwareParams(org.adempiere.util.api.IRangeAwareParams) GuavaCollectors(de.metas.util.GuavaCollectors) ProcessDescriptor(de.metas.ui.web.process.descriptor.ProcessDescriptor) IExpressionFactory(org.adempiere.ad.expression.api.IExpressionFactory) DateRangeValue(de.metas.ui.web.window.datatypes.DateRangeValue) NonNull(lombok.NonNull) RelatedProcessDescriptor(de.metas.process.RelatedProcessDescriptor) ConstantLogicExpression(org.adempiere.ad.expression.api.ConstantLogicExpression) JavaProcess(de.metas.process.JavaProcess) X_AD_Process(org.compiere.model.X_AD_Process) DocumentFieldDescriptor(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor) I_AD_Process(org.compiere.model.I_AD_Process) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException) Stream(java.util.stream.Stream) ProcessId(de.metas.ui.web.process.ProcessId) DocumentEntityDataBindingDescriptorBuilder(de.metas.ui.web.window.descriptor.DocumentEntityDataBindingDescriptor.DocumentEntityDataBindingDescriptorBuilder) Builder(lombok.Builder) IProcessPreconditionsContext(de.metas.process.IProcessPreconditionsContext) DocumentFieldWidgetType(de.metas.ui.web.window.descriptor.DocumentFieldWidgetType) Optional(java.util.Optional) ProcessParams(de.metas.process.ProcessParams) IADElementDAO(org.adempiere.ad.element.api.IADElementDAO) DocumentType(de.metas.ui.web.window.datatypes.DocumentType) IADTableDAO(org.adempiere.ad.table.api.IADTableDAO) LogManager(de.metas.logging.LogManager) TimeUtil(org.compiere.util.TimeUtil) LookupDescriptorProvider(de.metas.ui.web.window.descriptor.LookupDescriptorProvider) ILogicExpression(org.adempiere.ad.expression.api.ILogicExpression) SqlLookupDescriptor(de.metas.ui.web.window.descriptor.sql.SqlLookupDescriptor) I_AD_Process_Para(org.compiere.model.I_AD_Process_Para) Supplier(java.util.function.Supplier) ProcessDescriptorType(de.metas.ui.web.process.descriptor.ProcessDescriptor.ProcessDescriptorType) DescriptorsFactoryHelper(de.metas.ui.web.window.descriptor.factory.standard.DescriptorsFactoryHelper) IUserRolePermissions(de.metas.security.IUserRolePermissions) LookupDescriptor(de.metas.ui.web.window.descriptor.LookupDescriptor) Characteristic(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor.Characteristic) ICalloutField(org.adempiere.ad.callout.api.ICalloutField) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) InternalName(de.metas.ui.web.process.descriptor.InternalName) I_AD_Element(org.compiere.model.I_AD_Element) CoalesceUtil(de.metas.util.lang.CoalesceUtil) BarcodeScannerType(de.metas.process.BarcodeScannerType) Nullable(javax.annotation.Nullable) IADProcessDAO(de.metas.process.IADProcessDAO) LookupValue(de.metas.ui.web.window.datatypes.LookupValue) AdWindowId(org.adempiere.ad.element.api.AdWindowId) Check(de.metas.util.Check) Logger(org.slf4j.Logger) IModelTranslationMap(de.metas.i18n.IModelTranslationMap) ProcessLayout(de.metas.ui.web.process.descriptor.ProcessLayout) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) CCache(de.metas.cache.CCache) Services(de.metas.util.Services) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) DocumentEntityDataBindingDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDataBindingDescriptor) AdTabId(org.adempiere.ad.element.api.AdTabId) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) Stream(java.util.stream.Stream) AdTabId(org.adempiere.ad.element.api.AdTabId) RelatedProcessDescriptor(de.metas.process.RelatedProcessDescriptor) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) AdWindowId(org.adempiere.ad.element.api.AdWindowId)

Example 3 with AdTabId

use of org.adempiere.ad.element.api.AdTabId in project metasfresh-webui-api by metasfresh.

the class InMemoryUIElementsProvider method consume.

@Override
public void consume(final I_AD_UI_Section uiSection, final I_AD_Tab parent) {
    logger.info("Generated in memory {} for {}", uiSection, parent);
    final AdTabId adTabId = AdTabId.ofRepoId(parent.getAD_Tab_ID());
    adTabId2sections.put(adTabId, uiSection);
}
Also used : AdTabId(org.adempiere.ad.element.api.AdTabId)

Aggregations

AdTabId (org.adempiere.ad.element.api.AdTabId)3 DocumentFieldDescriptor (de.metas.ui.web.window.descriptor.DocumentFieldDescriptor)2 Check (de.metas.util.Check)2 Services (de.metas.util.Services)2 Nullable (javax.annotation.Nullable)2 IADTableDAO (org.adempiere.ad.table.api.IADTableDAO)2 ImmutableList (com.google.common.collect.ImmutableList)1 CCache (de.metas.cache.CCache)1 IModelTranslationMap (de.metas.i18n.IModelTranslationMap)1 LogManager (de.metas.logging.LogManager)1 BarcodeScannerType (de.metas.process.BarcodeScannerType)1 IADProcessDAO (de.metas.process.IADProcessDAO)1 IProcessPreconditionsContext (de.metas.process.IProcessPreconditionsContext)1 JavaProcess (de.metas.process.JavaProcess)1 ProcessParams (de.metas.process.ProcessParams)1 ProcessPreconditionsResolution (de.metas.process.ProcessPreconditionsResolution)1 RelatedProcessDescriptor (de.metas.process.RelatedProcessDescriptor)1 DisplayPlace (de.metas.process.RelatedProcessDescriptor.DisplayPlace)1 IUserRolePermissions (de.metas.security.IUserRolePermissions)1 DocumentFilterDescriptorsProvider (de.metas.ui.web.document.filter.provider.DocumentFilterDescriptorsProvider)1