com.atlassian.jira.project
Class DefaultProjectManager

java.lang.Object
  extended by com.atlassian.jira.project.AbstractProjectManager
      extended by com.atlassian.jira.project.DefaultProjectManager
All Implemented Interfaces:
ProjectManager

public class DefaultProjectManager
extends AbstractProjectManager

A class to manage interactions with projects


Field Summary
static String APPLINKS_LOCAL_PROPERTY_PREFIX
           
 
Constructor Summary
DefaultProjectManager(OfBizDelegator delegator, NodeAssociationStore nodeAssociationStore, ProjectFactory projectFactory, ProjectRoleManager projectRoleManager, IssueManager issueManager, AvatarManager avatarManager, UserManager userManager, ProjectCategoryStore projectCategoryStore, ApplicationProperties applicationProperties, ProjectKeyStore projectKeyStore, TransactionSupport transactionSupport, PropertiesManager propertiesManager, JsonEntityPropertyManager jsonEntityPropertyManager)
           
 
Method Summary
 Project createProject(String name, String key, String description, String leadKey, String url, Long assigneeType, Long avatarId)
          Creates the project in the database, and adds default project roles for this project.
 ProjectCategory createProjectCategory(String name, String description)
          Creates a new ProjectCategory with the given name and description.
 List<ProjectCategory> getAllProjectCategories()
          Returns all ProjectCategories, ordered by name.
 Set<String> getAllProjectKeys(Long projectId)
          Returns all project keys that are associated with Project.
 org.ofbiz.core.entity.GenericValue getComponent(org.ofbiz.core.entity.GenericValue project, String name)
          Deprecated. use ProjectComponentManager instead
 org.ofbiz.core.entity.GenericValue getComponent(Long id)
          Deprecated. use ProjectComponentManager instead
 Collection<org.ofbiz.core.entity.GenericValue> getComponents(org.ofbiz.core.entity.GenericValue project)
          Deprecated. use ProjectComponentManager instead
 long getCurrentCounterForProject(Long id)
          Returns the curremt issue counter for the given project.
protected  OfBizDelegator getDelegator()
           
 long getNextId(Project project)
          Get the next issue ID from this project (transactional).
 org.ofbiz.core.entity.GenericValue getProject(Long id)
          Retrieve a single project by it's id.
 Project getProjectByCurrentKey(String projectKey)
          Returns the Project with the given project key.
 Project getProjectByCurrentKeyIgnoreCase(String projectKey)
          Returns a Project object based on the passed in project key, not taking into account the case of the project key.
 org.ofbiz.core.entity.GenericValue getProjectByKey(String key)
          Retrieve a single project by it's project key.
 org.ofbiz.core.entity.GenericValue getProjectByName(String name)
          Retrieve a single project by it's project name.
 Collection<org.ofbiz.core.entity.GenericValue> getProjectCategories()
          Get all ProjectCategories.
 org.ofbiz.core.entity.GenericValue getProjectCategory(Long id)
          Returns a single project category by id.
 ProjectCategory getProjectCategoryForProject(Project project)
          Returns a project's category.
 org.ofbiz.core.entity.GenericValue getProjectCategoryFromProject(org.ofbiz.core.entity.GenericValue project)
          Get the Project Category given a Project.
 ProjectCategory getProjectCategoryObject(Long id)
          Returns a single project category by id.
 long getProjectCount()
          Return the total number of Projects.
 Project getProjectObj(Long id)
          Retrieves a single Project by its id.
 Project getProjectObjByKey(String projectKey)
          Returns a Project object based on the passed in project key.
 Project getProjectObjByKeyIgnoreCase(String projectKey)
          Returns a Project object based on the passed in project key, not taking into account the case of the project key.
 Project getProjectObjByName(String projectName)
          Returns a Project object based on the passed in project name.
 List<Project> getProjectObjects()
          Return all Projects ordered by name.
 Collection<Project> getProjectObjectsFromProjectCategory(Long projectCategoryId)
          Returns a list of projects in a particular category.
 Collection<Project> getProjectObjectsWithNoCategory()
          Returns a list of projects without project category, sorted by project name
 Collection<org.ofbiz.core.entity.GenericValue> getProjects()
          Return all project GenericValues.
 Collection<org.ofbiz.core.entity.GenericValue> getProjectsByLead(com.atlassian.crowd.embedded.api.User leadUser)
          Returns all the projects that leadUser is the project lead for.
 Collection<org.ofbiz.core.entity.GenericValue> getProjectsFromProjectCategory(org.ofbiz.core.entity.GenericValue projectCategory)
          Gather a list of projects that are in a project category.
 Collection<Project> getProjectsFromProjectCategory(ProjectCategory projectCategory)
          Returns a list of projects in a particular category.
 List<Project> getProjectsLeadBy(ApplicationUser leadUser)
          Returns all the projects that leadUser is the project lead for ordered by the name of the Project.
 List<Project> getProjectsLeadBy(com.atlassian.crowd.embedded.api.User leadUser)
          Returns all the projects that leadUser is the project lead for ordered by the name of the Project.
 Collection<org.ofbiz.core.entity.GenericValue> getProjectsWithNoCategory()
          Gets a list of projects that are not associated with any project category
 boolean isAssignee(org.ofbiz.core.entity.GenericValue project, com.atlassian.crowd.embedded.api.User user)
          Checks if given user is assignee of at least one issue in the given project.
 boolean isAssignee(Project project, com.atlassian.crowd.embedded.api.User user)
          Checks if given user is assignee of at least one issue in the given project.
 void refresh()
          Causes a full refresh of the project cache.
 void removeProject(Project project)
          Deletes the provided project from the database.
 void removeProjectCategory(Long id)
          Removes the given ProjectCategory.
 void removeProjectIssues(Project project)
          Removes all issues for a particular project.
 void setCurrentCounterForProject(Project project, long counter)
          Set the project counter.
 void setProjectCategory(org.ofbiz.core.entity.GenericValue project, org.ofbiz.core.entity.GenericValue category)
          If category is non-null, set project's Project Category to category.
 void setProjectCategory(Project project, ProjectCategory category)
          Sets a project's category.
 Project updateProject(Project updatedProject, String name, String description, String leadKey, String url, Long assigneeType, Long avatarId, String projectKey)
          Updates the project provided with the new attributes passed in.
 void updateProjectCategory(org.ofbiz.core.entity.GenericValue projectCat)
          Persist an updated project category.
 void updateProjectCategory(ProjectCategory projectCategory)
          Persist an updated project category.
 
