com.atlassian.jira.mock.issue.search
Class MockSearchContext

java.lang.Object
  extended by com.atlassian.jira.mock.issue.search.MockSearchContext
All Implemented Interfaces:
SearchContext

public class MockSearchContext
extends Object
implements SearchContext

Simple search context for testing. Most methods don't actually work.

Since:
v4.0

Constructor Summary
MockSearchContext()
           
MockSearchContext(Project... projects)
           
 
Method Summary
 List<IssueContext> getAsIssueContexts()
          Gets the search context as a list of IssueContext objects
 List<String> getIssueTypeIds()
          Issue ids as Strings
 List<IssueType> getIssueTypes()
          Returns issue types objects in this SearchContext
 org.ofbiz.core.entity.GenericValue getOnlyProject()
          Returns the single Project for this SearchContext.
 List getProjectCategoryIds()
          Returns selected categories
 List<Long> getProjectIds()
          Project ids as Longs.
 List<Project> getProjects()
          Returns project objects in this SearchContext
 Project getSingleProject()
          Returns the single Project for this SearchContext.
 boolean isForAnyIssueTypes()
          Returns true if no specific issue types have been selected
 boolean isForAnyProjects()
          Returns whether the context is global or not.
 boolean isSingleProjectContext()
          Returns true if there is exactly one Project in this SearchContext.
 void verify()
          Verifies that all issue types and projects in the context actually still exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockSearchContext

public MockSearchContext()

MockSearchContext

public MockSearchContext(Project... projects)
Method Detail

isForAnyProjects

public boolean isForAnyProjects()
Description copied from interface: SearchContext
Returns whether the context is global or not. A context is global when there are no project restrictions and no project category restrictions.

Specified by:
isForAnyProjects in interface SearchContext
Returns:
boolean

isForAnyIssueTypes

public boolean isForAnyIssueTypes()
Description copied from interface: SearchContext
Returns true if no specific issue types have been selected

Specified by:
isForAnyIssueTypes in interface SearchContext
Returns:
boolean

isSingleProjectContext

public boolean isSingleProjectContext()
Description copied from interface: SearchContext
Returns true if there is exactly one Project in this SearchContext.

Specified by:
isSingleProjectContext in interface SearchContext
Returns:
true if there is exactly one Project in this SearchContext.

getSingleProject

public Project getSingleProject()
Description copied from interface: SearchContext
Returns the single Project for this SearchContext. You should first call SearchContext.isSingleProjectContext() to check if this is valid.

Specified by:
getSingleProject in interface SearchContext
Returns:
the single Project for this SearchContext.
See Also:
SearchContext.isSingleProjectContext()

getProjectCategoryIds

public List getProjectCategoryIds()
Description copied from interface: SearchContext
Returns selected categories

Specified by:
getProjectCategoryIds in interface SearchContext
Returns:
Empty list if no categories were selected

getProjectIds

public List<Long> getProjectIds()
Description copied from interface: SearchContext
Project ids as Longs.

Specified by:
getProjectIds in interface SearchContext
Returns:
List of Long objects, possibly empty.

getOnlyProject

public org.ofbiz.core.entity.GenericValue getOnlyProject()
Description copied from interface: SearchContext
Returns the single Project for this SearchContext. You should first call SearchContext.isSingleProjectContext() to check if this is valid.

Specified by:
getOnlyProject in interface SearchContext
Returns:
the single Project for this SearchContext.

getIssueTypeIds

public List<String> getIssueTypeIds()
Description copied from interface: SearchContext
Issue ids as Strings

Specified by:
getIssueTypeIds in interface SearchContext
Returns:
List of issue type ids possibly empty.

getAsIssueContexts

public List<IssueContext> getAsIssueContexts()
Description copied from interface: SearchContext
Gets the search context as a list of IssueContext objects

Specified by:
getAsIssueContexts in interface SearchContext
Returns:
List of IssueContext. If no issue types or projects selected. A blank issue context is returned. Never null.

verify

public void verify()
Description copied from interface: SearchContext
Verifies that all issue types and projects in the context actually still exists. This might not be the case. Also removes any projects or issue types from this SearchContext that do not (any longer) exist in the backing store.

Specified by:
verify in interface SearchContext

getProjects

public List<Project> getProjects()
Description copied from interface: SearchContext
Returns project objects in this SearchContext

Specified by:
getProjects in interface SearchContext
Returns:
List of Project. If no projects are selected, returns an empty list.

getIssueTypes

public List<IssueType> getIssueTypes()
Description copied from interface: SearchContext
Returns issue types objects in this SearchContext

Specified by:
getIssueTypes in interface SearchContext
Returns:
List of IssueType. If no issue types are selected, returns an empty list


Copyright © 2002-2013 Atlassian. All Rights Reserved.