@Test public void createQueryChain() throws Exception { final NavigationContext<Query> navigationContext = this.context.mock(NavigationContext.class, "navigationContext"); this.context.checking(new Expectations() {{ oneOf(navigationContext).getCustomerShopId(); will(returnValue(1010L)); }}); final List<Query> query = new HasOfferProductSearchQueryBuilder().createQueryChain(navigationContext, "any", "EUR"); assertNotNull(query); assertEquals(1, query.size()); assertEquals("productHasOfferShopIdEUR:[1010 TO 1010]", query.get(0).toString()); this.context.assertIsSatisfied(); }
@Override public List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value) { String strValue = ""; if (value instanceof Collection) { if (CollectionUtils.isNotEmpty((Collection) value)) { strValue = (String)((Collection) value).iterator().next(); } } else { strValue = (String) value; } return Collections.singletonList(createNumericQuery(PRODUCT_SHOP_HASOFFER_FIELD + strValue, navigationContext.getCustomerShopId())); }
HasOfferProductSearchQueryBuilder extends AbstractSearchQueryBuilderImpl implements ProductSearchQueryBuilder<Query> { @Override public List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value) { String strValue = ""; if (value instanceof Collection) { if (CollectionUtils.isNotEmpty((Collection) value)) { strValue = (String)((Collection) value).iterator().next(); } } else { strValue = (String) value; } return Collections.singletonList(createNumericQuery(PRODUCT_SHOP_HASOFFER_FIELD + strValue, navigationContext.getCustomerShopId())); } }
HasOfferProductSearchQueryBuilder extends AbstractSearchQueryBuilderImpl implements ProductSearchQueryBuilder<Query> { @Override public List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value) { String strValue = ""; if (value instanceof Collection) { if (CollectionUtils.isNotEmpty((Collection) value)) { strValue = (String)((Collection) value).iterator().next(); } } else { strValue = (String) value; } return Collections.singletonList(createNumericQuery(PRODUCT_SHOP_HASOFFER_FIELD + strValue, navigationContext.getCustomerShopId())); }  }
HasOfferProductSearchQueryBuilder extends AbstractSearchQueryBuilderImpl implements ProductSearchQueryBuilder<Query> { @Override public List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value) { String strValue = ""; if (value instanceof Collection) { if (CollectionUtils.isNotEmpty((Collection) value)) { strValue = (String)((Collection) value).iterator().next(); } } else { strValue = (String) value; } return Collections.singletonList(createNumericQuery(PRODUCT_SHOP_HASOFFER_FIELD + strValue, navigationContext.getCustomerShopId())); }  @Override List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value); }
HasOfferProductSearchQueryBuilder extends AbstractSearchQueryBuilderImpl implements ProductSearchQueryBuilder<Query> { @Override public List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value) { String strValue = ""; if (value instanceof Collection) { if (CollectionUtils.isNotEmpty((Collection) value)) { strValue = (String)((Collection) value).iterator().next(); } } else { strValue = (String) value; } return Collections.singletonList(createNumericQuery(PRODUCT_SHOP_HASOFFER_FIELD + strValue, navigationContext.getCustomerShopId())); }  @Override List<Query> createQueryChain(final NavigationContext<Query> navigationContext, final String parameter, final Object value);  }