com.atlassian.jira.project
Class AbstractProjectManager

java.lang.Object
  extended by com.atlassian.jira.project.AbstractProjectManager
All Implemented Interfaces:
ProjectManager
Direct Known Subclasses:
CachingProjectManager, DefaultProjectManager, MockProjectManager

public abstract class AbstractProjectManager
extends Object
implements ProjectManager


Constructor Summary
AbstractProjectManager(UserManager userManager, ApplicationProperties applicationProperties)
           
 
Method Summary
 List<Project> convertToProjectObjects(Collection<Long> projectIds)
          Converts a collection of projectIds to a list of projects.
 List<org.ofbiz.core.entity.GenericValue> convertToProjects(Collection<Long> projectIds)
          Converts a collection of projectIds to a collection of projects.
 Project createProject(String name, String key, String description, String lead, String url, Long assigneeType)
          Creates the project in the database, and adds default project roles for this project.
 com.atlassian.crowd.embedded.api.User getDefaultAssignee(org.ofbiz.core.entity.GenericValue project, org.ofbiz.core.entity.GenericValue component)
          This function returns the default assignee if the system has been setup incorrectly then it will throw an error The isDefaultAssignee(GenericValue, GenericValue) checks if there is a valid default assignee
 com.atlassian.crowd.embedded.api.User getDefaultAssignee(Project project, Collection<ProjectComponent> components)
          Gets the default assignee for an issue given its project and list of Components.
 com.atlassian.crowd.embedded.api.User getDefaultAssignee(Project project, ProjectComponent component)
          Gets the default assignee for a project and/or component depending on if a component was specified.
 org.ofbiz.core.entity.GenericValue getProject(org.ofbiz.core.entity.GenericValue issue)
          Returns a project GenericValue that an issue is in.
 org.ofbiz.core.entity.GenericValue getProjectCategoryByName(String projectCategoryName)
          Find a project category by name.
 org.ofbiz.core.entity.GenericValue getProjectCategoryByNameIgnoreCase(String projectCategoryName)
          Find a project category by name ignoring the case of the category name.
 ProjectCategory getProjectCategoryObjectByName(String projectCategoryName)
          Find a project category by name.
 ProjectCategory getProjectCategoryObjectByNameIgnoreCase(String projectCategoryName)
          Find a project category by name ignoring the case of the category name.
 boolean isDefaultAssignee(org.ofbiz.core.entity.GenericValue project)
          Checks if there is a valid default assignee for a given project.
 boolean isDefaultAssignee(org.ofbiz.core.entity.GenericValue project, org.ofbiz.core.entity.GenericValue component)
          This function checks if there is a valid default assignee set in the system
If this returns false then the getDefaultAssignee(GenericValue, GenericValue) will throw an exception
 Project updateProject(Project updatedProject, String name, String description, String lead, String url, Long assigneeType)
          Updates the project provided with the new attributes passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.project.ProjectManager
createProject, createProjectCategory, getAllProjectCategories, getComponent, getComponent, getComponents, getCurrentCounterForProject, getNextId, getProject, getProjectByKey, getProjectByName, getProjectCategories, getProjectCategory, getProjectCategoryForProject, getProjectCategoryFromProject, getProjectCategoryObject, getProjectObj, getProjectObjByKey, getProjectObjByKeyIgnoreCase, getProjectObjByName, getProjectObjects, getProjectObjectsFromProjectCategory, getProjectObjectsWithNoCategory, getProjects, getProjectsByLead, getProjectsFromProjectCategory, getProjectsFromProjectCategory, getProjectsLeadBy, getProjectsWithNoCategory, refresh, removeProject, removeProjectCategory, removeProjectIssues, setCurrentCounterForProject, setProjectCategory, setProjectCategory, updateProject, updateProjectCategory, updateProjectCategory
 

Constructor Detail

AbstractProjectManager

public AbstractProjectManager(UserManager userManager,
                              ApplicationProperties applicationProperties)
Method Detail

getProject

public org.ofbiz.core.entity.GenericValue getProject(org.ofbiz.core.entity.GenericValue issue)
Description copied from interface: ProjectManager
Returns a project GenericValue that an issue is in.

Specified by:
getProject in interface ProjectManager
Parameters:
issue - the issue.
Returns:
GenericValue representation of a Project.

getProjectCategoryByName

public org.ofbiz.core.entity.GenericValue getProjectCategoryByName(String projectCategoryName)
                                                            throws DataAccessException
Description copied from interface: ProjectManager
Find a project category by name. NOTE: The current implementation is not the most efficient.

Specified by:
getProjectCategoryByName in interface ProjectManager
Parameters:
projectCategoryName - Name of the Project Category
Returns:
A category GenericValue
Throws:
DataAccessException - If any errors occur accessing the DB.

getProjectCategoryObjectByName

public ProjectCategory getProjectCategoryObjectByName(String projectCategoryName)
                                               throws DataAccessException
Description copied from interface: ProjectManager
Find a project category by name.

Specified by:
getProjectCategoryObjectByName in interface ProjectManager
Parameters:
projectCategoryName - Name of the Project Category
Returns:
The ProjectCategory or null if none found
Throws:
DataAccessException

getProjectCategoryObjectByNameIgnoreCase

public ProjectCategory getProjectCategoryObjectByNameIgnoreCase(String projectCategoryName)
                                                         throws DataAccessException
Description copied from interface: ProjectManager
Find a project category by name ignoring the case of the category name.

