org.opencms.file.collectors
Class A_CmsResourceCollector

java.lang.Object
  extended byorg.opencms.file.collectors.A_CmsResourceCollector
All Implemented Interfaces:
Comparable, I_CmsResourceCollector
Direct Known Subclasses:
CmsDefaultResourceCollector, CmsPriorityResourceCollector

public abstract class A_CmsResourceCollector
extends Object
implements I_CmsResourceCollector

Provides some helpful base implementations for resource collector classes.

Since:
6.0.0
Version:
$Revision: 1.7 $
Author:
Alexander Kandzior

Field Summary
protected  int m_order
          The collector order of this collector.
 
Constructor Summary
A_CmsResourceCollector()
          Constructor to initialize some default values.
 
Method Summary
 int compareTo(Object obj)
           
 boolean equals(Object obj)
          Two collectors are considered to be equal if they are sharing the same implementation class.
protected  String getCreateInFolder(CmsObject cms, String param)
          Returns the link to create a new XML content item in the folder pointed to by the parameter.
 int getOrder()
          Returns the "order weight" of this collector.
 int hashCode()
           
 void setOrder(int order)
          Sets the "order weight" of this collector.
protected  List shrinkToFit(List result, int maxSize)
          Shrinks a List to fit a maximum size.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opencms.file.collectors.I_CmsResourceCollector
getCollectorNames, getCreateLink, getCreateParam, getResults
 

Field Detail

m_order

protected int m_order
The collector order of this collector.

Constructor Detail

A_CmsResourceCollector

public A_CmsResourceCollector()
Constructor to initialize some default values.

Method Detail

compareTo

public int compareTo(Object obj)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

equals

public boolean equals(Object obj)
Two collectors are considered to be equal if they are sharing the same implementation class.

See Also:
Object.equals(java.lang.Object)

getOrder

public int getOrder()
Description copied from interface: I_CmsResourceCollector
Returns the "order weight" of this collector.

The "order weight" is important because two collector classes may provide a collector with the same name. If this is the case, the collector implementation with the higher order number "overrules" the lower order number classs.

Specified by:
getOrder in interface I_CmsResourceCollector
Returns:
the "order weight" of this collector
See Also:
I_CmsResourceCollector.getOrder()

hashCode

public int hashCode()
See Also:
Object.hashCode()

setOrder

public void setOrder(int order)
Description copied from interface: I_CmsResourceCollector
Sets the "order weight" of this collector.

Specified by:
setOrder in interface I_CmsResourceCollector
Parameters:
order - the order weight to set
See Also:
I_CmsResourceCollector.setOrder(int)

getCreateInFolder

protected String getCreateInFolder(CmsObject cms,
                                   String param)
                            throws CmsException
Returns the link to create a new XML content item in the folder pointed to by the parameter.

Parameters:
cms - the current CmsObject
param - the folder name to use
Returns:
the link to create a new XML content item in the folder
Throws:
CmsException - if something goes wrong

shrinkToFit

protected List shrinkToFit(List result,
                           int maxSize)
Shrinks a List to fit a maximum size.

Parameters:
result - a List
maxSize - the maximum size of the List
Returns:
the shrinked list