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 aReferenceFile
to aProject
.RelatedProjectJoin
addRelatedProject(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)
Project
createProjectWithSamples(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.Long
getProjectsCreated(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 ofGenericStatModel
of projects created in the past n time period and grouped by the format provided.java.util.List<ProjectAnalysisSubmissionJoin>
getProjectsForAnalysisSubmission(AnalysisSubmission submission)
Get allProject
s a givenAnalysisSubmission
is 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 allProject
s referred to by a collection ofSequencingObject
sjava.util.List<Join<Project,User>>
getProjectsForUser(User user)
java.util.List<Project>
getProjectsForUserUnique(User user)
java.util.List<Project>
getProjectsUsedInAnalysisSubmission(AnalysisSubmission submission)
Get allProject
s that have data used within anAnalysisSubmission
.java.util.List<Project>
getProjectsWithRemoteSyncStatus(RemoteStatus.SyncStatus syncStatus)
Get a list ofProject
s from remote sites that have a givenRemoteStatus.SyncStatus
ProjectUserJoin
getProjectUserJoin(User user, Project project)
java.util.List<RelatedProjectJoin>
getRelatedProjects(Project project)
Get allRelatedProjectJoin
s for a givenProject
java.util.List<Project>
getRemoteProjects()
Get a list of allProject
s from remote sitesjava.util.List<RelatedProjectJoin>
getReverseRelatedProjects(Project project)
Get allRelatedProjectJoin
s 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)
ProjectSampleJoin
moveSampleBetweenProjects(Project source, Project destination, Sample sample)
java.util.List<ProjectSampleJoin>
moveSamples(Project source, Project destination, java.util.Collection<Sample> samples)
void
removeReferenceFileFromProject(Project project, ReferenceFile referenceFile)
Remove aReferenceFile
from aProject
void
removeRelatedProject(RelatedProjectJoin relatedProject)
Remove aRelatedProjectJoin
void
removeRelatedProject(Project subject, Project relatedProject)
Remove aRelatedProjectJoin
for the given project and related projectvoid
removeSampleFromProject(Project project, Sample sample)
void
removeSamplesFromProject(Project project, java.lang.Iterable<Sample> samples)
void
removeUserFromProject(Project project, User user)
void
removeUserGroupFromProject(Project project, UserGroup userGroup)
java.util.List<ProjectSampleJoin>
shareSamples(Project source, Project destination, java.util.Collection<Sample> samples, boolean giveOwner)
Project
updateProjectSettings(Project project, java.util.Map<java.lang.String,java.lang.Object> updates)
Update selectProject
settingsJoin<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)
boolean
userHasProjectRole(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 specifiedUser
to theProject
with aRole
. If theUser
is a manager for theProject
, then theUser
should be added to theProject
with the 'ROLE_MANAGER'Role
.- Parameters:
project
- theProject
to 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 specifiedUserGroup
to theProject
with aRole
. If theUserGroup
is a manager for theProject
, then theUserGroup
should be added to theProject
with the 'ROLE_MANAGER'Role
.- Parameters:
project
- theProject
to add the user to.userGroup
- the user group to add to theProject
.role
- the role that the group has on theProject
.metadataRole
- theProjectMetadataRole
to 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
- theProject
to remove theUser
from.user
- theUser
to 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
- theProject
to remove theUser
from.userGroup
- theUserGroup
to 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
-ProjectMetadataRole
to 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
- theProjectMetadataRole
to 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
- theProjectMetadataRole
to 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
- theProjectMetadataRole
to set for the group- Returns:
- The newly updated role object
-
addSampleToProject
Join<Project,Sample> addSampleToProject(Project project, Sample sample, boolean owner)
- Parameters:
project
- theProject
to add theSample
to.sample
- theSample
to add to theProject
. If theSample
has 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 sourceProject
destination
- DestinationProject
sample
- 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 sourceProject
destination
- theProject
being shared intosamples
- a collection ofSample
giveOwner
- 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 sourceProject
destination
- theProject
being moved tosamples
- a collection ofSample
sProject
- 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
ProjectRole
of 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
UserGroupProjectJoin
s 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
RelatedProjectJoin
describing the relationship
-
getRelatedProjects
java.util.List<RelatedProjectJoin> getRelatedProjects(Project project)
Get allRelatedProjectJoin
s for a givenProject
- Parameters:
project
- The parent project- Returns:
- A list of
RelatedProjectJoin
-
getReverseRelatedProjects
java.util.List<RelatedProjectJoin> getReverseRelatedProjects(Project project)
Get allRelatedProjectJoin
s 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
- TheRelatedProjectJoin
to remove
-
removeRelatedProject
void removeRelatedProject(Project subject, Project relatedProject)
Remove aRelatedProjectJoin
for 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 aReferenceFile
to aProject
.- Parameters:
project
- theProject
to add theReferenceFile
to.referenceFile
- theReferenceFile
.- Returns:
- a
Join
representing the relationship between theProject
andReferenceFile
.
-
removeReferenceFileFromProject
void removeReferenceFileFromProject(Project project, ReferenceFile referenceFile)
Remove aReferenceFile
from aProject
- Parameters:
project
- theProject
to remove the reference file from.referenceFile
- theReferenceFile
to 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
-String
generic string to search terms forpage
-Integer
current page viewed.count
-Integer
length of current page.sort
-Sort
Current table sort properties.- Returns:
Page
ofProject
-
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
-String
generic string to search terms forcurrentPage
-Integer
current page viewed.length
-Integer
length of current page.sort
-Sort
Current table sort properties.- Returns:
Page
ofProject
-
getProjectsWithRemoteSyncStatus
java.util.List<Project> getProjectsWithRemoteSyncStatus(RemoteStatus.SyncStatus syncStatus)
Get a list ofProject
s from remote sites that have a givenRemoteStatus.SyncStatus
- Parameters:
syncStatus
- theRemoteStatus.SyncStatus
to getProject
s for- Returns:
- a list of
Project
-
getRemoteProjects
java.util.List<Project> getRemoteProjects()
Get a list of allProject
s from remote sites- Returns:
- a list of
Project
-
getProjectsForSequencingObjects
java.util.Set<Project> getProjectsForSequencingObjects(java.util.Collection<? extends SequencingObject> sequences)
Get a Set of allProject
s referred to by a collection ofSequencingObject
s- Parameters:
sequences
- theSequencingObject
s to getProject
s for- Returns:
- a set of
Project
-
getProjectsForAnalysisSubmission
java.util.List<ProjectAnalysisSubmissionJoin> getProjectsForAnalysisSubmission(AnalysisSubmission submission)
Get allProject
s a givenAnalysisSubmission
is shared with- Parameters:
submission
- theAnalysisSubmission
- Returns:
- a list of
ProjectAnalysisSubmissionJoin
s
-
getProjectsUsedInAnalysisSubmission
java.util.List<Project> getProjectsUsedInAnalysisSubmission(AnalysisSubmission submission)
Get allProject
s that have data used within anAnalysisSubmission
. Note that this differs fromgetProjectsForAnalysisSubmission(AnalysisSubmission)
where that method only returns projects which theAnalysisSubmission
is explicitly shared with.- Parameters:
submission
- theAnalysisSubmission
to getProject
s for- Returns:
- a list of
Project
s
-
updateProjectSettings
Project updateProjectSettings(Project project, java.util.Map<java.lang.String,java.lang.Object> updates)
Update selectProject
settings- 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
Long
count of projects created
-
getProjectsCreatedGrouped
java.util.List<GenericStatModel> getProjectsCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModel
of 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
GenericStatModel
list
-
-