use of de.metas.ui.web.document.filter.DocumentFiltersList in project metasfresh-webui-api by metasfresh.
the class PickingSlotsClearingViewFactory method createPickingSlotQuery.
private static final PickingSlotQuery createPickingSlotQuery(final CreateViewRequest request) {
final DocumentFiltersList filters = request.getFilters();
final PickingSlotQueryBuilder queryBuilder = PickingSlotQuery.builder();
final int bpartnerId = PickingSlotsClearingViewFilters.getBPartnerId(filters);
if (bpartnerId > 0) {
queryBuilder.assignedToBPartnerId(bpartnerId);
}
final String barcode = PickingSlotsClearingViewFilters.getPickingSlotBarcode(filters);
if (!Check.isEmpty(barcode, true)) {
queryBuilder.barcode(barcode);
}
return queryBuilder.build();
}
use of de.metas.ui.web.document.filter.DocumentFiltersList in project metasfresh-webui-api by metasfresh.
the class SqlViewFactory method createView.
@Override
public IView createView(final CreateViewRequest request) {
final WindowId windowId = request.getViewId().getWindowId();
final JSONViewDataType viewType = request.getViewType();
final ViewProfileId profileId = !ViewProfileId.isNull(request.getProfileId()) ? request.getProfileId() : getDefaultProfileIdByWindowId(windowId);
final SqlViewBindingKey sqlViewBindingKey = new SqlViewBindingKey(windowId, viewType.getRequiredFieldCharacteristic(), profileId);
final SqlViewBinding sqlViewBinding = getViewBinding(sqlViewBindingKey);
final IViewDataRepository viewDataRepository = new SqlViewDataRepository(sqlViewBinding);
final DefaultView.Builder viewBuilder = DefaultView.builder(viewDataRepository).setViewId(request.getViewId()).setViewType(viewType).setProfileId(profileId).setReferencingDocumentPaths(request.getReferencingDocumentPaths()).setParentViewId(request.getParentViewId()).setParentRowId(request.getParentRowId()).addStickyFilters(request.getStickyFilters()).addStickyFilter(extractReferencedDocumentFilter(windowId, request.getSingleReferencingDocumentPathOrNull())).viewInvalidationAdvisor(sqlViewBinding.getViewInvalidationAdvisor());
final DocumentFiltersList filters = request.getFilters();
if (filters.isJson()) {
viewBuilder.setFiltersFromJSON(filters.getJsonFilters());
} else {
viewBuilder.setFilters(filters.getFilters());
}
if (request.isUseAutoFilters()) {
final List<DocumentFilter> autoFilters = createAutoFilters(sqlViewBindingKey);
viewBuilder.addFiltersIfAbsent(autoFilters);
}
if (!request.getFilterOnlyIds().isEmpty()) {
final String keyColumnName = sqlViewBinding.getSqlViewKeyColumnNamesMap().getSingleKeyColumnName();
viewBuilder.addStickyFilter(DocumentFilter.inArrayFilter(keyColumnName, keyColumnName, request.getFilterOnlyIds()));
}
return viewBuilder.build();
}
use of de.metas.ui.web.document.filter.DocumentFiltersList in project metasfresh-webui-api by metasfresh.
the class CreateViewRequest method unwrapFiltersAndCopy.
public CreateViewRequest unwrapFiltersAndCopy(final DocumentFilterDescriptorsProvider descriptors) {
final DocumentFiltersList filters = getFilters();
final DocumentFiltersList filtersNew = filters.unwrapAndCopy(descriptors);
if (Objects.equals(filters, filtersNew)) {
return this;
}
return new CreateViewRequest(this, filtersNew);
}
Aggregations