Interface ProjectService
-
- All Superinterfaces:
CRUDService<java.lang.Long,Project>
- All Known Implementing Classes:
ProjectServiceImpl
public interface ProjectService extends CRUDService<java.lang.Long,Project>
A specialized service layer for projects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Join<Project,ReferenceFile>addReferenceFileToProject(Project project, ReferenceFile referenceFile)Add aReferenceFileto aProject.RelatedProjectJoinaddRelatedProject(Project subject, Project relatedProject)Join<Project,Sample>addSampleToProject(Project project, Sample sample, boolean owner)Join<Project,UserGroup>addUserGroupToProject(Project project, UserGroup userGroup, ProjectRole role, ProjectMetadataRole metadataRole)Join<Project,User>addUserToProject(Project project, User user, ProjectRole role, ProjectMetadataRole metadataRole)ProjectcreateProjectWithSamples(Project project, java.util.List<java.lang.Long> sampleIds, boolean owner)org.springframework.data.domain.Page<Project>findAllProjects(java.lang.String searchValue, int currentPage, int length, org.springframework.data.domain.Sort sort)Find a paged list of all projects (for admin) using the specified search criteria.org.springframework.data.domain.Page<Project>findProjectsForUser(java.lang.String search, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort sort)Find a list of projects (for a user or admin) using the specified search criteriajava.lang.LonggetProjectsCreated(java.util.Date createdDate)Get count of projects created in the time periodjava.util.List<GenericStatModel>getProjectsCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)Get list ofGenericStatModelof projects created in the past n time period and grouped by the format provided.java.util.List<ProjectAnalysisSubmissionJoin>getProjectsForAnalysisSubmission(AnalysisSubmission submission)Get allProjects a givenAnalysisSubmissionis shared withjava.util.List<Join<Project,Sample>>getProjectsForSample(Sample sample)Get the projects that a given sample is onjava.util.Set<Project>getProjectsForSequencingObjects(java.util.Collection<? extends SequencingObject> sequences)Get a Set of allProjects referred to by a collection ofSequencingObjectsjava.util.List<Join<Project,User>>getProjectsForUser(User user)java.util.List<Project>getProjectsForUserUnique(User user)java.util.List<Project>getProjectsUsedInAnalysisSubmission(AnalysisSubmission submission)Get allProjects that have data used within anAnalysisSubmission.java.util.List<Project>getProjectsWithRemoteSyncStatus(RemoteStatus.SyncStatus syncStatus)Get a list ofProjects from remote sites that have a givenRemoteStatus.SyncStatusProjectUserJoingetProjectUserJoin(User user, Project project)java.util.List<RelatedProjectJoin>getRelatedProjects(Project project)Get allRelatedProjectJoins for a givenProjectjava.util.List<Project>getRemoteProjects()Get a list of allProjects from remote sitesjava.util.List<RelatedProjectJoin>getReverseRelatedProjects(Project project)Get allRelatedProjectJoins where the given Project is the relatedProject property.org.springframework.data.domain.Page<Project>getUnassociatedProjects(Project p, java.lang.String searchName, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort.Direction sortDirection, java.lang.String... sortedBy)Get a page of projects eligible to be marked as associated projects for the specified project.java.util.Collection<UserGroupProjectJoin>getUserGroupProjectJoins(User user, Project project)ProjectSampleJoinmoveSampleBetweenProjects(Project source, Project destination, Sample sample)java.util.List<ProjectSampleJoin>moveSamples(Project source, Project destination, java.util.Collection<Sample> samples)voidremoveReferenceFileFromProject(Project project, ReferenceFile referenceFile)Remove aReferenceFilefrom aProjectvoidremoveRelatedProject(RelatedProjectJoin relatedProject)Remove aRelatedProjectJoinvoidremoveRelatedProject(Project subject, Project relatedProject)Remove aRelatedProjectJoinfor the given project and related projectvoidremoveSampleFromProject(Project project, Sample sample)voidremoveSamplesFromProject(Project project, java.lang.Iterable<Sample> samples)voidremoveUserFromProject(Project project, User user)voidremoveUserGroupFromProject(Project project, UserGroup userGroup)java.util.List<ProjectSampleJoin>shareSamples(Project source, Project destination, java.util.Collection<Sample> samples, boolean giveOwner)ProjectupdateProjectSettings(Project project, java.util.Map<java.lang.String,java.lang.Object> updates)Update selectProjectsettingsJoin<Project,UserGroup>updateUserGroupProjectMetadataRole(Project project, UserGroup userGroup, ProjectMetadataRole metadataRole)Join<Project,UserGroup>updateUserGroupProjectRole(Project project, UserGroup userGroup, ProjectRole projectRole, ProjectMetadataRole metadataRole)Join<Project,User>updateUserProjectMetadataRole(Project project, User user, ProjectMetadataRole metadataRole)Join<Project,User>updateUserProjectRole(Project project, User user, ProjectRole projectRole, ProjectMetadataRole metadataRole)booleanuserHasProjectRole(User user, Project project, ProjectRole projectRole)-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, create, delete, exists, findAll, findRevisions, findRevisions, list, list, list, read, readMultiple, search, search, update, updateFields, updateMultiple
-
-
-
-
Method Detail
-
addUserToProject
Join<Project,User> addUserToProject(Project project, User user, ProjectRole role, ProjectMetadataRole metadataRole)
Add the specifiedUserto theProjectwith aRole. If theUseris a manager for theProject, then theUsershould be added to theProjectwith the 'ROLE_MANAGER'Role.- Parameters:
project- theProjectto add the user to.user- the user to add to theProject.role- the role that the user plays on theProject.metadataRole- the access level the user has on the metadata in the project- Returns:
- a reference to the relationship resource created between the two entities.
-
addUserGroupToProject
Join<Project,UserGroup> addUserGroupToProject(Project project, UserGroup userGroup, ProjectRole role, ProjectMetadataRole metadataRole)
Add the specifiedUserGroupto theProjectwith aRole. If theUserGroupis a manager for theProject, then theUserGroupshould be added to theProjectwith the 'ROLE_MANAGER'Role.- Parameters:
project- theProjectto add the user to.userGroup- the user group to add to theProject.role- the role that the group has on theProject.metadataRole- theProjectMetadataRoleto set for the group- Returns:
- a reference to the relationship resource created between the two entities.
-
removeUserFromProject
void removeUserFromProject(Project project, User user) throws ProjectWithoutOwnerException
- Parameters:
project- theProjectto remove theUserfrom.user- theUserto be removed from theProject.- Throws:
ProjectWithoutOwnerException- if removing this user would leave the project without an owner
-
removeUserGroupFromProject
void removeUserGroupFromProject(Project project, UserGroup userGroup) throws ProjectWithoutOwnerException
- Parameters:
project- theProjectto remove theUserfrom.userGroup- theUserGroupto be removed from theProject.- Throws:
ProjectWithoutOwnerException- If removing this group leaves the project without an owner
-
updateUserProjectRole
Join<Project,User> updateUserProjectRole(Project project, User user, ProjectRole projectRole, ProjectMetadataRole metadataRole) throws ProjectWithoutOwnerException
- Parameters:
project- The project to updateuser- The user to updateprojectRole- The role to setmetadataRole-ProjectMetadataRoleto set for the user- Returns:
- The newly updated role object
- Throws:
ProjectWithoutOwnerException- If the role change would leave the project without an owner
-
updateUserProjectMetadataRole
Join<Project,User> updateUserProjectMetadataRole(Project project, User user, ProjectMetadataRole metadataRole)
- Parameters:
project- The project to updateuser- The user to updatemetadataRole- theProjectMetadataRoleto set for the user- Returns:
- The newly updated role object
-
updateUserGroupProjectRole
Join<Project,UserGroup> updateUserGroupProjectRole(Project project, UserGroup userGroup, ProjectRole projectRole, ProjectMetadataRole metadataRole) throws ProjectWithoutOwnerException
- Parameters:
project- The project to updateuserGroup- The user group to updateprojectRole- The role to setmetadataRole- theProjectMetadataRoleto set for the group- Returns:
- The newly updated role object
- Throws:
ProjectWithoutOwnerException- If updating the user group leaves the project without an owner
-
updateUserGroupProjectMetadataRole
Join<Project,UserGroup> updateUserGroupProjectMetadataRole(Project project, UserGroup userGroup, ProjectMetadataRole metadataRole)
- Parameters:
project- The project to updateuserGroup- The user group to updatemetadataRole- theProjectMetadataRoleto set for the group- Returns:
- The newly updated role object
-
addSampleToProject
Join<Project,Sample> addSampleToProject(Project project, Sample sample, boolean owner)
- Parameters:
project- theProjectto add theSampleto.sample- theSampleto add to theProject. If theSamplehas not previously been persisted, the service will persist theSample.owner- Whether the project will have modification access for this sample- Returns:
- a reference to the relationship resource created between the two entities.
-
moveSampleBetweenProjects
ProjectSampleJoin moveSampleBetweenProjects(Project source, Project destination, Sample sample)
- Parameters:
source- the sourceProjectdestination- DestinationProjectsample- The sample to move- Returns:
- Newly created
ProjectSampleJoin
-
shareSamples
java.util.List<ProjectSampleJoin> shareSamples(Project source, Project destination, java.util.Collection<Sample> samples, boolean giveOwner)
- Parameters:
source- the sourceProjectdestination- theProjectbeing shared intosamples- a collection ofSamplegiveOwner- whether to give ownership rights to the destinationProject- Returns:
- a list of new
ProjectSampleJoin
-
moveSamples
java.util.List<ProjectSampleJoin> moveSamples(Project source, Project destination, java.util.Collection<Sample> samples)
- Parameters:
source- the sourceProjectdestination- theProjectbeing moved tosamples- a collection ofSamplesProject- Returns:
- a list of new
ProjectSampleJoin
-
removeSamplesFromProject
void removeSamplesFromProject(Project project, java.lang.Iterable<Sample> samples)
-
getProjectsForUser
java.util.List<Join<Project,User>> getProjectsForUser(User user)
- Parameters:
user- the user to get projects for.- Returns:
- the projects associated with the user.
-
getProjectsForUserUnique
java.util.List<Project> getProjectsForUserUnique(User user)
- Parameters:
user- the user to get the unique projects for.- Returns:
- the projects associated with the user.
-
userHasProjectRole
boolean userHasProjectRole(User user, Project project, ProjectRole projectRole)
- Parameters:
user- The user to testproject- The project to testprojectRole- The project role to test- Returns:
- true/false whether the user has the given role
-
getProjectUserJoin
ProjectUserJoin getProjectUserJoin(User user, Project project)
- Parameters:
user- The userproject- The project- Returns:
- the
ProjectRoleof the user on the project
-
getUserGroupProjectJoins
java.util.Collection<UserGroupProjectJoin> getUserGroupProjectJoins(User user, Project project)
- Parameters:
user- The userproject- The project- Returns:
- the collection of
UserGroupProjectJoins of the user on the project
-
addRelatedProject
RelatedProjectJoin addRelatedProject(Project subject, Project relatedProject)
- Parameters:
subject- The parent projectrelatedProject- The project to be added to the parent- Returns:
- a
RelatedProjectJoindescribing the relationship
-
getRelatedProjects
java.util.List<RelatedProjectJoin> getRelatedProjects(Project project)
Get allRelatedProjectJoins for a givenProject- Parameters:
project- The parent project- Returns:
- A list of
RelatedProjectJoin
-
getReverseRelatedProjects
java.util.List<RelatedProjectJoin> getReverseRelatedProjects(Project project)
Get allRelatedProjectJoins where the given Project is the relatedProject property.- Parameters:
project- The child project- Returns:
- A list of
RelatedProjectJoin
-
removeRelatedProject
void removeRelatedProject(RelatedProjectJoin relatedProject)
Remove aRelatedProjectJoin- Parameters:
relatedProject- TheRelatedProjectJointo remove
-
removeRelatedProject
void removeRelatedProject(Project subject, Project relatedProject)
Remove aRelatedProjectJoinfor the given project and related project- Parameters:
subject- the owning projectrelatedProject- The related project
-
getProjectsForSample
java.util.List<Join<Project,Sample>> getProjectsForSample(Sample sample)
Get the projects that a given sample is on- Parameters:
sample- The sample to get projects for- Returns:
- All the projects a sample exists in
-
addReferenceFileToProject
Join<Project,ReferenceFile> addReferenceFileToProject(Project project, ReferenceFile referenceFile)
Add aReferenceFileto aProject.- Parameters:
project- theProjectto add theReferenceFileto.referenceFile- theReferenceFile.- Returns:
- a
Joinrepresenting the relationship between theProjectandReferenceFile.
-
removeReferenceFileFromProject
void removeReferenceFileFromProject(Project project, ReferenceFile referenceFile)
Remove aReferenceFilefrom aProject- Parameters:
project- theProjectto remove the reference file from.referenceFile- theReferenceFileto remove.
-
getUnassociatedProjects
org.springframework.data.domain.Page<Project> getUnassociatedProjects(Project p, java.lang.String searchName, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort.Direction sortDirection, java.lang.String... sortedBy)
Get a page of projects eligible to be marked as associated projects for the specified project.- Parameters:
p- the project to get eligible associated projects.searchName- the name of projects to filter on.page- the requested page of results.count- the number of results on the page.sortDirection- the direction the results should be sorted by.sortedBy- the property to be used to sort the results.- Returns:
- a page of projects eligible to be marked as associated projects.
-
findProjectsForUser
org.springframework.data.domain.Page<Project> findProjectsForUser(java.lang.String search, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort sort)
Find a list of projects (for a user or admin) using the specified search criteria- Parameters:
search-Stringgeneric string to search terms forpage-Integercurrent page viewed.count-Integerlength of current page.sort-SortCurrent table sort properties.- Returns:
PageofProject
-
findAllProjects
org.springframework.data.domain.Page<Project> findAllProjects(java.lang.String searchValue, int currentPage, int length, org.springframework.data.domain.Sort sort)
Find a paged list of all projects (for admin) using the specified search criteria.- Parameters:
searchValue-Stringgeneric string to search terms forcurrentPage-Integercurrent page viewed.length-Integerlength of current page.sort-SortCurrent table sort properties.- Returns:
PageofProject
-
getProjectsWithRemoteSyncStatus
java.util.List<Project> getProjectsWithRemoteSyncStatus(RemoteStatus.SyncStatus syncStatus)
Get a list ofProjects from remote sites that have a givenRemoteStatus.SyncStatus- Parameters:
syncStatus- theRemoteStatus.SyncStatusto getProjects for- Returns:
- a list of
Project
-
getRemoteProjects
java.util.List<Project> getRemoteProjects()
Get a list of allProjects from remote sites- Returns:
- a list of
Project
-
getProjectsForSequencingObjects
java.util.Set<Project> getProjectsForSequencingObjects(java.util.Collection<? extends SequencingObject> sequences)
Get a Set of allProjects referred to by a collection ofSequencingObjects- Parameters:
sequences- theSequencingObjects to getProjects for- Returns:
- a set of
Project
-
getProjectsForAnalysisSubmission
java.util.List<ProjectAnalysisSubmissionJoin> getProjectsForAnalysisSubmission(AnalysisSubmission submission)
Get allProjects a givenAnalysisSubmissionis shared with- Parameters:
submission- theAnalysisSubmission- Returns:
- a list of
ProjectAnalysisSubmissionJoins
-
getProjectsUsedInAnalysisSubmission
java.util.List<Project> getProjectsUsedInAnalysisSubmission(AnalysisSubmission submission)
Get allProjects that have data used within anAnalysisSubmission. Note that this differs fromgetProjectsForAnalysisSubmission(AnalysisSubmission)where that method only returns projects which theAnalysisSubmissionis explicitly shared with.- Parameters:
submission- theAnalysisSubmissionto getProjects for- Returns:
- a list of
Projects
-
updateProjectSettings
Project updateProjectSettings(Project project, java.util.Map<java.lang.String,java.lang.Object> updates)
Update selectProjectsettings- Parameters:
project- the project to updateupdates- a map of fields to update- Returns:
- the updated
Project
-
createProjectWithSamples
Project createProjectWithSamples(Project project, java.util.List<java.lang.Long> sampleIds, boolean owner)
-
getProjectsCreated
java.lang.Long getProjectsCreated(java.util.Date createdDate)
Get count of projects created in the time period- Parameters:
createdDate- the minimum date for projects created- Returns:
- An
Longcount of projects created
-
getProjectsCreatedGrouped
java.util.List<GenericStatModel> getProjectsCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModelof projects created in the past n time period and grouped by the format provided.- Parameters:
createdDate- the minimum date for projects createdstatisticTimePeriod- the enum containing format for which to group the results by- Returns:
- An
GenericStatModellist
-
-