From: <jbo...@li...> - 2005-11-11 23:57:44
|
Author: adamw Date: 2005-11-11 18:57:37 -0500 (Fri, 11 Nov 2005) New Revision: 1562 Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-15 Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-11 23:51:29 UTC (rev 1561) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-11 23:57:37 UTC (rev 1562) @@ -397,7 +397,7 @@ if (searchNameAttr == null) searchNameAttr = "nodes"; - vc.put(searchNameAttr, list.toList()); + vc.put(searchNameAttr, list); } catch (Exception e) { log.warn("Error generating shotoku feed " + feedName + ".", e); Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-11-11 23:51:29 UTC (rev 1561) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-11-11 23:57:37 UTC (rev 1562) @@ -21,7 +21,6 @@ */ package org.jboss.shotoku; -import java.io.Writer; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -29,9 +28,6 @@ import java.util.Iterator; import java.util.List; -import org.apache.velocity.VelocityContext; -import org.jboss.shotoku.exceptions.RepositoryException; - /** * A class representing a list of nodes and providing the possibility to * manipulate these nodes. @@ -39,7 +35,7 @@ * @author Adam Warski (ad...@as...) * @author Damon Sicore (da...@si...) */ -public class NodeList implements Iterable<Node> { +public class NodeList implements Collection<Node> { private List<Node> nodeList; public NodeList() { @@ -56,8 +52,9 @@ * @param node * Node to add. */ - public void add(Node node) { + public boolean add(Node node) { nodeList.add(node); + return true; } /** @@ -97,10 +94,6 @@ return Collections.unmodifiableList(nodeList); } - public Iterator<Node> iterator() { - return toList().iterator(); - } - /** * Limits the size of this node list. After this operation, * the size of this node list will be lower or equal to the @@ -113,37 +106,55 @@ } } - /** - * @deprecated - * @param cm - * @param templateName - * @param nodesParameter - * @param w - * @throws RepositoryException + /* + * Implementation of the Collection interface methods. */ - public void mergeWithTemplate(ContentManager cm, String templateName, - String nodesParameter, Writer w) - throws RepositoryException { - mergeWithTemplate(cm, templateName, nodesParameter, new VelocityContext(), w); + + public Iterator<Node> iterator() { + return toList().iterator(); } - /** - * @deprecated - * @param cm - * @param templateName - * @param nodesParameter - * @param context - * @param w - * @throws RepositoryException - */ - public void mergeWithTemplate(ContentManager cm, String templateName, - String nodesParameter, VelocityContext context, Writer w) - throws RepositoryException { - context.put(nodesParameter, nodeList); - try { - cm.getVelocityEngine().mergeTemplate(templateName, context, w); - } catch (Exception e) { - throw new RepositoryException(e); - } + public int size() { + return nodeList.size(); } + + public boolean isEmpty() { + return nodeList.isEmpty(); + } + + public boolean contains(Object o) { + return nodeList.contains(o); + } + + public Object[] toArray() { + return nodeList.toArray(); + } + + public <T> T[] toArray(T[] a) { + return nodeList.toArray(a); + } + + public boolean remove(Object o) { + return nodeList.remove(o); + } + + public boolean containsAll(Collection<?> c) { + return nodeList.containsAll(c); + } + + public boolean addAll(Collection<? extends Node> c) { + return nodeList.addAll(c); + } + + public boolean removeAll(Collection<?> c) { + return nodeList.removeAll(c); + } + + public boolean retainAll(Collection<?> c) { + return nodeList.retainAll(c); + } + + public void clear() { + nodeList.clear(); + } } |