edu.indiana.dde.mylead.common
Class MyLeadQuery

java.lang.Object
  extended byedu.indiana.dde.mylead.common.MyLeadQuery
Direct Known Subclasses:
MyLeadCollection, MyLeadExperiment, MyLeadFile, MyLeadProject

public abstract class MyLeadQuery
extends java.lang.Object

This class is an abstract base class used to query for files or collections and their underlying attributes. The classes that extend this class generally only need to include their leadType as defined in the lead_type_definition when calling the wrapQuery method.


Constructor Summary
MyLeadQuery()
          This constructor creates all of the lists used for the various parameters.
 
Method Summary
 void addAttribute(MyLeadAttribute leadAttribute)
          Used to add an instance of MyLeadAttribute to the query for a file or collection.
 void addCreator(MyLeadPerson newPerson)
           
 void addDesc(MyLeadStrItem desc)
          This overload of the addDesc method takes an instance of MyLeadStrItem which must already be populated.
 void addDesc(java.lang.String desc, boolean exact)
          Allows the user to add a string to search for in the description.
 void addName(MyLeadStrItem name)
          This overload of the addName method takes an instance of MyLeadStrItem which must already be populated.
 void addName(java.lang.String name, boolean exact)
          Allows the user to add a string to search for in the name.
 void creatorSearchRng(java.util.Date startDate, java.util.Date endDate)
          Allows lower and upper bounds to be set when searching based on the date that the object was created.
 java.util.Date getEndCreateRng()
          This method returns the upper bound for the creation range in the query as was set in either the creatorSearchRng or setEndCreateRng method.
 java.util.Date getStartCreateRng()
          This method returns the lower bound for the creation range in the query as was set in either the creatorSearchRng or setStartCreateRng method.
 void setEndCreateRng(java.util.Date endDate)
          This method can be used instead of the creatorSearchRng method if the user wishes to only set an upper bound on the range of creation dates for a query.
 void setStartCreateRng(java.util.Date startDate)
          This method can be used instead of the creatorSearchRng method if the user wishes to only set a lower bound on the range of creation dates for a query.
 java.lang.String wrapCreator()
          Each item in the persons list will be made into a tagged fragment with mlCreator tags.
 java.lang.String wrapParameters()
          The wrapParameters method is redefined by each class that inherits from MyLeadQuery.
 java.lang.String wrapQuery(java.lang.String leadType)
          Wraps up the query parameters in a string that can then be included in the OGSA-DAI perform document created by a non-abstract class that inherits from MyLeadQuery.
static java.lang.String wrapStrList(java.util.List list, java.lang.String tag)
          Used to create a tagged fragment for a list with the label passed as a parameter used as the tag for each item in the list being wrapped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyLeadQuery

public MyLeadQuery()
This constructor creates all of the lists used for the various parameters. Even single strings such as names and descriptions are kept in lists since a query needs to be able consider possible alternate names or descriptions. On the other hand, the start and end dates for the creator search range are each a double initially set to null.

Method Detail

addName

public void addName(java.lang.String name,
                    boolean exact)
Allows the user to add a string to search for in the name. The query can include multiple name possibilities and each name entered can seperately say whether the name should be an exact match. If a name has already been added, calling this method does not replace the name previously entered - it adds to the list of possible names.

Parameters:
name - String containing a name alternative to add to the list.
exact - boolean that determines whether this name needs to be an exact match. A name could also include ? characters to allow for any single character in a specific position.

addName

public void addName(MyLeadStrItem name)
This overload of the addName method takes an instance of MyLeadStrItem which must already be populated.

Parameters:
name - Instance of the MyLeadStrItem class populated with the name and exact flag set.

addDesc

public void addDesc(java.lang.String desc,
                    boolean exact)
Allows the user to add a string to search for in the description. The query can include multiple description possibilities and each one entered can seperately say whether the description should be an exact match. If a description has already been added, calling this method does not replace the description previously entered - it adds to the list of possible descriptions.

