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

java.lang.Object
  extended by com.atlassian.jira.issue.search.parameters.lucene.UsersGroupParameter
All Implemented Interfaces:
LuceneParameter, SearchParameter

public class UsersGroupParameter
extends Object
implements LuceneParameter

This is a parameter that is used with searching with user groups such as when selecting a user group for reporter or assignee.


Constructor Summary
UsersGroupParameter()
          This constructor is used when parsing from XML.
UsersGroupParameter(String name, String userLuceneFieldName, String groupName)
          Constructs a new instance, sets name, userLuceneFieldName and a groupName.
 
Method Summary
 void addValue(Object value)
          Does nothing.
 String getName()
          Returns the name of this parameter
 org.apache.lucene.search.Query getQuery(org.ofbiz.core.entity.GenericValue project, User searcher)
          Creates and returns a BooleanQuery that ORs terms where userLuceneFieldName is equal to user name for all users that are in the group found by groupName.
 String getQueryString()
          Creates and returns a query string.
 List getValues()
          Returns a list that contains only one element - name.
 electric.xml.Element getXml()
          Creates and returns a new XML element set with userLuceneFieldName and groupName attributes.
 boolean isValid()
          Returns true only if both userLuceneFieldName and groupName are not null, false otherwise.
 void setName(String fieldname)
          This method does nothing.
 void setXml(electric.xml.Element el)
          Sets the name to the name of the given element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsersGroupParameter

public UsersGroupParameter()
This constructor is used when parsing from XML.


UsersGroupParameter

public UsersGroupParameter(String name,
                           String userLuceneFieldName,
                           String groupName)
Constructs a new instance, sets name, userLuceneFieldName and a groupName.

Parameters:
name - name
userLuceneFieldName - user lucene field name
groupName - group name
Method Detail

addValue

public void addValue(Object value)
Does nothing. Values cannot be added.

Specified by:
addValue in interface SearchParameter
Parameters:
value - this value is not used

getValues

public List getValues()
Returns a list that contains only one element - name.

Specified by:
getValues in interface SearchParameter
Returns:
a single element list

getName

public String getName()
Returns the name of this parameter

Specified by:
getName in interface SearchParameter
Returns:
name

setName

public void setName(String fieldname)
This method does nothing. Name cannot be set.

Specified by:
setName in interface SearchParameter
Parameters:
fieldname - not used

getXml

public electric.xml.Element getXml()
Creates and returns a new XML element set with userLuceneFieldName and groupName attributes. The name of the XML element is the value returned by getName().

Specified by:
getXml in interface SearchParameter
Returns:
XML element

setXml

public void setXml(electric.xml.Element el)
Sets the name to the name of the given element. Sets the userLuceneFieldName field to the value of "userLuceneFieldName" attribute if not null. Sets the groupName field to the value of "groupName" attribute if not null.

Specified by:
setXml in interface SearchParameter
Parameters:
el - XML element

isValid

public boolean isValid()
Returns true only if both userLuceneFieldName and groupName are not null, false otherwise.

Specified by:
isValid in interface SearchParameter
Returns:
true only if both userLuceneFieldName and groupName are not null, false otherwise

getQueryString

public String getQueryString()
Creates and returns a query string.

If the name is equal to DocumentConstants.ISSUE_ASSIGNEE_GROUP, the following query string will be returned "&assigneeSelect=specificgroup&assignee=groupName".

If the name is equal to DocumentConstants.ISSUE_AUTHOR_GROUP, the following query string will be returned "&reporterSelect=specificgroup&reporter=groupName".

Else following query string will be returned "&userLuceneFieldNameSelect=specificgroup&userLuceneFieldName=groupName".

Specified by:
getQueryString in interface SearchParameter
Returns:
query string

getQuery

public org.apache.lucene.search.Query getQuery(org.ofbiz.core.entity.GenericValue project,
                                               User searcher)
                                        throws org.apache.lucene.queryParser.ParseException
Creates and returns a BooleanQuery that ORs terms where userLuceneFieldName is equal to user name for all users that are in the group found by groupName.

Specified by:
getQuery in interface LuceneParameter
Parameters:
project - not used
searcher - not used
Returns:
query
Throws:
org.apache.lucene.queryParser.ParseException - never thrown from this method


Copyright © 2002-2007 Atlassian. All Rights Reserved.