Methods inherited from class com.atlassian.jira.project.AbstractProjectManager
convertToProjectObjects, convertToProjects, createProject, getDefaultAssignee, getDefaultAssignee, getDefaultAssignee, getProject, getProjectCategoryByName, getProjectCategoryByNameIgnoreCase, getProjectCategoryObjectByName, getProjectCategoryObjectByNameIgnoreCase, isDefaultAssignee, isDefaultAssignee, updateProject, updateProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPLINKS_LOCAL_PROPERTY_PREFIX

public static final String APPLINKS_LOCAL_PROPERTY_PREFIX
See Also:
Constant Field Values
Constructor Detail

DefaultProjectManager

public DefaultProjectManager(OfBizDelegator delegator,
                             NodeAssociationStore nodeAssociationStore,
                             ProjectFactory projectFactory,
                             ProjectRoleManager projectRoleManager,
                             IssueManager issueManager,
                             AvatarManager avatarManager,
                             UserManager userManager,
                             ProjectCategoryStore projectCategoryStore,
                             ApplicationProperties applicationProperties,
                             ProjectKeyStore projectKeyStore,
                             TransactionSupport transactionSupport,
                             PropertiesManager propertiesManager,
                             JsonEntityPropertyManager jsonEntityPropertyManager)
Method Detail

createProject

public Project createProject(String name,
                             String key,
                             String description,
                             String leadKey,
                             String url,
                             Long assigneeType,
                             Long avatarId)
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.

WARNING: In 6.0, the documentation for this method incorrectly stated that this method would interpret the lead as a username, when it was in fact interpreted as a userkey. The method signatures and documentation have been updated to describe the actual behaviour.

Parameters:
name - The name of the new project
key - The project key of the new project
description - An optional description for the project
leadKey - The userkey of 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.
avatarId - the id of an existing system avatar.
Returns:
The newly created project.

getNextId

public long getNextId(Project project)
Description copied from interface: ProjectManager
Get the next issue ID from this project (transactional). Each project maintains an internal counter for the number of issues. This method may be used to construct a new issue key.