Parameters:
desc - String containing a description alternative to add to the list.
exact - boolean that determines whether this description needs to be an exact match with the description. The String passed could also include ? characters to allow for any single character in a specific position.

addDesc

public void addDesc(MyLeadStrItem desc)
This overload of the addDesc method takes an instance of MyLeadStrItem which must already be populated.

Parameters:
desc - Instance of the MyLeadStrItem class populated with the description and exact flag set.

addCreator

public void addCreator(MyLeadPerson newPerson)

creatorSearchRng

public void creatorSearchRng(java.util.Date startDate,
                             java.util.Date endDate)
Allows lower and upper bounds to be set when searching based on the date that the object was created. In the constructor the lower and upper bound are set to null and only used in wrapping the query to create the perform document if a date was actually set.

Parameters:
startDate - Date for the lower bound to search.
endDate - Date for the upper bound to search.

setStartCreateRng

public void setStartCreateRng(java.util.Date startDate)
This method can be used instead of the creatorSearchRng method if the user wishes to only set a lower bound on the range of creation dates for a query. If no upper bound is set, then the creation date only needs to be on or after the startDate.

Parameters:
startDate - Date with the lower bound for the creation date in the query.

getStartCreateRng

public java.util.Date getStartCreateRng()
This method returns the lower bound for the creation range in the query as was set in either the creatorSearchRng or setStartCreateRng method.

Returns:
Date that represents the lower bound for the creation date.

setEndCreateRng

public void setEndCreateRng(java.util.Date endDate)
This method can be used instead of the creatorSearchRng method if the user wishes to only set an upper bound on the range of creation dates for a query. If no lower bound is set, then the creation date only needs to be on or before the endDate.

Parameters:
endDate - Date with the upper bound for the creation date in the query.

getEndCreateRng

public java.util.Date getEndCreateRng()
This method returns the upper bound for the creation range in the query as was set in either the creatorSearchRng or setEndCreateRng method.

Returns:
Date that represents the upper bound for the creation date.

addAttribute

public void addAttribute(MyLeadAttribute leadAttribute)
Used to add an instance of MyLeadAttribute to the query for a file or collection. The attribute can contain any of the elements defined for the collection, but it is not required to have all of the elements defined for an attribute since a user can base a query on selected elements within an attribute. Likewise, a MyLeadQuery instance is not required to have any attributes since a query is not required to be based on any attributes of the file or collection. If an attribute has subattributes that the user wishes to consider in the query, those subattributes should already have been added to the attribute added with this method.

Parameters:
leadAttribute - MyLeadAttribute instance added to the query parameters.

wrapParameters

public java.lang.String wrapParameters()
The wrapParameters method is redefined by each class that inherits from MyLeadQuery.

Returns:
String with the XML fragment as redefined in the non-abstract class.

wrapQuery

public java.lang.String wrapQuery(java.lang.String leadType)
Wraps up the query parameters in a string that can then be included in the OGSA-DAI perform document created by a non-abstract class that inherits from MyLeadQuery.

Parameters:
leadType - String containing the mlAggregationType from the leadActivity.xsd schema for this object.
Returns:
String with the XML fragment containing the parameters.
See Also:
MyLeadAttribute

wrapStrList

public static java.lang.String wrapStrList(java.util.List list,
                                           java.lang.String tag)
Used to create a tagged fragment for a list with the label passed as a parameter used as the tag for each item in the list being wrapped.

Parameters:
list - An ArrayList containing MyLeadStrItem items that will be wapped in the XML fragment.
tag - The tag that will be used to enclose each item in the XML fragment created in this method.
Returns:
String containing the XML fragment created by this method.

wrapCreator

public java.lang.String wrapCreator()
Each item in the persons list will be made into a tagged fragment with mlCreator tags.

Returns:
String containing the XML fragment for querying on creator.