Package com.atlassian.bamboo.project
Class DefaultProjectManager
- java.lang.Object
-
- com.atlassian.bamboo.project.DefaultProjectManager
-
- All Implemented Interfaces:
ProjectManager
public class DefaultProjectManager extends Object implements ProjectManager
-
-
Constructor Summary
Constructors Constructor Description DefaultProjectManager(BambooAclUpdateHelper aclUpdateHelper, HibernateMutableAclService aclService, ProjectDao projectDao, VariableDefinitionDao variableDefinitionDao, CredentialsDao credentialsDao, RepositoryDefinitionDao repositoryDefinitionDao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Project
createAndSaveProject(@NotNull String key, @NotNull String name, @Nullable String description, boolean grantAllUsersAccess)
Create new project and store it.@NotNull Project
createProject(@NotNull String key, @NotNull String name, @NotNull String description)
Creates a new Projectvoid
deleteProject(@NotNull Project project)
Removes the project from the system@NotNull Set<Project>
getAllProjects()
Returns a collection ofProject
objects@NotNull Collection<Project>
getAllProjectsMarkedForDeletion()
@NotNull List<Project>
getEmptyProjects()
Returns empty projects.Number
getNonDeletedProjectCount()
Returns the number of projects, excluding the ones marked for deletion.@NotNull List<Project>
getNonEmptyProjects()
Returns non empty projects.@Nullable Project
getProjectById(long id)
Returns the project given the id.Project
getProjectByKey(@NotNull String key)
Returns the project given a project key.Project
getProjectByName(@NotNull String projectName)
Returns project by name.@Nullable Project
getProjectByOid(@NotNull BambooEntityOid oid)
Returns project by oid.@NotNull Number
getProjectCount()
Returns the number of projects, including the ones marked for deletion.@NotNull Set<Project>
getProjects()
Returns a collection ofProject
objects@NotNull List<Project>
getSortedProjects()
Returns a sorted by name list of projects.boolean
isExistingProjectKey(@NotNull String projectKey)
Returns true if the project name already existsboolean
isExistingProjectName(@NotNull String projectName)
Returns true if the project name already existsvoid
saveProject(@NotNull Project project)
Saves the project.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.project.ProjectManager
createProject
-
-
-
-
Constructor Detail
-
DefaultProjectManager
public DefaultProjectManager(BambooAclUpdateHelper aclUpdateHelper, HibernateMutableAclService aclService, ProjectDao projectDao, VariableDefinitionDao variableDefinitionDao, CredentialsDao credentialsDao, RepositoryDefinitionDao repositoryDefinitionDao)
-
-
Method Detail
-
createProject
@NotNull public @NotNull Project createProject(@NotNull @NotNull String key, @NotNull @NotNull String name, @NotNull @NotNull String description)
Description copied from interface:ProjectManager
Creates a new Project- Specified by:
createProject
in interfaceProjectManager
- Parameters:
key
- project keyname
- project namedescription
- project description- Returns:
- project
-
createAndSaveProject
public Project createAndSaveProject(@NotNull @NotNull String key, @NotNull @NotNull String name, @Nullable @Nullable String description, boolean grantAllUsersAccess)
Description copied from interface:ProjectManager
Create new project and store it.- Specified by:
createAndSaveProject
in interfaceProjectManager
- Parameters:
key
- project keyname
- project namedescription
- project descriptiongrantAllUsersAccess
- if anonymous and logged-in users should have READ permission for new project- Returns:
- project
-
getProjects
@NotNull public @NotNull Set<Project> getProjects()
Description copied from interface:ProjectManager
Returns a collection ofProject
objects- Specified by:
getProjects
in interfaceProjectManager
- Returns:
- all Projects in the system, excluding the ones marked for deletion
-
getNonEmptyProjects
@NotNull public @NotNull List<Project> getNonEmptyProjects()
Description copied from interface:ProjectManager
Returns non empty projects.- Specified by:
getNonEmptyProjects
in interfaceProjectManager
- Returns:
- projects not marked for deletion with top level plans
-
getEmptyProjects
@NotNull public @NotNull List<Project> getEmptyProjects()
Description copied from interface:ProjectManager
Returns empty projects.- Specified by:
getEmptyProjects
in interfaceProjectManager
- Returns:
- projects not marked for deletion without top level plans
-
getSortedProjects
@NotNull public @NotNull List<Project> getSortedProjects()
Description copied from interface:ProjectManager
Returns a sorted by name list of projects.- Specified by:
getSortedProjects
in interfaceProjectManager
-
getAllProjects
@NotNull public @NotNull Set<Project> getAllProjects()
Description copied from interface:ProjectManager
Returns a collection ofProject
objects- Specified by:
getAllProjects
in interfaceProjectManager
- Returns:
- all Projects in the system, including the ones marked for deletion
-
getProjectCount
@NotNull public @NotNull Number getProjectCount()
Description copied from interface:ProjectManager
Returns the number of projects, including the ones marked for deletion.- Specified by:
getProjectCount
in interfaceProjectManager
-
getNonDeletedProjectCount
public Number getNonDeletedProjectCount()
Description copied from interface:ProjectManager
Returns the number of projects, excluding the ones marked for deletion.- Specified by:
getNonDeletedProjectCount
in interfaceProjectManager
-
getProjectByKey
public Project getProjectByKey(@NotNull @NotNull String key)
Description copied from interface:ProjectManager
Returns the project given a project key. This method returns both not marked and marked for deletion projects, so be careful when using it.- Specified by:
getProjectByKey
in interfaceProjectManager
- Parameters:
key
- - the project key e.g. BAMBOO (not BAMBOO-TRUNK)- Returns:
- A
Project
if the key matches. Otherwise null
-
getProjectById
@Nullable public @Nullable Project getProjectById(long id)
Description copied from interface:ProjectManager
Returns the project given the id. This method returns both not marked and marked for deletion projects, so be careful when using it.- Specified by:
getProjectById
in interfaceProjectManager
- Parameters:
id
- project id- Returns:
- A
Project
. null if not found.
-
getProjectByOid
@Nullable public @Nullable Project getProjectByOid(@NotNull @NotNull BambooEntityOid oid)
Description copied from interface:ProjectManager
Returns project by oid. Only not marked for deletion projects are returned.- Specified by:
getProjectByOid
in interfaceProjectManager
-
getProjectByName
public Project getProjectByName(@NotNull @NotNull String projectName)
Description copied from interface:ProjectManager
Returns project by name. This method returns both not marked and marked for deletion projects, so be careful when using it.- Specified by:
getProjectByName
in interfaceProjectManager
- Returns:
- project
-
isExistingProjectName
public boolean isExistingProjectName(@NotNull @NotNull String projectName)
Description copied from interface:ProjectManager
Returns true if the project name already exists- Specified by:
isExistingProjectName
in interfaceProjectManager
- Parameters:
projectName
- to check- Returns:
- true if projectName already exists
-
isExistingProjectKey
public boolean isExistingProjectKey(@NotNull @NotNull String projectKey)
Description copied from interface:ProjectManager
Returns true if the project name already exists- Specified by:
isExistingProjectKey
in interfaceProjectManager
- Parameters:
projectKey
- to check- Returns:
- true if projectName already exists
-
saveProject
public void saveProject(@NotNull @NotNull Project project)
Description copied from interface:ProjectManager
Saves the project. For new project it creates required ACL records.- Specified by:
saveProject
in interfaceProjectManager
- Parameters:
project
- to be saved
-
deleteProject
public void deleteProject(@NotNull @NotNull Project project)
Description copied from interface:ProjectManager
Removes the project from the system- Specified by:
deleteProject
in interfaceProjectManager
- Parameters:
project
- project
-
getAllProjectsMarkedForDeletion
@NotNull public @NotNull Collection<Project> getAllProjectsMarkedForDeletion()
- Specified by:
getAllProjectsMarkedForDeletion
in interfaceProjectManager
- Returns:
- all
Project
s that are marked for deletion..
-
-