Parameters:
project - The Project
Returns:
A long value representing a new issue id for the project.

updateProject

public Project updateProject(Project updatedProject,
                             String name,
                             String description,
                             String leadKey,
                             String url,
                             Long assigneeType,
                             Long avatarId,
                             String projectKey)
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.

Parameters:
updatedProject - The project to be updated.
name - The name for the updated project
description - An optional description for the project
leadKey - The userkey of 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.
projectKey - The new project key (not updated if null)
Returns:
The updated project

removeProjectIssues

public void removeProjectIssues(Project project)
                         throws RemoveException
Description copied from interface: ProjectManager
Removes all issues for a particular project. A RemoveException will be thrown on any errors removing issues.

Parameters:
project - The project for which issues will be deleted.
Throws:
RemoveException - if there's any errors removing issues

removeProject

public void removeProject(Project project)
Description copied from interface: ProjectManager
Deletes the provided project from the database. Please note that this method only deletes the project itself and not any related entities. Use ProjectService.deleteProject(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.bc.project.ProjectService.DeleteProjectValidationResult) to properly delete a project.

Parameters:
project - The project to be deleted.

getProject

public org.ofbiz.core.entity.GenericValue getProject(Long id)
Description copied from interface: ProjectManager
Retrieve a single project by it's id.

Parameters:
id - the Project ID.
Returns:
GenericValue representation of a Project.

getProjectObj

public Project getProjectObj(Long id)
Description copied from interface: ProjectManager
Retrieves a single Project by its id.

Parameters:
id - ID of the Project.
Returns:
Project object or null if project with that id doesn't exist.

getProjectByName

public org.ofbiz.core.entity.GenericValue getProjectByName(String name)
Description copied from interface: ProjectManager
Retrieve a single project by it's project name.

Parameters:
name - project name
Returns:
GenericValue representation of a Project.

getProjectByKey

public org.ofbiz.core.entity.GenericValue getProjectByKey(String key)
Description copied from interface: ProjectManager
Retrieve a single project by it's project key.

Parameters:
key - the project key
Returns:
GenericValue representation of a Project.

getProjectByCurrentKey

public Project getProjectByCurrentKey(String projectKey)
Description copied from interface: ProjectManager
Returns the Project with the given project key.

This method will strictly only return the project whose current project key is the one given.

This method is added to the API in anticipation of being able to edit the project key, but this feature has not actually been added in 6.0.

Specified by:
getProjectByCurrentKey in interface ProjectManager
Overrides:
getProjectByCurrentKey in class AbstractProjectManager
Parameters:
projectKey - the Project key.
Returns:
the Project with the given project key.
See Also:
ProjectManager.getProjectObjByKey(String)

getProjectObjByKey

public Project getProjectObjByKey(String projectKey)
Description copied from interface: ProjectManager
Returns a Project object based on the passed in project key.

Parameters:
projectKey - the Project key.
Returns:
the Project object specified by the key or null

getProjectByCurrentKeyIgnoreCase

public Project getProjectByCurrentKeyIgnoreCase(String projectKey)
Description copied from interface: ProjectManager
Returns a Project object based on the passed in project key, not taking into account the case of the project key.

Parameters:
projectKey - the project key, case does not matter.
Returns:
the project object specified by the key or null if no such project exists.

getProjectObjByKeyIgnoreCase

public Project getProjectObjByKeyIgnoreCase(String projectKey)
Description copied from interface: ProjectManager
Returns a Project object based on the passed in project key, not taking into account the case of the project key. Matches also by previous keys that were associated with a project.

Parameters:
projectKey - the project key, case does not matter.
Returns:
the project object specified by the key or null if no such project exists.

getAllProjectKeys

public Set<String> getAllProjectKeys(Long projectId)
Description copied from interface: ProjectManager
Returns all project keys that are associated with Project.

Returns:
all project keys (including the current one) associated with the project

getProjectObjByName

public Project getProjectObjByName(String projectName)
Description copied from interface: ProjectManager
Returns a Project object based on the passed in project name.

Parameters:
projectName - the name of the project
Returns:
the Project object specified by the supplied name or null

getComponent

@Deprecated
public org.ofbiz.core.entity.GenericValue getComponent(Long id)
Deprecated. use ProjectComponentManager instead

Description copied from interface: ProjectManager
Get a component from within this project, by it's id.

