com.atlassian.jira.portal
Class ProjectAndProjectCategoryValuesGenerator

java.lang.Object
  extended by com.atlassian.jira.portal.ProjectAndProjectCategoryValuesGenerator
All Implemented Interfaces:
ValuesGenerator

public class ProjectAndProjectCategoryValuesGenerator
extends java.lang.Object
implements ValuesGenerator

Generator for project and category values.

This generator produces a map of value ->label for HTML select box options. The option may look like

 All Projects
 homosapian
 monkey
 
for projects only, or:
 Projects
 - All Projects
 - homosapian
 - monkey
 Project Categories
 - Category 1
 
for projects and categories.

Since:
v3.11

Nested Class Summary
static class ProjectAndProjectCategoryValuesGenerator.Values
           
 
Field Summary
 
Fields inherited from interface com.atlassian.configurable.ValuesGenerator
NONE
 
Constructor Summary
ProjectAndProjectCategoryValuesGenerator()
           
 
Method Summary
static java.util.Set<java.lang.Long> filterProjectCategoryIds(java.util.Collection<java.lang.String> projectOrCategoryIds)
          Filter project category ids from the given collection.
static java.util.Set<java.lang.Long> filterProjectIds(java.util.Collection<java.lang.String> projectOrCategoryIds)
          Filter project ids from the given collection.
 java.util.Map<java.lang.String,java.lang.String> getValues(java.util.Map params)
          Map of choices to use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectAndProjectCategoryValuesGenerator

public ProjectAndProjectCategoryValuesGenerator()
Method Detail

getValues

public java.util.Map<java.lang.String,java.lang.String> getValues(java.util.Map params)
Description copied from interface: ValuesGenerator
Map of choices to use

Specified by:
getValues in interface ValuesGenerator
Parameters:
params - Used to generate a relevant list of choices. e.g. may have some permissions in it
Returns:
Map which contains a list of choices as key value pairs. Can be null.

filterProjectIds

public static java.util.Set<java.lang.Long> filterProjectIds(java.util.Collection<java.lang.String> projectOrCategoryIds)
Filter project ids from the given collection. Returns a set of project ids as Long objects. Value is a valid project id if it is a long number.

Parameters:
projectOrCategoryIds - collection of project or category ids
Returns:
set of project ids, never null

filterProjectCategoryIds

public static java.util.Set<java.lang.Long> filterProjectCategoryIds(java.util.Collection<java.lang.String> projectOrCategoryIds)
Filter project category ids from the given collection. Returns a set of project category ids as Long objects. Value is a valid category if it takes form "catXYZ" where "cat" is the prefix (Prefix#CATEGORY) and XYZ is a long number.

Parameters:
projectOrCategoryIds - collection of project or category ids
Returns:
set of project category ids, never null


Copyright © 2002-2011 Atlassian. All Rights Reserved.