Specified by:
getProjectCategoryObjectByNameIgnoreCase in interface ProjectManager
Parameters:
projectCategoryName - Name of the Project Category
Returns:
The ProjectCategory or null if none found
Throws:
DataAccessException

getProjectCategoryByNameIgnoreCase

public org.ofbiz.core.entity.GenericValue getProjectCategoryByNameIgnoreCase(String projectCategoryName)
                                                                      throws DataAccessException
Description copied from interface: ProjectManager
Find a project category by name ignoring the case of the category name. NOTE: The current implementation is not the most efficient.

Specified by:
getProjectCategoryByNameIgnoreCase in interface ProjectManager
Parameters:
projectCategoryName - Name of the Project Category
Returns:
A category GenericValue
Throws:
DataAccessException - If any errors occur accessing the DB.

isDefaultAssignee

public boolean isDefaultAssignee(org.ofbiz.core.entity.GenericValue project,
                                 org.ofbiz.core.entity.GenericValue component)
This function checks if there is a valid default assignee set in the system
If this returns false then the getDefaultAssignee(GenericValue, GenericValue) will throw an exception

Specified by:
isDefaultAssignee in interface ProjectManager
Parameters:
project -
component -
Returns:
true if either the component is not null and has an assignee type != project default, or if ProjectManager.isDefaultAssignee(org.ofbiz.core.entity.GenericValue) is true

isDefaultAssignee

public boolean isDefaultAssignee(org.ofbiz.core.entity.GenericValue project)
Description copied from interface: ProjectManager
Checks if there is a valid default assignee for a given project.

Specified by:
isDefaultAssignee in interface ProjectManager
Parameters:
project -
Returns:
False if no assignee type is set for a project and unassigned issues are not allowed, and the projectlead is not assignable. Also false, if either the assigneetype is not unassigned or unassigned issues are not allowed and the projectleas is not assignable. Otherwise there is a default assigneed.

convertToProjects

public List<org.ofbiz.core.entity.GenericValue> convertToProjects(Collection<Long> projectIds)
Description copied from interface: ProjectManager
Converts a collection of projectIds to a collection of projects. Will return null if is null or blank

Specified by:
convertToProjects in interface ProjectManager
Parameters:
projectIds - a Collection of Longs
Returns:
List of Project GenericValues. Null if input is empty

convertToProjectObjects

public List<Project> convertToProjectObjects(Collection<Long> projectIds)
Description copied from interface: ProjectManager
Converts a collection of projectIds to a list of projects.

Will return null if incoming collection is null.

The returned list of Project Objects will have the same sort order as the incoming collection of IDs.

Specified by:
convertToProjectObjects in interface ProjectManager
Parameters:
projectIds - a Collection of Project IDs
Returns:
List of Projects, or null if input is null

getDefaultAssignee

public com.atlassian.crowd.embedded.api.User getDefaultAssignee(Project project,
                                                                ProjectComponent component)
Description copied from interface: ProjectManager
Gets the default assignee for a project and/or component depending on if a component was specified.

Specified by:
getDefaultAssignee in interface ProjectManager
Parameters:
project - project
component - component
Returns:
the default assignee for this project/component

getDefaultAssignee

public com.atlassian.crowd.embedded.api.User getDefaultAssignee(Project project,
                                                                Collection<ProjectComponent> components)
                                                         throws DefaultAssigneeException
Description copied from interface: ProjectManager
Gets the default assignee for an issue given its project and list of Components.

If the default assignee configuration is invalid, then a DefaultAssigneeException is thrown. This could be because the default is unassigned, and unassigned issues are not allowed, or because the default user does not have permission to be assigned to issues in this project.

Specified by:
getDefaultAssignee in interface ProjectManager
Parameters:
project - project
components - The components
Returns:
the default assignee for this project/components
Throws:
DefaultAssigneeException - If the default assignee is invalid (eg user does not have assign permission) .

getDefaultAssignee

public com.atlassian.crowd.embedded.api.User getDefaultAssignee(org.ofbiz.core.entity.GenericValue project,
                                                                org.ofbiz.core.entity.GenericValue component)
This function returns the default assignee if the system has been setup incorrectly then it will throw an error The isDefaultAssignee(GenericValue, GenericValue) checks if there is a valid default assignee

Specified by:
getDefaultAssignee in interface ProjectManager
Parameters:
project -
component -
Returns:
A User

createProject

public Project createProject(String name,
                             String key,
                             String description,
                             String lead,
                             String url,
                             Long assigneeType)
Description copied from interface: ProjectManager
Creates the project in the database, and adds default project roles for this project. If no name, key or lead are provided an exception will be thrown.

Specified by:
createProject in interface ProjectManager
Parameters:
name - The name of the new project
key - The project key of the new project
description - An optional description for the project
lead - The lead developer for the project
url - An optional URL for the new project
assigneeType - The default assignee for issues created in this project. May be either project lead, or unassigned if unassigned issues are enabled.
Returns:
The newly created project.

updateProject

public Project updateProject(Project updatedProject,
                             String name,
                             String description,
                             String lead,
                             String url,
                             Long assigneeType)
Description copied from interface: ProjectManager
Updates the project provided with the new attributes passed in. This method is responsible for persisting any changes to the database.

Specified by:
updateProject in interface ProjectManager
Parameters:
updatedProject - The project to be updated.
name - The name for the updated project
description - An optional description for the project
lead - The lead developer for the project
url - An optional URL for the updated project
assigneeType - The default assignee for issues created in this project. May be either project lead, or unassigned if unassigned issues are enabled.
Returns:
The updated project


Copyright © 2002-2013 Atlassian. All Rights Reserved.