Parameters:
id - id
Returns:
A component GenericValue.
See Also:
ProjectComponentManager.find(Long)

getComponent

@Deprecated
public org.ofbiz.core.entity.GenericValue getComponent(org.ofbiz.core.entity.GenericValue project,
                                                                  String name)
Deprecated. use ProjectComponentManager instead

Description copied from interface: ProjectManager
Get a component from within this project, based on the project and the component name. NOTE: This is not cached currently.

Parameters:
project - project
name - name
Returns:
A component GenericValue.
See Also:
ProjectComponentManager.findByComponentName(java.lang.Long, java.lang.String)

getComponents

@Deprecated
public Collection<org.ofbiz.core.entity.GenericValue> getComponents(org.ofbiz.core.entity.GenericValue project)
Deprecated. use ProjectComponentManager instead

Description copied from interface: ProjectManager
Returns a collection of components in a project.

Parameters:
project - project
Returns:
A collection of GenericValues.
See Also:
ProjectComponentManager.findAllForProject(java.lang.Long)

getProjects

public Collection<org.ofbiz.core.entity.GenericValue> getProjects()
Return all project GenericValues.

Returns:
all projects as Collection

getProjectObjects

public List<Project> getProjectObjects()
                                throws DataAccessException
Description copied from interface: ProjectManager
Return all Projects ordered by name.

Returns:
all projects ordered by name.
Throws:
DataAccessException - If any errors occur accessing the DB.

getProjectCount

public long getProjectCount()
                     throws DataAccessException
Description copied from interface: ProjectManager
Return the total number of Projects.

Returns:
A long value representing tht total number of projects.
Throws:
DataAccessException - if any errors occur accessing the DB.

getDelegator

protected OfBizDelegator getDelegator()

getProjectCategories

public Collection<org.ofbiz.core.entity.GenericValue> getProjectCategories()
Description copied from interface: ProjectManager
Get all ProjectCategories.

Returns:
A collection of category GenericValues

getAllProjectCategories

public List<ProjectCategory> getAllProjectCategories()
Description copied from interface: ProjectManager
Returns all ProjectCategories, ordered by name.

Returns:
all ProjectCategories, ordered by name.

getProjectCategory

public org.ofbiz.core.entity.GenericValue getProjectCategory(Long id)
Description copied from interface: ProjectManager
Returns a single project category by id.

Parameters:
id - Project Category ID.
Returns:
A category GenericValue

getProjectCategoryObject

public ProjectCategory getProjectCategoryObject(Long id)
Description copied from interface: ProjectManager
Returns a single project category by id.

Parameters:
id - Project Category ID.
Returns:
The project category

updateProjectCategory

public void updateProjectCategory(org.ofbiz.core.entity.GenericValue projectCat)
Description copied from interface: ProjectManager
Persist an updated project category.

Parameters:
projectCat - project category.

updateProjectCategory

public void updateProjectCategory(ProjectCategory projectCategory)
                           throws DataAccessException
Description copied from interface: ProjectManager
Persist an updated project category.

Parameters:
projectCategory - project category.
Throws:
DataAccessException - If any errors occur accessing the DB.

getProjectsFromProjectCategory

public Collection<org.ofbiz.core.entity.GenericValue> getProjectsFromProjectCategory(org.ofbiz.core.entity.GenericValue projectCategory)
Gather a list of projects that are in a project category.

Parameters:
projectCategory - Project to look up against
Returns:
Collection of Projects

getProjectsFromProjectCategory

public Collection<Project> getProjectsFromProjectCategory(ProjectCategory projectCategory)
                                                   throws DataAccessException
Description copied from interface: ProjectManager
Returns a list of projects in a particular category.

Parameters:
projectCategory - project category.
Returns:
A collection of projects sorted by name.
Throws:
DataAccessException - If any errors occur accessing the DB.

getProjectObjectsFromProjectCategory

public Collection<Project> getProjectObjectsFromProjectCategory(Long projectCategoryId)
Description copied from interface: ProjectManager
Returns a list of projects in a particular category.

Parameters:
projectCategoryId - project category id.
Returns:
A collection of project Projects sorted by name.

getProjectsWithNoCategory

public Collection<org.ofbiz.core.entity.GenericValue> getProjectsWithNoCategory()
Gets a list of projects that are not associated with any project category

Returns:
A collection of project GenericValues sorted by name

