ItemSelectorImpl implements ItemSelector { protected Map<String, String[]> getItemSelectorParameters( String itemSelectedEventName, ItemSelectorCriterion... itemSelectorCriteria) { StringBundler sb = new StringBundler(itemSelectorCriteria.length * 2); for (ItemSelectorCriterion itemSelectorCriterion : itemSelectorCriteria) { sb.append( ItemSelectorKeyUtil.getItemSelectorCriterionKey( itemSelectorCriterion.getClass())); sb.append(StringPool.COMMA); } if (itemSelectorCriteria.length > 0) { sb.setIndex(sb.index() - 1); } Map<String, String[]> parameters = HashMapBuilder.put( PARAMETER_CRITERIA, new String[] {sb.toString()} ).put( PARAMETER_ITEM_SELECTED_EVENT_NAME, new String[] {itemSelectedEventName} ).build(); for (int i = 0; i < itemSelectorCriteria.length; i++) { ItemSelectorCriterion itemSelectorCriterion = itemSelectorCriteria[i]; String countValue = String.valueOf(i); parameters.put( countValue.concat(JSON), new String[] { _itemSelectionCriterionSerializer.serialize( itemSelectorCriterion) }); } return parameters; }  @Override String getItemSelectedEventName(String itemSelectorURL); @Override List<ItemSelectorCriterion> getItemSelectorCriteria(
		Map<String, String[]> parameters); @Override List<ItemSelectorCriterion> getItemSelectorCriteria(
		String itemSelectorURL); @Override ItemSelectorRendering getItemSelectorRendering(
		RequestBackedPortletURLFactory requestBackedPortletURLFactory,
		Map<String, String[]> parameters, ThemeDisplay themeDisplay); @Override PortletURL getItemSelectorURL(
		RequestBackedPortletURLFactory requestBackedPortletURLFactory,
		Group group, long refererGroupId, String itemSelectedEventName,
		ItemSelectorCriterion... itemSelectorCriteria); @Override PortletURL getItemSelectorURL(
		RequestBackedPortletURLFactory requestBackedPortletURLFactory,
		String itemSelectedEventName,
		ItemSelectorCriterion... itemSelectorCriteria); static final String JSON; static final String PARAMETER_CRITERIA; static final String PARAMETER_ITEM_SELECTED_EVENT_NAME; static final String PARAMETER_SELECTED_TAB; }
@Test public void testGetItemSelectorParameters() { Map<String, String[]> parameters = _itemSelectorImpl.getItemSelectorParameters( "itemSelectedEventName", _mediaItemSelectorCriterion, _flickrItemSelectorCriterion); Assert.assertEquals( "itemSelectedEventName", parameters.get(ItemSelectorImpl.PARAMETER_ITEM_SELECTED_EVENT_NAME) [0]); String mediaItemSelectorCriterionKey = ItemSelectorKeyUtil.getItemSelectorCriterionKey( MediaItemSelectorCriterion.class); String flickrItemSelectorCriterionKey = ItemSelectorKeyUtil.getItemSelectorCriterionKey( FlickrItemSelectorCriterion.class); Assert.assertEquals( mediaItemSelectorCriterionKey + StringPool.COMMA + flickrItemSelectorCriterionKey, parameters.get(ItemSelectorImpl.PARAMETER_CRITERIA)[0]); Assert.assertNull(parameters.get("0_desiredItemSelectorReturnTypes")); Assert.assertNotNull(parameters.get("0_json")[0]); Assert.assertNotNull(parameters.get("1_json")[0]); Assert.assertEquals(parameters.toString(), 4, parameters.size()); }