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 ProjectcreateAndSaveProject(@NotNull String key, @NotNull String name, @Nullable String description, boolean grantAllUsersAccess)Create new project and store it.@NotNull ProjectcreateProject(@NotNull String key, @NotNull String name, @NotNull String description)Creates a new ProjectvoiddeleteProject(@NotNull Project project)Removes the project from the system@NotNull Set<Project>getAllProjects()Returns a collection ofProjectobjects@NotNull Collection<Project>getAllProjectsMarkedForDeletion()@NotNull List<Project>getEmptyProjects()Returns empty projects.NumbergetNonDeletedProjectCount()Returns the number of projects, excluding the ones marked for deletion.@NotNull List<Project>getNonEmptyProjects()Returns non empty projects.@Nullable ProjectgetProjectById(long id)Returns the project given the id.ProjectgetProjectByKey(@NotNull String key)Returns the project given a project key.ProjectgetProjectByName(@NotNull String projectName)Returns project by name.@Nullable ProjectgetProjectByOid(@NotNull BambooEntityOid oid)Returns project by oid.@NotNull NumbergetProjectCount()Returns the number of projects, including the ones marked for deletion.@NotNull Set<Project>getProjects()Returns a collection ofProjectobjects@NotNull List<Project>getSortedProjects()Returns a sorted by name list of projects.booleanisExistingProjectKey(@NotNull String projectKey)Returns true if the project name already existsbooleanisExistingProjectName(@NotNull String projectName)Returns true if the project name already existsvoidsaveProject(@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:ProjectManagerCreates a new Project- Specified by:
createProjectin 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:ProjectManagerCreate new project and store it.- Specified by:
createAndSaveProjectin 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:ProjectManagerReturns a collection ofProjectobjects- Specified by:
getProjectsin interfaceProjectManager- Returns:
- all Projects in the system, excluding the ones marked for deletion
-
getNonEmptyProjects
@NotNull public @NotNull List<Project> getNonEmptyProjects()
Description copied from interface:ProjectManagerReturns non empty projects.- Specified by:
getNonEmptyProjectsin interfaceProjectManager- Returns:
- projects not marked for deletion with top level plans
-
getEmptyProjects
@NotNull public @NotNull List<Project> getEmptyProjects()
Description copied from interface:ProjectManagerReturns empty projects.- Specified by:
getEmptyProjectsin interfaceProjectManager- Returns:
- projects not marked for deletion without top level plans
-
getSortedProjects
@NotNull public @NotNull List<Project> getSortedProjects()
Description copied from interface:ProjectManagerReturns a sorted by name list of projects.- Specified by:
getSortedProjectsin interfaceProjectManager
-
getAllProjects
@NotNull public @NotNull Set<Project> getAllProjects()
Description copied from interface:ProjectManagerReturns a collection ofProjectobjects- Specified by:
getAllProjectsin interfaceProjectManager- Returns:
- all Projects in the system, including the ones marked for deletion
-
getProjectCount
@NotNull public @NotNull Number getProjectCount()
Description copied from interface:ProjectManagerReturns the number of projects, including the ones marked for deletion.- Specified by:
getProjectCountin interfaceProjectManager
-
getNonDeletedProjectCount
public Number getNonDeletedProjectCount()
Description copied from interface:ProjectManagerReturns the number of projects, excluding the ones marked for deletion.- Specified by:
getNonDeletedProjectCountin interfaceProjectManager
-
getProjectByKey
public Project getProjectByKey(@NotNull @NotNull String key)
Description copied from interface:ProjectManagerReturns 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:
getProjectByKeyin interfaceProjectManager- Parameters:
key- - the project key e.g. BAMBOO (not BAMBOO-TRUNK)- Returns:
- A
Projectif the key matches. Otherwise null
-
getProjectById
@Nullable public @Nullable Project getProjectById(long id)
Description copied from interface:ProjectManagerReturns the project given the id. This method returns both not marked and marked for deletion projects, so be careful when using it.- Specified by:
getProjectByIdin 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:ProjectManagerReturns project by oid. Only not marked for deletion projects are returned.- Specified by:
getProjectByOidin interfaceProjectManager
-
getProjectByName
public Project getProjectByName(@NotNull @NotNull String projectName)
Description copied from interface:ProjectManagerReturns project by name. This method returns both not marked and marked for deletion projects, so be careful when using it.- Specified by:
getProjectByNamein interfaceProjectManager- Returns:
- project
-
isExistingProjectName
public boolean isExistingProjectName(@NotNull @NotNull String projectName)Description copied from interface:ProjectManagerReturns true if the project name already exists- Specified by:
isExistingProjectNamein interfaceProjectManager- Parameters:
projectName- to check- Returns:
- true if projectName already exists
-
isExistingProjectKey
public boolean isExistingProjectKey(@NotNull @NotNull String projectKey)Description copied from interface:ProjectManagerReturns true if the project name already exists- Specified by:
isExistingProjectKeyin interfaceProjectManager- Parameters:
projectKey- to check- Returns:
- true if projectName already exists
-
saveProject
public void saveProject(@NotNull @NotNull Project project)Description copied from interface:ProjectManagerSaves the project. For new project it creates required ACL records.- Specified by:
saveProjectin interfaceProjectManager- Parameters:
project- to be saved
-
deleteProject
public void deleteProject(@NotNull @NotNull Project project)Description copied from interface:ProjectManagerRemoves the project from the system- Specified by:
deleteProjectin interfaceProjectManager- Parameters:
project- project
-
getAllProjectsMarkedForDeletion
@NotNull public @NotNull Collection<Project> getAllProjectsMarkedForDeletion()
- Specified by:
getAllProjectsMarkedForDeletionin interfaceProjectManager- Returns:
- all
Projects that are marked for deletion..
-
-