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