com.atlassian.jira.mock
Class MockConstantsManager

java.lang.Object
  extended by com.atlassian.jira.mock.MockConstantsManager
All Implemented Interfaces:
ConstantsManager

public class MockConstantsManager
extends Object
implements ConstantsManager


Field Summary
 
Fields inherited from interface com.atlassian.jira.config.ConstantsManager
ALL_ISSUE_TYPES, ALL_STANDARD_ISSUE_TYPES, ALL_SUB_TASK_ISSUE_TYPES, ISSUE_TYPE_CONSTANT_TYPE, PRIORITY_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, STATUS_CONSTANT_TYPE
 
Constructor Summary
MockConstantsManager()
           
 
Method Summary
 void addIssueType(org.ofbiz.core.entity.GenericValue type)
           
 void addPriority(org.ofbiz.core.entity.GenericValue priority)
           
 void addResolution(org.ofbiz.core.entity.GenericValue resolution)
           
 void addStatus(org.ofbiz.core.entity.GenericValue status)
           
 boolean constantExists(String constantType, String name)
          Checks if a constant exists.
 List convertToConstantObjects(String constantType, Collection ids)
          Converts the list of ids to the objects of appropriate types
 org.ofbiz.core.entity.GenericValue createIssueType(String name, Long sequence, String style, String description, String iconurl)
          Note this metod does not validate the input - i.e.
 List<String> expandIssueTypeIds(Collection<String> issueTypeIds)
          Converts the 'special' ids of issue types to a list of issue type ids For example, converts a special id to a list of all sub-task issue types Also see ConstantsManager.ALL_STANDARD_ISSUE_TYPES, ConstantsManager.ALL_SUB_TASK_ISSUE_TYPES and ConstantsManager.ALL_ISSUE_TYPES.
 List<String> getAllIssueTypeIds()
          Returns all issueType Ids.
 Collection<IssueType> getAllIssueTypeObjects()
          Returns a list of IssueTypes.
 List<org.ofbiz.core.entity.GenericValue> getAllIssueTypes()
          Returns a list of IssueTypes.
 org.ofbiz.core.entity.GenericValue getConstant(String constantType, String id)
           
 org.ofbiz.core.entity.GenericValue getConstantByName(String constantType, String name)
          Returns a constant by name.
 IssueConstant getConstantByNameIgnoreCase(String constantType, String name)
          Returns a constant by name ignoring the case of the name passed in.
 IssueConstant getConstantObject(String constantType, String id)
          Returns an IssueConstant object for the given type & id.
 Collection getConstantObjects(String constantType)
          Returns all IssueConstant objects for the given type.
 org.ofbiz.core.entity.GenericValue getDefaultPriority()
          Returns the default priority configured in JIRA.
 Priority getDefaultPriorityObject()
          Returns the default priority configured in JIRA.
 List<org.ofbiz.core.entity.GenericValue> getEditableSubTaskIssueTypes()
          Retrieves an editable list of sub-task issues.
 IssueConstant getIssueConstant(org.ofbiz.core.entity.GenericValue issueConstantGV)
          Converts a constant GenericValue to an IssueConstant object.
 IssueConstant getIssueConstantByName(String constantType, String name)
          Returns a constant by name.
 org.ofbiz.core.entity.GenericValue getIssueType(String id)
          Given an IssueType ID this method retrieves that IssueType.
 IssueType getIssueTypeObject(String id)
          Given an IssueType ID this method retrieves that IssueType.
 Collection<org.ofbiz.core.entity.GenericValue> getIssueTypes()
          Retrieve regular (non-subtask) issue types.
 Collection<org.ofbiz.core.entity.GenericValue> getPriorities()
          Retrieve all Priorities in JIRA.
 String getPriorityName(String id)
          Returns the priority Name for a given priority ID.
 Priority getPriorityObject(String id)
          Given a priority ID, this method retrieves that priority.
 Collection<Priority> getPriorityObjects()
          Retrieve all Priorities in JIRA.
 Collection<IssueType> getRegularIssueTypeObjects()
          Retrieve regular (non-subtask) issue types.
 org.ofbiz.core.entity.GenericValue getResolution(String id)
          Given a resolution ID, this method retrieves that resolution.
 Resolution getResolutionObject(String id)
          Given a resolution ID, this method retrieves that resolution.
 Collection<Resolution> getResolutionObjects()
          Retrieve all Resolutions in JIRA.
 Collection<org.ofbiz.core.entity.GenericValue> getResolutions()
          Retrieve all Resolutions in JIRA.
 org.ofbiz.core.entity.GenericValue getStatus(String id)
          Returns a Status given an id.
 Status getStatusByName(String name)
          Searches for a given status by name.
 Status getStatusByTranslatedName(String name)
          Searches for a given status by its translated name.
 Collection<org.ofbiz.core.entity.GenericValue> getStatuses()
          Returns all statuses
 Status getStatusObject(String id)
          Returns a Status given an id.
 Collection<Status> getStatusObjects()
          Returns all statuses
 Collection<IssueType> getSubTaskIssueTypeObjects()
          Retrieves all the sub-task issue types
 Collection<org.ofbiz.core.entity.GenericValue> getSubTaskIssueTypes()
          Retrieves all the sub-task issue types.
 IssueType insertIssueType(String name, Long sequence, String style, String description, String iconurl)
          Creates a new IssueType.
 void refresh()
          Sets all cached copies of constant to null.
 void refreshIssueTypes()
          Reloads all IssueTypes from the DB.
 void refreshPriorities()
          Reloads all priorities from the DB.
 void refreshResolutions()
          Reloads all resolutions from the DB.
 void refreshStatuses()
          Reloads all statuses from DB.
 void removeIssueType(String id)
          Removes an existing issueType.
 void storeIssueTypes(List issueTypes)
          Bulk operation to store a list of issueTypes.
 void updateIssueType(String id, String name, Long sequence, String style, String description, String iconurl)
          Updates an existing issueType.
 void validateCreateIssueType(String name, String style, String description, String iconurl, ErrorCollection errors, String nameFieldName)
          Validates creation of a new issuetype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockConstantsManager

