net.datacrow.core.data
Class DataFilter

java.lang.Object
  extended by net.datacrow.core.data.DataFilter

public class DataFilter
extends java.lang.Object

Used to filter for items. A filter is created out of filter entries (see DataFilterEntry). Filters can be saved to a file for reuse. Filters are used on the web as well as in the normal GUI.

Author:
Robert Jan van der Waals

Field Summary
static int _SORTORDER_ASCENDING
           
static int _SORTORDER_DESCENDING
           
 
Constructor Summary
DataFilter(DcObject dco)
          Creates a filter based on the supplied item.
DataFilter(int module)
          Creates an empty filter for a specific module.
DataFilter(int module, java.util.Collection<DataFilterEntry> entries)
          Creates a filter using the supplied entries.
DataFilter(java.lang.String xml)
          Creates a filter based on an xml definition.
 
Method Summary
 void addEntry(DataFilterEntry entry)
          Adds a single entry to this filter.
 boolean equals(DataFilter df)
           
 boolean equals(java.lang.Object o)
           
 java.util.Collection<DataFilterEntry> getEntries()
          Returns all entries belonging to this filter.
 int getModule()
          Returns the module for which this filter has been created.
 java.lang.String getName()
          Returns the name of this filter.
 DcField[] getOrder()
          Returns the order information.
 int getSortOrder()
           
 int hashCode()
           
 void setEntries(java.util.Collection<DataFilterEntry> entries)
          Sets the entries for this filter.
 void setEntries(DcObject dco)
          Sets the entries based on the supplied item.
 void setName(java.lang.String name)
          Set the name of this filter.
 void setOrder(DcField[] order)
          Sets the order.
 void setOrder(java.lang.String[] s)
          Sets the order.
 void setSortOrder(int sortOrder)
           
 java.lang.String toSQL(int[] fields, boolean order, boolean includeMod)
           
 java.lang.String toSQLFlatStructure(int[] fields)
          Creates an entirely flat structure of the data.
 java.lang.String toStorageString()
          Creates a xml definition for this filter.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_SORTORDER_ASCENDING

public static final int _SORTORDER_ASCENDING
See Also:
Constant Field Values

_SORTORDER_DESCENDING

public static final int _SORTORDER_DESCENDING
See Also:
Constant Field Values
Constructor Detail

DataFilter

public DataFilter(DcObject dco)
Creates a filter based on the supplied item.

Parameters:
dco -

DataFilter

public DataFilter(java.lang.String xml)
           throws java.lang.Exception
Creates a filter based on an xml definition.

Parameters:
xml -
Throws:
java.lang.Exception

DataFilter

public DataFilter(int module)
Creates an empty filter for a specific module.

Parameters:
module -

DataFilter

public DataFilter(int module,
                  java.util.Collection<DataFilterEntry> entries)
Creates a filter using the supplied entries.

Parameters:
module -
entries -
Method Detail

getSortOrder

public int getSortOrder()

setOrder

public void setOrder(java.lang.String[] s)
Sets the order. Results retrieved will be sorted based on this order.

Parameters:
s - Array of field names (column names).

setSortOrder

public void setSortOrder(int sortOrder)

setOrder

public void setOrder(DcField[] order)
Sets the order. Results retrieved will be sorted based on this order.

Parameters:
order - Array of fields.

addEntry

public void addEntry(DataFilterEntry entry)
Adds a single entry to this filter.

Parameters:
entry -

setEntries

public void setEntries(java.util.Collection<DataFilterEntry> entries)
Sets the entries for this filter. Existing entries will be overwritten.

Parameters:
entries -

getEntries

public java.util.Collection<DataFilterEntry> getEntries()
Returns all entries belonging to this filter.

Returns:

setEntries

public void setEntries(DcObject dco)
Sets the entries based on the supplied item. Existing entries will be overridden.

Parameters:
dco -

getOrder

public DcField[] getOrder()
Returns the order information.

Returns:

getName

public java.lang.String getName()
Returns the name of this filter.


setName

public void setName(java.lang.String name)
Set the name of this filter.

Parameters:
name -

getModule

public int getModule()
Returns the module for which this filter has been created.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toStorageString

public java.lang.String toStorageString()
Creates a xml definition for this filter.


toSQLFlatStructure

public java.lang.String toSQLFlatStructure(int[] fields)
Creates an entirely flat structure of the data. - Items will be returned duplicated in case of multiple references. - Pictures get their filename returned

Parameters:
fields -
order -
Returns:

toSQL

public java.lang.String toSQL(int[] fields,
                              boolean order,
                              boolean includeMod)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(DataFilter df)