edu.indiana.dde.mylead.common
Class MyLeadQuery

java.lang.Object
  extended by edu.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 addGuid(java.lang.String guid)
          Allows the user to add a global ID to search for.
 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

addGuid

public void addGuid(java.lang.String guid)
Allows the user to add a global ID to search for. The query can include multiple ID possibilities. If an ID has already been added, calling this method does not replace the ID previously entered - it adds to the list of possible IDs.

Parameters:
guid - String containing an alternate ID to add to the list.

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 String 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.