public MockConstantsManager()
Method Detail

getStatus

public org.ofbiz.core.entity.GenericValue getStatus(String id)
Description copied from interface: ConstantsManager
Returns a Status given an id.

Specified by:
getStatus in interface ConstantsManager
Parameters:
id - The id of a status
Returns:
Returns a status GenericValue

getStatusObject

public Status getStatusObject(String id)
Description copied from interface: ConstantsManager
Returns a Status given an id.

Specified by:
getStatusObject in interface ConstantsManager
Parameters:
id - The id of a status
Returns:
Returns a Status object.

getStatuses

public Collection<org.ofbiz.core.entity.GenericValue> getStatuses()
Description copied from interface: ConstantsManager
Returns all statuses

Specified by:
getStatuses in interface ConstantsManager
Returns:
Returns a Collection of status GenericValues.

getStatusObjects

public Collection<Status> getStatusObjects()
Description copied from interface: ConstantsManager
Returns all statuses

Specified by:
getStatusObjects in interface ConstantsManager
Returns:
Returns a Collection of Status objects

refreshStatuses

public void refreshStatuses()
Description copied from interface: ConstantsManager
Reloads all statuses from DB.

Specified by:
refreshStatuses in interface ConstantsManager

getConstant

public org.ofbiz.core.entity.GenericValue getConstant(String constantType,
                                                      String id)

convertToConstantObjects

public List convertToConstantObjects(String constantType,
                                     Collection ids)
Description copied from interface: ConstantsManager
Converts the list of ids to the objects of appropriate types

Specified by:
convertToConstantObjects in interface ConstantsManager
Parameters:
constantType - the constant type. Case insenstive
ids - list of constant ids or GenericValues
Returns:
List of IssueConstant subclasses. Null if constantType is null or the ids are empty

constantExists

public boolean constantExists(String constantType,
                              String name)
Description copied from interface: ConstantsManager
Checks if a constant exists.

Specified by:
constantExists in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
name - The name of the constant.
Returns:
True if the constant exists. False otherwise

createIssueType

public org.ofbiz.core.entity.GenericValue createIssueType(String name,
                                                          Long sequence,
                                                          String style,
                                                          String description,
                                                          String iconurl)
                                                   throws CreateException
Description copied from interface: ConstantsManager
Note this metod does not validate the input - i.e. It does not check for duplicate names etc. Use this method in conjunction with ConstantsManager.validateCreateIssueType(String, String, String, String, com.atlassian.jira.util.ErrorCollection, String)

