use of de.metas.ui.web.document.filter.DocumentFilter in project metasfresh-webui-api by metasfresh.
the class DocumentFilterToHuTraceQueryTest method createTraceQueryFromDocumentFilter_duplicateFilterParam.
@Test(expected = AdempiereException.class)
public void createTraceQueryFromDocumentFilter_duplicateFilterParam() {
final DocumentFilter emptyFilter = DocumentFilter.builder().setFilterId("inconsitent-filter").addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_InOut_ID, Operator.EQUAL, IntegerLookupValue.of(23, "test-inout-id"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_InOut_ID, Operator.EQUAL, IntegerLookupValue.of(24, "inconsistent-other-test-inout-id"))).build();
HuTraceQueryCreator.createTraceQueryFromDocumentFilter(emptyFilter);
}
use of de.metas.ui.web.document.filter.DocumentFilter in project metasfresh-webui-api by metasfresh.
the class DocumentFilterToHuTraceQueryTest method createTraceQueryFromDocumentFilter_all_equal_params.
@Test
public void createTraceQueryFromDocumentFilter_all_equal_params() {
final DocumentFilter filter = DocumentFilter.builder().setFilterId("filter").addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_AD_Org_ID, Operator.EQUAL, IntegerLookupValue.of(20, "test-AD_Org_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_C_DocType_ID, Operator.EQUAL, IntegerLookupValue.of(30, "test-C_DocType_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_DocStatus, Operator.EQUAL, StringLookupValue.of("CO", "test-DocStatus"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_HUTraceType, Operator.EQUAL, StringLookupValue.of(X_M_HU_Trace.HUTRACETYPE_MATERIAL_PICKING, "test-HUTraceType"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_HU_ID, Operator.EQUAL, IntegerLookupValue.of(60, "test-M_HU_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_HU_Trace_ID, Operator.EQUAL, IntegerLookupValue.of(70, "test-M_HU_Trace_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_HU_Trx_Line_ID, Operator.EQUAL, IntegerLookupValue.of(80, "test-M_HU_Trx_Line_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_InOut_ID, Operator.EQUAL, IntegerLookupValue.of(90, "test-M_InOut_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_Movement_ID, Operator.EQUAL, IntegerLookupValue.of(100, "test-M_Movement_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_Product_ID, Operator.EQUAL, IntegerLookupValue.of(110, "test-M_Product_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_M_ShipmentSchedule_ID, Operator.EQUAL, IntegerLookupValue.of(120, "test-M_ShipmentSchedule_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_PP_Cost_Collector_ID, Operator.EQUAL, IntegerLookupValue.of(130, "test-PP_Cost_Collector_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_PP_Order_ID, Operator.EQUAL, IntegerLookupValue.of(140, "test-PP_Order_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_EventTime, Operator.EQUAL, TimeUtil.parseTimestamp("2017-10-13"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_VHU_ID, Operator.EQUAL, IntegerLookupValue.of(160, "test-VHU_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_VHU_Source_ID, Operator.EQUAL, IntegerLookupValue.of(170, "test-VHU_Source_ID"))).addParameter(DocumentFilterParam.ofNameOperatorValue(I_M_HU_Trace.COLUMNNAME_VHUStatus, Operator.EQUAL, StringLookupValue.of(X_M_HU_Trace.VHUSTATUS_Active, "test-VHUStatus"))).build();
final HUTraceEventQuery huTraceQuery = HuTraceQueryCreator.createTraceQueryFromDocumentFilter(filter);
assertThat(huTraceQuery).isNotNull();
assertThat(huTraceQuery.getRecursionMode()).isEqualTo(RecursionMode.BOTH);
assertThat(huTraceQuery.getOrgId()).isEqualTo(20);
assertThat(huTraceQuery.getDocTypeId().getAsInt()).isEqualTo(30);
assertThat(huTraceQuery.getDocStatus()).isEqualTo("CO");
assertThat(huTraceQuery.getType().toString()).isEqualTo(X_M_HU_Trace.HUTRACETYPE_MATERIAL_PICKING);
assertThat(huTraceQuery.getTopLevelHuId()).isEqualTo(60);
assertThat(huTraceQuery.getHuTraceEventId().getAsInt()).isEqualTo(70);
assertThat(huTraceQuery.getHuTrxLineId()).isEqualTo(80);
assertThat(huTraceQuery.getInOutId()).isEqualTo(90);
assertThat(huTraceQuery.getMovementId()).isEqualTo(100);
assertThat(huTraceQuery.getProductId()).isEqualTo(110);
assertThat(huTraceQuery.getShipmentScheduleId()).isEqualTo(120);
assertThat(huTraceQuery.getPpCostCollectorId()).isEqualTo(130);
assertThat(huTraceQuery.getPpOrderId()).isEqualTo(140);
assertThat(huTraceQuery.getVhuId()).isEqualTo(160);
assertThat(huTraceQuery.getVhuSourceId()).isEqualTo(170);
assertThat(huTraceQuery.getVhuStatus()).isEqualTo(X_M_HU_Trace.VHUSTATUS_Active);
assertThat(huTraceQuery.getEventTime()).isEqualTo(TimeUtil.parseTimestamp("2017-10-13").toInstant());
}
use of de.metas.ui.web.document.filter.DocumentFilter in project metasfresh-webui-api by metasfresh.
the class HUEditorViewFactoryTemplate method extractStickyFilters.
/**
* @param requestStickyFilters
* @param huIds {@code null} means "no restriction". Empty means "select none"
* @return
*/
private static List<DocumentFilter> extractStickyFilters(@NonNull final List<DocumentFilter> requestStickyFilters, @Nullable final Set<Integer> filterOnlyIds) {
final List<DocumentFilter> stickyFilters = new ArrayList<>(requestStickyFilters);
final DocumentFilter stickyFilter_HUIds_Existing = HUIdsFilterHelper.findExistingOrNull(stickyFilters);
// Create the sticky filter by HUIds from builder's huIds (if any huIds)
if (stickyFilter_HUIds_Existing == null && filterOnlyIds != null && !filterOnlyIds.isEmpty()) {
final DocumentFilter stickyFilter_HUIds_New = HUIdsFilterHelper.createFilter(filterOnlyIds);
stickyFilters.add(0, stickyFilter_HUIds_New);
}
return ImmutableList.copyOf(stickyFilters);
}
use of de.metas.ui.web.document.filter.DocumentFilter in project metasfresh-webui-api by metasfresh.
the class MaterialCockpitViewFactory method createView.
@Override
public IView createView(@NonNull final CreateViewRequest request) {
assertWindowIdOfRequestIsCorrect(request);
final DocumentFilterDescriptorsProvider filterDescriptors = materialCockpitFilters.getFilterDescriptors();
final ImmutableList<DocumentFilter> requestFilters = materialCockpitFilters.extractDocumentFilters(request);
final ImmutableList<DocumentFilter> filtersToUse = request.isUseAutoFilters() ? materialCockpitFilters.createAutoFilters() : requestFilters;
final MaterialCockpitView view = MaterialCockpitView.builder().viewId(request.getViewId()).description(ITranslatableString.empty()).filters(filtersToUse).filterDescriptors(filterDescriptors).rowsData(materialCockpitRowRepository.createRowsData(filtersToUse)).relatedProcessDescriptor(createProcessDescriptor()).build();
return view;
}
use of de.metas.ui.web.document.filter.DocumentFilter in project metasfresh-webui-api by metasfresh.
the class DocumentFilterToHuTraceQueryTest method createTraceQueryFromDocumentFilter_empty.
@Test
public void createTraceQueryFromDocumentFilter_empty() {
final DocumentFilter emptyFilter = DocumentFilter.builder().setFilterId("emptyFilter").build();
final HUTraceEventQuery huTraceQuery = HuTraceQueryCreator.createTraceQueryFromDocumentFilter(emptyFilter);
assertThat(huTraceQuery).isNotNull();
}
Aggregations