Package com.adobe.cq.projects.api
Interface ProjectManager
-
public interface ProjectManager
TheProjectManager
provides the ability to retrieve projects, delete projects, and create projects.ProjectManager
instances are adapted fromResourceResolver
.Note that Projects can also be adapted from a
Resource
if that resource represents a Project.Note that all changes are transient and need to be committed by the caller. For example:
ResourceResolver resourceResolver = ... ProjectManager pm = resourceResolver.adaptTo(ProjectManager.class); Project project = pm.createProject("Test 1"); project.setDescription("This is a test project"); resourceResolver.commit();
- See Also:
ResourceResolver
,Resource
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Project
createProject(java.lang.String title, java.lang.String templatePath)
Creates a new project with the specified title.Project
createProject(java.lang.String nodeName, java.lang.String title, java.lang.String templatePath)
Creates a new project with the specified title.Project
createProject(java.lang.String parentPath, java.lang.String nodeName, java.lang.String title, java.lang.String templatePath)
Creates a new project with the specified root folder, title and template.Project
createProjectFromMasterProject(java.lang.String parentPath, java.lang.String nodeName, java.lang.String title, java.lang.String templatePath, java.lang.String description, Project masterProject, boolean useDefaultCoverImage)
Creates a new project from Master Project with the specified root folder, title and template.void
deleteProject(Project project)
Deletes the specified project.java.util.Iterator<Resource>
getChildren(java.lang.String folderPath, ProjectFilter filter, int startIndex, int limit)
Retrieves an iterator over project and folder resources in the specified folder.java.util.Iterator<Project>
getProjects(ProjectFilter filter, int startIndex, int limit)
Retrieves an iterator over projects that are accessible by the current user.java.util.List<WorkflowModel>
getWorkflows(Project project)
Return the list of workflows that are available for the project.
-
-
-
Method Detail
-
getProjects
java.util.Iterator<Project> getProjects(ProjectFilter filter, int startIndex, int limit)
Retrieves an iterator over projects that are accessible by the current user.- Parameters:
filter
- used to filter the list of returned projectsstartIndex
- the index of the first project to retrievelimit
- the maximum number of projects to retrieve- Returns:
- an iterator over Projects.
- Throws:
ProjectException
- if the loading of the projects fails.
-
getChildren
java.util.Iterator<Resource> getChildren(java.lang.String folderPath, ProjectFilter filter, int startIndex, int limit)
Retrieves an iterator over project and folder resources in the specified folder. The returned iterator also hides the legacy bucket structure of projects by returning any projects in a bucket under the current path as part its parent folder. E.g. iterating over /content/projects, where the structure is: /content/projects/bucket/project1 /content/projects/bucket/project2 /content/projects/project3 /content/projects/somefolder/project4 this will in the iteration return: - 'project1' and 'project2' (because the bucket structure is hidden by this iterator) - 'project3' (since it's part of the current parent of /content/projects) - 'somefolder' (since it's also part of the current parent) however it will not include 'project4' since it is under a regular folder 'somefolder'- Parameters:
folderPath
- root path where to start iterating fromfilter
- used to filter the list of returned projectsstartIndex
- the index of the first project to retrieve. A negative value behaves the same as a value of 0.limit
- the maximum number of projects to retrieve. A negative value means no limit.- Returns:
- an iterator over Projects.
- Throws:
ProjectException
- if the loading of the projects fails.
-
deleteProject
void deleteProject(Project project)
Deletes the specified project.- Parameters:
project
- the project to delete.- Throws:
ProjectException
- if the project can not be deleted, for example due to access restrictions.
-
createProject
Project createProject(java.lang.String title, java.lang.String templatePath)
Creates a new project with the specified title.- Parameters:
title
- the title of the new projecttemplatePath
- the path of the template to create the project with.- Returns:
- a new project instance
- Throws:
ProjectException
- in case an error occurred.
-
createProject
Project createProject(java.lang.String nodeName, java.lang.String title, java.lang.String templatePath)
Creates a new project with the specified title.- Parameters:
nodeName
- the name of the node that will be created. If a node exists with the current name a unique name will be generated with the nodeName as the prefix.title
- the title of the new projecttemplatePath
- the path of the template to create the project with.- Returns:
- a new project instance
- Throws:
ProjectException
- in case an error occurred.
-
createProject
Project createProject(java.lang.String parentPath, java.lang.String nodeName, java.lang.String title, java.lang.String templatePath)
Creates a new project with the specified root folder, title and template.- Parameters:
parentPath
- the parent path of where this project will be created.nodeName
- the name of the node that will be created. If a node exists with the current name a unique name will be generated with the nodeName as the prefix.title
- the title of the new projecttemplatePath
- the path of the template to create the project with.- Returns:
- a new project instance
- Throws:
ProjectException
- in case an error occurred.
-
createProjectFromMasterProject
Project createProjectFromMasterProject(java.lang.String parentPath, java.lang.String nodeName, java.lang.String title, java.lang.String templatePath, java.lang.String description, Project masterProject, boolean useDefaultCoverImage)
Creates a new project from Master Project with the specified root folder, title and template.- Parameters:
parentPath
- the parent path of where this project will be created.nodeName
- the name of the node that will be created. If a node exists with the current name a unique name will be generated with the nodeName as the prefix.title
- the title of the new projecttemplatePath
- the path of the template to create the project with.description
- the description of the new projectmasterProject
- the Master Project which would be used to create the new projectuseDefaultCoverImage
- whether to use default cover image or not- Returns:
- a new project instance
-
getWorkflows
java.util.List<WorkflowModel> getWorkflows(Project project)
Return the list of workflows that are available for the project.- Parameters:
project
- the project which to retrieve the availableWorkflowModel
s for.- Returns:
- the collection of available
WorkflowModel
s.
-
-