Specified by:
createIssueType in interface ConstantsManager
Parameters:
name - Name of the new IssueType
sequence - Sequence number used for ordering the issuetypes in the UI.
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.
Returns:
The newly created IssueType
Throws:
CreateException - If there is an error creating this Issue Type.

insertIssueType

public IssueType insertIssueType(String name,
                                 Long sequence,
                                 String style,
                                 String description,
                                 String iconurl)
Description copied from interface: ConstantsManager
Creates a new IssueType.

Note this method does not validate the input - i.e. It does not check for duplicate names etc. Use this method in conjunction with ConstantsManager.validateCreateIssueType(String, String, String, String, com.atlassian.jira.util.ErrorCollection, String)

Specified by:
insertIssueType in interface ConstantsManager
Parameters:
name - Name of the new IssueType
sequence - Sequence number used for ordering the issuetypes in the UI.
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.
Returns:
The newly created IssueType

validateCreateIssueType

public void validateCreateIssueType(String name,
                                    String style,
                                    String description,
                                    String iconurl,
                                    ErrorCollection errors,
                                    String nameFieldName)
Description copied from interface: ConstantsManager
Validates creation of a new issuetype. In particular, this function checks that a name has been submitted, no other issueTypes with the same name exist, and that the icon URL exists.

Specified by:
validateCreateIssueType in interface ConstantsManager
Parameters:
name - Name of the new IssueType
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.
errors - A collection of errors used to pass back any problems.
nameFieldName - The field to which the errors should be added.

updateIssueType

public void updateIssueType(String id,
                            String name,
                            Long sequence,
                            String style,
                            String description,
                            String iconurl)
Description copied from interface: ConstantsManager
Updates an existing issueType. This will cause a refresh of all issue types (i.e. reload from the DB).

Specified by:
updateIssueType in interface ConstantsManager
Parameters:
id - ID of the existing issuetype.
name - Name of the new IssueType
sequence - Sequence number used for ordering the issuetypes in the UI.
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.

removeIssueType

public void removeIssueType(String id)
                     throws RemoveException
Description copied from interface: ConstantsManager
Removes an existing issueType. This will cause a refresh of all issue types (i.e. reload from the DB).

Specified by:
removeIssueType in interface ConstantsManager
Parameters:
id - ID of an existing issueType
Throws:
RemoveException - if the issueType with id doesn't exist, or an error occured removing the issue.

getConstantByNameIgnoreCase

public IssueConstant getConstantByNameIgnoreCase(String constantType,
                                                 String name)
Description copied from interface: ConstantsManager
Returns a constant by name ignoring the case of the name passed in.

Specified by:
getConstantByNameIgnoreCase in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
name - The Name of the constant, case-insensitive.
Returns:
An IssueConstant (or null if not found)

getConstantByName

public org.ofbiz.core.entity.GenericValue getConstantByName(String constantType,
                                                            String name)
Description copied from interface: ConstantsManager
Returns a constant by name.

Specified by:
getConstantByName in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
name - The Name of the constant.
Returns:
A constant GenericValue

getIssueConstantByName

public IssueConstant getIssueConstantByName(String constantType,
                                            String name)
Description copied from interface: ConstantsManager
Returns a constant by name.

Specified by:
getIssueConstantByName in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
name - The Name of the constant.
Returns:
The IssueConstant

getSubTaskIssueTypes

public Collection<org.ofbiz.core.entity.GenericValue> getSubTaskIssueTypes()
Description copied from interface: ConstantsManager
Retrieves all the sub-task issue types. These will be non-modifiable. Use ConstantsManager.getEditableSubTaskIssueTypes() instead if you require an editable list.

Specified by:
getSubTaskIssueTypes in interface ConstantsManager
Returns:
A Collection of sub-task GenericValues.

getEditableSubTaskIssueTypes

public List<org.ofbiz.core.entity.GenericValue> getEditableSubTaskIssueTypes()
Description copied from interface: ConstantsManager
Retrieves an editable list of sub-task issues.

Specified by:
getEditableSubTaskIssueTypes in interface ConstantsManager
Returns:
A List of editable sub-task GenericValues

getAllIssueTypes

public List<org.ofbiz.core.entity.GenericValue> getAllIssueTypes()
Description copied from interface: ConstantsManager
Returns a list of IssueTypes.

Specified by:
getAllIssueTypes in interface ConstantsManager
Returns:
A list of GenericValue issueTypes.

getAllIssueTypeIds

public List<String> getAllIssueTypeIds()
Description copied from interface: ConstantsManager
Returns all issueType Ids.

