com.atlassian.jira.issue.search.parameters.lucene
Class PeriodParameter

java.lang.Object
  extended bycom.atlassian.jira.issue.search.parameters.AbstractSearchParameter
      extended bycom.atlassian.jira.issue.search.parameters.LuceneParameter
          extended bycom.atlassian.jira.issue.search.parameters.lucene.SingleFieldSingleValueLuceneParameter
              extended bycom.atlassian.jira.issue.search.parameters.lucene.PeriodParameter
All Implemented Interfaces:
SearchParameter

public class PeriodParameter
extends SingleFieldSingleValueLuceneParameter

Parameter indicating a period of time, unbounded at one end. Period is specified by a time offset (t1) from 'now' (t0), and a direction (indicating past, future) in which the period is unbounded.

t1 is positive in the past, so t1=-20000 means "20 seconds ago".

The direction is specified as an EntityOperator operator; EntityOperator.GREATER_THAN_EQUAL_TO means that times after t1 match (t1 is the lower/earlier boundary); EntityOperator.LESS_THAN_EQUAL_TO means times before t1 match (t1 is upper/latest boundary)


Field Summary
protected  org.ofbiz.core.entity.EntityOperator operator
           
 
Fields inherited from class com.atlassian.jira.issue.search.parameters.AbstractSearchParameter
log
 
Constructor Summary
PeriodParameter()
           
PeriodParameter(java.lang.String name, org.ofbiz.core.entity.EntityOperator operator, java.lang.Long offset)
           
PeriodParameter(java.lang.String name, java.lang.Long offset)
          Create a PeriodParameter, with future unbounded.
 
Method Summary
 java.lang.String getName()
           
 long getOffset()
           
 org.ofbiz.core.entity.EntityOperator getOperator()
          Whether past or future is unbounded.
 org.apache.lucene.search.Query getQuery(org.ofbiz.core.entity.GenericValue project, com.opensymphony.user.User searcher)
           
protected  java.lang.String getQueryStringPrefix()
          Note that implementations of this method should ensure that the values that they return are URLEncoded, perhaps using the URLEncoder.encode(String) method.
 electric.xml.Element getXml()
          Return an XML representation of this search parameter
 void setName(java.lang.String name)
           
 void setOperator(org.ofbiz.core.entity.EntityOperator operator)
           
 void setXml(electric.xml.Element el)
          Initialise this search parameter using an XML element.
 
Methods inherited from class com.atlassian.jira.issue.search.parameters.lucene.SingleFieldSingleValueLuceneParameter
getXmlElementName, isValid
 
Methods inherited from class com.atlassian.jira.issue.search.parameters.AbstractSearchParameter
addValue, clearValues, equals, getQueryString, getValues, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

operator

protected org.ofbiz.core.entity.EntityOperator operator
Constructor Detail

PeriodParameter

public PeriodParameter()

PeriodParameter

public PeriodParameter(java.lang.String name,
                       java.lang.Long offset)
Create a PeriodParameter, with future unbounded.

Parameters:
name - Parameter name, typically from DocumentConstants.
offset - Offset in milliseconds, positive for dates in the past, specifying one boundary for the period.

PeriodParameter

public PeriodParameter(java.lang.String name,
                       org.ofbiz.core.entity.EntityOperator operator,
                       java.lang.Long offset)
Parameters:
name - Period name, typically from DocumentConstants.
operator - Direction in time, relative to 'offset'.
offset - offset in milliseconds, positive for dates in the past, specifying one boundary for the period.
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface SearchParameter
Overrides:
getName in class AbstractSearchParameter
Returns:
Period name, with "Previous" appended if unbounded in the future, or "Next" appended if unbounded in the past. This made sense when the offset was always in the past :)

setName

public void setName(java.lang.String name)
Specified by:
setName in interface SearchParameter
Overrides:
setName in class AbstractSearchParameter
Parameters:
name - Period name, eg. "duedate".

getOperator

public org.ofbiz.core.entity.EntityOperator getOperator()
Whether past or future is unbounded.

Returns:
Typically EntityOperator.GREATER_THAN_EQUAL_TO for "future unbounded" and EntityOperator.LESS_THAN_EQUAL_TO for "past unbounded"

getQuery

public org.apache.lucene.search.Query getQuery(org.ofbiz.core.entity.GenericValue project,
                                               com.opensymphony.user.User searcher)
                                        throws org.apache.lucene.queryParser.ParseException
Overrides:
getQuery in class SingleFieldSingleValueLuceneParameter
Throws:
org.apache.lucene.queryParser.ParseException

setXml

public void setXml(electric.xml.Element el)
Description copied from interface: SearchParameter
Initialise this search parameter using an XML element. Usual process is: SearchParameter param = new MySearchParameter(); param.setXml(element);

Specified by:
setXml in interface SearchParameter
Overrides:
setXml in class AbstractSearchParameter

getXml

public electric.xml.Element getXml()
Description copied from interface: SearchParameter
Return an XML representation of this search parameter

Specified by:
getXml in interface SearchParameter
Overrides:
getXml in class SingleFieldSingleValueLuceneParameter

setOperator

public void setOperator(org.ofbiz.core.entity.EntityOperator operator)

getOffset

public long getOffset()
Returns:
Offset of the period's boundary, in milliseconds. A positive value indicates a time offset in the past. Eg. -1000 means "1 second ago".

getQueryStringPrefix

protected java.lang.String getQueryStringPrefix()
Description copied from class: AbstractSearchParameter
Note that implementations of this method should ensure that the values that they return are URLEncoded, perhaps using the URLEncoder.encode(String) method.

Overrides:
getQueryStringPrefix in class AbstractSearchParameter
Returns:


Copyright © 2002-2005 Atlassian. All Rights Reserved.