Search in sources :

Example 1 with DocumentFiltersList

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();
}
Also used : DocumentFiltersList(de.metas.ui.web.document.filter.DocumentFiltersList) PickingSlotQueryBuilder(de.metas.picking.api.IPickingSlotDAO.PickingSlotQuery.PickingSlotQueryBuilder)

Example 2 with DocumentFiltersList

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();
}
Also used : DocumentFiltersList(de.metas.ui.web.document.filter.DocumentFiltersList) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) DocumentFilter(de.metas.ui.web.document.filter.DocumentFilter) WindowId(de.metas.ui.web.window.datatypes.WindowId) JSONViewDataType(de.metas.ui.web.view.json.JSONViewDataType)

Example 3 with DocumentFiltersList

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);
}
Also used : DocumentFiltersList(de.metas.ui.web.document.filter.DocumentFiltersList)

Aggregations

DocumentFiltersList (de.metas.ui.web.document.filter.DocumentFiltersList)3 PickingSlotQueryBuilder (de.metas.picking.api.IPickingSlotDAO.PickingSlotQuery.PickingSlotQueryBuilder)1 DocumentFilter (de.metas.ui.web.document.filter.DocumentFilter)1 SqlViewBinding (de.metas.ui.web.view.descriptor.SqlViewBinding)1 JSONViewDataType (de.metas.ui.web.view.json.JSONViewDataType)1 WindowId (de.metas.ui.web.window.datatypes.WindowId)1