Class ProjectDao
java.lang.Object
ch.colabproject.colab.api.persistence.jpa.project.ProjectDao
Project persistence
Note : Most of database operations are handled by managed entities and cascade.
- Author:
- maxence
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteProject(Project project) Delete the project from database.Get the list of all global projectGet the list of all projectbooleanDo two users work with a common project ?findOldDeletedProjects(DeletionStatus deletionStatus, int nbWaitingDays) Get the projects matching the given deletion status for the given number of daysfindProject(Long id) Find a project by idfindProjectsByInstanceMaker(Long userId) Get all projects the user is an instance maker forfindProjectsByTeamMember(Long userId) Get all projects the user is a team member offindProjectsIdsByInstanceMaker(Long userId) Get the ids of the models the user is an instance maker forfindProjectsIdsByTeamMember(Long userId) Get the ids of the projects the user is a team member ofpersistProject(Project project) Persist a brand new project to databaseupdateProject(Project project) Update project.
-
Constructor Details
-
ProjectDao
public ProjectDao()
-
-
Method Details
-
findProject
Find a project by id- Parameters:
id- the id of the project to fetch- Returns:
- the project with the given id or null is such a project does not exist
-
findAllProject
Get the list of all project- Returns:
- list of all projects
-
findAllGlobalModels
Get the list of all global project- Returns:
- list of all global projects
-
findProjectsByTeamMember
Get all projects the user is a team member of- Parameters:
userId- the id of the user- Returns:
- list of projects
-
findProjectsIdsByTeamMember
Get the ids of the projects the user is a team member of- Parameters:
userId- the id of the user- Returns:
- list of ids of projects
-
findProjectsByInstanceMaker
Get all projects the user is an instance maker for- Parameters:
userId- the id of the user- Returns:
- list of projects
-
findProjectsIdsByInstanceMaker
Get the ids of the models the user is an instance maker for- Parameters:
userId- the id of the user- Returns:
- list of ids of models
-
findIfUsersHaveCommonProject
Do two users work with a common project ?- Parameters:
a- a userb- another user- Returns:
- true if both user are both member or instance maker of the same project
-
findOldDeletedProjects
Get the projects matching the given deletion status for the given number of days- Parameters:
deletionStatus- Deletion statusnbWaitingDays- Number of days since the project was deleted- Returns:
- List of matching projects
-
updateProject
Update project. Only fields which are editable by users will be impacted.- Parameters:
project- the project as supplied by clients (ie not managed by JPA)- Returns:
- return updated managed project
- Throws:
ColabMergeException- if the update failed
-
persistProject
Persist a brand new project to database- Parameters:
project- the new project to persist- Returns:
- the new persisted and managed project
-
deleteProject
Delete the project from database. This can't be undone- Parameters:
project- the project to delete
-