getProjectObjectsWithNoCategory

public Collection<Project> getProjectObjectsWithNoCategory()
                                                    throws DataAccessException
Description copied from interface: ProjectManager
Returns a list of projects without project category, sorted by project name

Returns:
A collection of Projects sorted by name
Throws:
DataAccessException - If any errors occur accessing the DB.

getProjectCategoryFromProject

public org.ofbiz.core.entity.GenericValue getProjectCategoryFromProject(org.ofbiz.core.entity.GenericValue project)
Get the Project Category given a Project.

Parameters:
project - Project
Returns:
Project Category

getProjectCategoryForProject

public ProjectCategory getProjectCategoryForProject(Project project)
                                             throws DataAccessException
Description copied from interface: ProjectManager
Returns a project's category.

Parameters:
project - project
Returns:
A ProjectCategory or null if this project has no category.
Throws:
DataAccessException - If any errors occur accessing the DB.

isAssignee

public boolean isAssignee(org.ofbiz.core.entity.GenericValue project,
                          com.atlassian.crowd.embedded.api.User user)
Description copied from interface: ProjectManager
Checks if given user is assignee of at least one issue in the given project.

Parameters:
project - project
user - user
Returns:
true if given user is assignee of at least one issue in the given project, false otherwise

isAssignee

public boolean isAssignee(Project project,
                          com.atlassian.crowd.embedded.api.User user)
Description copied from interface: ProjectManager
Checks if given user is assignee of at least one issue in the given project.

Parameters:
project - project
user - user
Returns:
true if given user is assignee of at least one issue in the given project, false otherwise

createProjectCategory

public ProjectCategory createProjectCategory(String name,
                                             String description)
Description copied from interface: ProjectManager
Creates a new ProjectCategory with the given name and description.

Parameters:
name - the Name
description - the Description.
Returns:
the new ProjectCategory.

removeProjectCategory

public void removeProjectCategory(Long id)
Description copied from interface: ProjectManager
Removes the given ProjectCategory.

Parameters:
id - the ProjectCategory to remove.

setProjectCategory

public void setProjectCategory(org.ofbiz.core.entity.GenericValue project,
                               org.ofbiz.core.entity.GenericValue category)
If category is non-null, set project's Project Category to category. If category is null, remove project's Project Category association, if one exists.

Parameters:
project - project
category - category

setProjectCategory

public void setProjectCategory(Project project,
                               ProjectCategory category)
Description copied from interface: ProjectManager
Sets a project's category.

Parameters:
project - project
category - category

getProjectsLeadBy

public List<Project> getProjectsLeadBy(com.atlassian.crowd.embedded.api.User leadUser)
Description copied from interface: ProjectManager
Returns all the projects that leadUser is the project lead for ordered by the name of the Project.

Parameters:
leadUser - Project Lead
Returns:
A collection of projects

getProjectsLeadBy

public List<Project> getProjectsLeadBy(ApplicationUser leadUser)
Description copied from interface: ProjectManager
Returns all the projects that leadUser is the project lead for ordered by the name of the Project.

Parameters:
leadUser - Project Lead
Returns:
A collection of projects

getProjectsByLead

public final Collection<org.ofbiz.core.entity.GenericValue> getProjectsByLead(com.atlassian.crowd.embedded.api.User leadUser)
Description copied from interface: ProjectManager
Returns all the projects that leadUser is the project lead for.

Parameters:
leadUser - Project Lead
Returns:
A collection of project GenericValues

refresh

public void refresh()
Description copied from interface: ProjectManager
Causes a full refresh of the project cache.


getCurrentCounterForProject

public long getCurrentCounterForProject(Long id)
Description copied from interface: ProjectManager
Returns the curremt issue counter for the given project. This value is for information only; you should not use it to predict or create issue ids, because it may change concurrently as new issues are created.

Parameters:
id - the ID of the project for which to retrieve the counter
Returns:
the current project counter (the id of the next issue to be created).

setCurrentCounterForProject

public void setCurrentCounterForProject(Project project,
                                        long counter)
Description copied from interface: ProjectManager
Set the project counter. Warning Setting the project counter is not needed in the normal operations of JIRA, this method exist for functionality like project-import etc.

Parameters:
project - the project for which to set the counter (required)
counter - the counter value to set


Copyright © 2002-2014 Atlassian. All Rights Reserved.