Author: emuckenhuber
Date: 2008-03-19 08:46:15 -0400 (Wed, 19 Mar 2008)
New Revision: 10331
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java
Modified:
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java
Log:
[JBPORTAL-1958] - use a List instead of a Map
Modified:
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java
===================================================================
---
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java 2008-03-19
12:29:48 UTC (rev 10330)
+++
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java 2008-03-19
12:46:15 UTC (rev 10331)
@@ -95,12 +95,10 @@
assertEquals(LifeCyclePhase.ACTION, filter2.getLifecycle().get(0));
// Filter mapping
- assertTrue(md.getFilterMapping().containsKey("testFilter"));
- assertEquals("Portlet1",
md.getFilterMapping().get("testFilter").getPortletNames().get(0));
- assertEquals("Portlet2",
md.getFilterMapping().get("testFilter").getPortletNames().get(1));
+ assertEquals("Portlet1",
md.getFilterMapping().get(0).getPortletNames().get(0));
+ assertEquals("Portlet2",
md.getFilterMapping().get(0).getPortletNames().get(1));
- assertTrue(md.getFilterMapping().containsKey("testFilterZwei"));
- assertEquals("Portlet2",
md.getFilterMapping().get("testFilterZwei").getPortletNames().get(0));
+ assertEquals("Portlet2",
md.getFilterMapping().get(1).getPortletNames().get(0));
}
catch (Exception e)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-19
12:29:48 UTC (rev 10330)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-19
12:46:15 UTC (rev 10331)
@@ -129,7 +129,7 @@
private static final List<EventDefinitionReferenceMetaData>
EMPTY_EVENT_DEFINITION_REFERENCE_LIST = Collections.emptyList();
/** . */
- private static final Map<String,FilterMappingMetaData> EMPTY_FILTER_MAPPING_MAP
= Collections.emptyMap();
+ private static final List<FilterMappingMetaData> EMPTY_FILTER_MAPPING_LIST =
Collections.emptyList();
/** . */
private static final Map<String,FilterMetaData> EMPTY_FILTER_MAP =
Collections.emptyMap();
@@ -228,7 +228,7 @@
}
if (tmp.getFilterMapping() == null)
{
- tmp.setFilterMapping(EMPTY_FILTER_MAPPING_MAP);
+ tmp.setFilterMapping(EMPTY_FILTER_MAPPING_LIST);
}
if (tmp.getContainerRuntimeOptions() == null)
{
@@ -546,7 +546,7 @@
//
List<String> filters = Collections.emptyList();
- for (FilterMappingMetaData filterMappingMD :
((PortletApplication20MetaData)portletApplicationMD).getFilterMapping().values())
+ for (FilterMappingMetaData filterMappingMD :
((PortletApplication20MetaData)portletApplicationMD).getFilterMapping())
{
for (String portletName : filterMappingMD.getPortletNames())
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java 2008-03-19
12:29:48 UTC (rev 10330)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java 2008-03-19
12:46:15 UTC (rev 10331)
@@ -36,14 +36,10 @@
import org.jboss.portal.portlet.impl.metadata.adapter.ContainerRuntimeAdapter;
import org.jboss.portal.portlet.impl.metadata.adapter.FilterAdapter;
-import org.jboss.portal.portlet.impl.metadata.adapter.FilterMappingAdapter;
import org.jboss.portal.portlet.impl.metadata.common.ContainerRuntimeMetaData;
import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants;
-import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
-import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
@@ -61,7 +57,7 @@
private Map<String, FilterMetaData> filters;
/** The filter mapping (JSR 286) */
- private Map<String, FilterMappingMetaData> filterMapping;
+ private List<FilterMappingMetaData> filterMapping;
/** The events (JSR 286) */
private List<EventDefinitionMetaData> events;
@@ -129,13 +125,12 @@
}
@XmlElement(name = "filter-mapping", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
- @XmlJavaTypeAdapter(FilterMappingAdapter.class)
- public Map<String, FilterMappingMetaData> getFilterMapping()
+ public List<FilterMappingMetaData> getFilterMapping()
{
return filterMapping;
}
- public void setFilterMapping(Map<String, FilterMappingMetaData> filterMapping)
+ public void setFilterMapping(List<FilterMappingMetaData> filterMapping)
{
this.filterMapping = filterMapping;
}
@@ -144,9 +139,9 @@
{
if(this.filterMapping == null)
{
- this.filterMapping = new LinkedHashMap<String, FilterMappingMetaData>();
+ this.filterMapping = new ArrayList<FilterMappingMetaData>();
}
- this.filterMapping.put(filterMapping.getName(), filterMapping);
+ this.filterMapping.add(filterMapping);
}
@XmlElement(name = "event-definition", namespace =
PortletMetaDataConstants.PORTLET_JSR_286_NS)
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java 2008-03-19
12:29:48 UTC (rev 10330)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java 2008-03-19
12:46:15 UTC (rev 10331)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.metadata.adapter;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class FilterMappingAdapter
- extends XmlAdapter<List<FilterMappingMetaData>, Map<String,
FilterMappingMetaData>>
-{
-
- @Override
- public List<FilterMappingMetaData> marshal(Map<String,
FilterMappingMetaData> arg0) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Map<String, FilterMappingMetaData>
unmarshal(List<FilterMappingMetaData> list) throws Exception
- {
- Map<String, FilterMappingMetaData> map = new HashMap<String,
FilterMappingMetaData>();
- for (FilterMappingMetaData f : list)
- {
- map.put(f.getName(), f);
- }
- return map;
- }
-
-}