Specified by:
getAllIssueTypeIds in interface ConstantsManager
Returns:
A list of all the IssueType Ids.

getIssueConstant

public IssueConstant getIssueConstant(org.ofbiz.core.entity.GenericValue issueConstantGV)
Description copied from interface: ConstantsManager
Converts a constant GenericValue to an IssueConstant object.

Specified by:
getIssueConstant in interface ConstantsManager
Parameters:
issueConstantGV - the constant GenericValue.
Returns:
An IssueConstant object.

storeIssueTypes

public void storeIssueTypes(List issueTypes)
Description copied from interface: ConstantsManager
Bulk operation to store a list of issueTypes.

Specified by:
storeIssueTypes in interface ConstantsManager
Parameters:
issueTypes - A list of IssueType GenericValues

refresh

public void refresh()
Description copied from interface: ConstantsManager
Sets all cached copies of constant to null. This will cause them to be re-loaded from the DB the next time they are accessed.

Specified by:
refresh in interface ConstantsManager

expandIssueTypeIds

public List<String> expandIssueTypeIds(Collection<String> issueTypeIds)
Description copied from interface: ConstantsManager
Converts the 'special' ids of issue types to a list of issue type ids For example, converts a special id to a list of all sub-task issue types Also see ConstantsManager.ALL_STANDARD_ISSUE_TYPES, ConstantsManager.ALL_SUB_TASK_ISSUE_TYPES and ConstantsManager.ALL_ISSUE_TYPES.

Specified by:
expandIssueTypeIds in interface ConstantsManager
Parameters:
issueTypeIds - A collection of the issuetype Ids to retrieve.
Returns:
A list of "actual" IssueType ID's expanded from the macro constants (or a new copy of the original list if it doesn't contain macros).

getPriorities

public Collection<org.ofbiz.core.entity.GenericValue> getPriorities()
Description copied from interface: ConstantsManager
Retrieve all Priorities in JIRA.

Specified by:
getPriorities in interface ConstantsManager
Returns:
A list of Priority GenericValues.

getPriorityObjects

public Collection<Priority> getPriorityObjects()
Description copied from interface: ConstantsManager
Retrieve all Priorities in JIRA.

Specified by:
getPriorityObjects in interface ConstantsManager
Returns:
A list of Prioritys.

getPriorityName

public String getPriorityName(String id)
Description copied from interface: ConstantsManager
Returns the priority Name for a given priority ID.

Specified by:
getPriorityName in interface ConstantsManager
Parameters:
id - The id of a priority
Returns:
The name of the priority with the given ID, or an i18n'd String indicating that no priority is set (e.g. "None") if the ID is null.

getPriorityObject

public Priority getPriorityObject(String id)
Description copied from interface: ConstantsManager
Given a priority ID, this method retrieves that priority.

Specified by:
getPriorityObject in interface ConstantsManager
Parameters:
id - The id of the priority
Returns:
A Priority object.

getDefaultPriority

public org.ofbiz.core.entity.GenericValue getDefaultPriority()
Description copied from interface: ConstantsManager
Returns the default priority configured in JIRA.

Specified by:
getDefaultPriority in interface ConstantsManager
Returns:
The default priority GenericValue.

getDefaultPriorityObject

public Priority getDefaultPriorityObject()
Description copied from interface: ConstantsManager
Returns the default priority configured in JIRA.

Specified by:
getDefaultPriorityObject in interface ConstantsManager
Returns:
The default priority.

refreshPriorities

public void refreshPriorities()
Description copied from interface: ConstantsManager
Reloads all priorities from the DB.

Specified by:
refreshPriorities in interface ConstantsManager

getResolutions

public Collection<org.ofbiz.core.entity.GenericValue> getResolutions()
Description copied from interface: ConstantsManager
Retrieve all Resolutions in JIRA.

Specified by:
getResolutions in interface ConstantsManager
Returns:
A List of Resolution GenericValues.

getResolutionObjects

public Collection<Resolution> getResolutionObjects()
Description copied from interface: ConstantsManager
Retrieve all Resolutions in JIRA.

Specified by:
getResolutionObjects in interface ConstantsManager
Returns:
A List of Resolution objects.

getResolution

public org.ofbiz.core.entity.GenericValue getResolution(String id)
Description copied from interface: ConstantsManager
Given a resolution ID, this method retrieves that resolution.

Specified by:
getResolution in interface ConstantsManager
Parameters:
id - The id of the resolution
Returns:
A resolution GenericValue

getResolutionObject

public Resolution getResolutionObject(String id)
Description copied from interface: ConstantsManager
Given a resolution ID, this method retrieves that resolution.

Specified by:
getResolutionObject in interface ConstantsManager
Parameters:
id - The id of the resolution
Returns:
A Resolution object.

refreshResolutions

public void refreshResolutions()
Description copied from interface: ConstantsManager
Reloads all resolutions from the DB.

Specified by:
refreshResolutions in interface ConstantsManager

getIssueTypes

public Collection<org.ofbiz.core.entity.GenericValue> getIssueTypes()
Description copied from interface: ConstantsManager
Retrieve regular (non-subtask) issue types.

Specified by:
getIssueTypes in interface ConstantsManager
Returns:
A collection of IssueType GenericValues

getIssueType

public org.ofbiz.core.entity.GenericValue getIssueType(String id)
Description copied from interface: ConstantsManager
Given an IssueType ID this method retrieves that IssueType.

Specified by:
getIssueType in interface ConstantsManager
Parameters:
id - The ID of the IssueType.
Returns:
An IssueType GenericValue

getIssueTypeObject

public IssueType getIssueTypeObject(String id)
Description copied from interface: ConstantsManager
Given an IssueType ID this method retrieves that IssueType.

Specified by:
getIssueTypeObject in interface ConstantsManager
Parameters:
id - The ID of the IssueType.
Returns:
An IssueType object

refreshIssueTypes

public void refreshIssueTypes()
Description copied from interface: ConstantsManager
Reloads all IssueTypes from the DB.

Specified by:
refreshIssueTypes in interface ConstantsManager

getConstantObject

public IssueConstant getConstantObject(String constantType,
                                       String id)
Description copied from interface: ConstantsManager
Returns an IssueConstant object for the given type & id.

Specified by:
getConstantObject in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
id - The id of the constant.
Returns:
A IssueConstant object. Null if it doesn't exist.

getConstantObjects

public Collection getConstantObjects(String constantType)
Description copied from interface: ConstantsManager
Returns all IssueConstant objects for the given type.

Specified by:
getConstantObjects in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
Returns:
A collection of IssueConstant object.

addIssueType

public void addIssueType(org.ofbiz.core.entity.GenericValue type)

addResolution

public void addResolution(org.ofbiz.core.entity.GenericValue resolution)

addPriority

public void addPriority(org.ofbiz.core.entity.GenericValue priority)

addStatus

public void addStatus(org.ofbiz.core.entity.GenericValue status)

getAllIssueTypeObjects

public Collection<IssueType> getAllIssueTypeObjects()
Description copied from interface: ConstantsManager
Returns a list of IssueTypes.

Specified by:
getAllIssueTypeObjects in interface ConstantsManager
Returns:
A Collection of IssueType objects.

getRegularIssueTypeObjects

public Collection<IssueType> getRegularIssueTypeObjects()
Description copied from interface: ConstantsManager
Retrieve regular (non-subtask) issue types.

Specified by:
getRegularIssueTypeObjects in interface ConstantsManager
Returns:
A collection of IssueTypes

getSubTaskIssueTypeObjects

public Collection<IssueType> getSubTaskIssueTypeObjects()
Description copied from interface: ConstantsManager
Retrieves all the sub-task issue types

Specified by:
getSubTaskIssueTypeObjects in interface ConstantsManager
Returns:
A Collection of all sub-task IssueTypes.

getStatusByName

public Status getStatusByName(String name)
Description copied from interface: ConstantsManager
Searches for a given status by name. This is not the most efficient implementation. If the name is not found, or the given name is null, then it returns null.

Specified by:
getStatusByName in interface ConstantsManager
Parameters:
name - The name of the status.
Returns:
A Status object with the given name, or null if none found.

getStatusByTranslatedName

public Status getStatusByTranslatedName(String name)
Description copied from interface: ConstantsManager
Searches for a given status by its translated name. If no matching translated name is found the true (untranslated) name will be tried. If the name is not found, or the given name is null, then it returns null.

Specified by:
getStatusByTranslatedName in interface ConstantsManager
Parameters:
name - The name of the status.
Returns:
A Status object with the given name, or null if none found.


Copyright © 2002-2013 Atlassian. All Rights Reserved.