Class ProjectServiceImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl<java.lang.Long,Project>
-
- ca.corefacility.bioinformatics.irida.service.impl.ProjectServiceImpl
-
- All Implemented Interfaces:
CRUDService<java.lang.Long,Project>
,ProjectService
@Service public class ProjectServiceImpl extends CRUDServiceImpl<java.lang.Long,Project> implements ProjectService
A specialized service layer for projects.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<java.lang.String>
VALID_LOCAL_SETTINGS
-
Fields inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
CREATED_DATE_SORT_PROPERTY, repository, validator, valueType
-
-
Constructor Summary
Constructors Constructor Description ProjectServiceImpl(ProjectRepository projectRepository, SampleRepository sampleRepository, UserRepository userRepository, ProjectUserJoinRepository pujRepository, ProjectSampleJoinRepository psjRepository, RelatedProjectRepository relatedProjectRepository, ReferenceFileRepository referenceFileRepository, ProjectReferenceFileJoinRepository prfjRepository, UserGroupProjectJoinRepository ugpjRepository, SampleSequencingObjectJoinRepository ssoRepository, ProjectAnalysisSubmissionJoinRepository pasRepository, SequencingObjectRepository sequencingObjectRepository, ProjectSubscriptionService projectSubscriptionService, UserGroupJoinRepository userGroupJoinRepository, javax.validation.Validator validator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Join<Project,ReferenceFile>
addReferenceFileToProject(Project project, ReferenceFile referenceFile)
Add aReferenceFile
to aProject
.RelatedProjectJoin
addRelatedProject(Project subject, Project relatedProject)
ProjectSampleJoin
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
create(Project p)
Create a new object in the persistence store.Project
createProjectWithSamples(Project project, java.util.List<java.lang.Long> sampleIds, boolean owner)
void
delete(java.lang.Long id)
Delete the object with the specified identifier from the database.java.lang.Iterable<Project>
findAll()
List all objects ofType
in the database.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 criteriaorg.springframework.data.history.Revisions<java.lang.Integer,Project>
findRevisions(java.lang.Long id)
Find all of the revisions for the specified identifier.org.springframework.data.domain.Page<org.springframework.data.history.Revision<java.lang.Integer,Project>>
findRevisions(java.lang.Long id, org.springframework.data.domain.Pageable pageable)
Returns aPage
of revisions for the entity with the given id.java.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)
Project
read(java.lang.Long id)
Read the object type by unique identifier.java.lang.Iterable<Project>
readMultiple(java.lang.Iterable<java.lang.Long> idents)
Read multiple objects by the given collection of identifiersvoid
removeReferenceFileFromProject(Project project, ReferenceFile file)
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
update(Project object)
Update an objectProject
updateFields(java.lang.Long id, java.util.Map<java.lang.String,java.lang.Object> updatedFields)
Update properties of the given object by given fields.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 class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
count, exists, list, list, list, search, search, updateMultiple
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, exists, list, list, list, search, search, updateMultiple
-
-
-
-
Constructor Detail
-
ProjectServiceImpl
@Autowired public ProjectServiceImpl(ProjectRepository projectRepository, SampleRepository sampleRepository, UserRepository userRepository, ProjectUserJoinRepository pujRepository, ProjectSampleJoinRepository psjRepository, RelatedProjectRepository relatedProjectRepository, ReferenceFileRepository referenceFileRepository, ProjectReferenceFileJoinRepository prfjRepository, UserGroupProjectJoinRepository ugpjRepository, SampleSequencingObjectJoinRepository ssoRepository, ProjectAnalysisSubmissionJoinRepository pasRepository, SequencingObjectRepository sequencingObjectRepository, ProjectSubscriptionService projectSubscriptionService, UserGroupJoinRepository userGroupJoinRepository, javax.validation.Validator validator)
-
-
Method Detail
-
readMultiple
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#idents, \'canReadProject\')") public java.lang.Iterable<Project> readMultiple(java.lang.Iterable<java.lang.Long> idents)
Read multiple objects by the given collection of identifiers- Specified by:
readMultiple
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
readMultiple
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
idents
- The unique identifiers of the objects to read- Returns:
- A collection of the requested objects
-
findRevisions
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#id, \'canReadProject\')") public org.springframework.data.history.Revisions<java.lang.Integer,Project> findRevisions(java.lang.Long id)
Find all of the revisions for the specified identifier.- Specified by:
findRevisions
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
findRevisions
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
id
- the identifier to find revisions for.- Returns:
- the collection of revisions for the identifier.
-
findRevisions
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#id, \'canReadProject\')") public org.springframework.data.domain.Page<org.springframework.data.history.Revision<java.lang.Integer,Project>> findRevisions(java.lang.Long id, org.springframework.data.domain.Pageable pageable)
Returns aPage
of revisions for the entity with the given id.- Specified by:
findRevisions
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
findRevisions
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
id
- the identifier to find revisions for.pageable
- the page specification.- Returns:
- the page of revisions for the specified resource.
-
findAll
@PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_SEQUENCER\')") @PostFilter("hasPermission(filterObject, \'canReadProject\')") public java.lang.Iterable<Project> findAll()
List all objects ofType
in the database.- Specified by:
findAll
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
findAll
in classCRUDServiceImpl<java.lang.Long,Project>
- Returns:
- All objects of the specified
Type
in the database.
-
read
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#id, \'canReadProject\')") public Project read(java.lang.Long id)
Read the object type by unique identifier.- Specified by:
read
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
read
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
id
- The unique identifier for this object.- Returns:
- The object corresponding to the unique identifier.
-
create
@Transactional @PreAuthorize("hasAnyRole(\'ROLE_USER\')") public Project create(Project p)
Create a new object in the persistence store.- Specified by:
create
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
create
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
p
- The object to persist.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
-
update
@Transactional @PreAuthorize("hasPermission(#object, \'isProjectOwner\')") public Project update(Project object)
Update an object- Specified by:
update
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
update
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
object
- The object to update- Returns:
- The updated object
-
updateFields
@Transactional @PreAuthorize("hasPermission(#id, \'isProjectOwner\')") public Project updateFields(java.lang.Long id, java.util.Map<java.lang.String,java.lang.Object> updatedFields) throws javax.validation.ConstraintViolationException, EntityExistsException, InvalidPropertyException
Update properties of the given object by given fields. The object must have a valid identifier prior to being passed to this method.- Specified by:
updateFields
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
updateFields
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
id
- The identifier of the object to update.updatedFields
- the object properties that should be updated.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
- Throws:
javax.validation.ConstraintViolationException
- If the object being persisted cannot be validated by validation rules associated with the object.EntityExistsException
- If the object being persisted violates uniqueness constraints in the database.InvalidPropertyException
- If the updated properties map contains a property name that does not exist on the domain model.
-
updateProjectSettings
@PreAuthorize("hasPermission(#project, \'canManageLocalProjectSettings\')") public Project updateProjectSettings(Project project, java.util.Map<java.lang.String,java.lang.Object> updates)
Update selectProject
settings- Specified by:
updateProjectSettings
in interfaceProjectService
- Parameters:
project
- the project to updateupdates
- a map of fields to update- Returns:
- the updated
Project
-
delete
@Transactional @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\') or hasPermission(#id, \'canManageLocalProjectSettings\')") public void delete(java.lang.Long id)
Delete the object with the specified identifier from the database.- Specified by:
delete
in interfaceCRUDService<java.lang.Long,Project>
- Overrides:
delete
in classCRUDServiceImpl<java.lang.Long,Project>
- Parameters:
id
- The identifier of the object to delete.
-
addUserToProject
@Transactional @PreAuthorize("hasPermission(#project, \'canManageLocalProjectSettings\')") public 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
.- Specified by:
addUserToProject
in interfaceProjectService
- 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.
-
removeUserFromProject
@Transactional @PreAuthorize("hasPermission(#project, \'canManageLocalProjectSettings\')") public void removeUserFromProject(Project project, User user) throws ProjectWithoutOwnerException
- Specified by:
removeUserFromProject
in interfaceProjectService
- 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
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\')") public void removeUserGroupFromProject(Project project, UserGroup userGroup) throws ProjectWithoutOwnerException
- Specified by:
removeUserGroupFromProject
in interfaceProjectService
- 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
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project,\'canManageLocalProjectSettings\')") public Join<Project,User> updateUserProjectRole(Project project, User user, ProjectRole projectRole, ProjectMetadataRole metadataRole) throws ProjectWithoutOwnerException
- Specified by:
updateUserProjectRole
in interfaceProjectService
- 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
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project,\'canManageLocalProjectSettings\')") public Join<Project,User> updateUserProjectMetadataRole(Project project, User user, ProjectMetadataRole metadataRole)
Description copied from interface:ProjectService
- Specified by:
updateUserProjectMetadataRole
in interfaceProjectService
- Parameters:
project
- The project to updateuser
- The user to updatemetadataRole
- theProjectMetadataRole
to set for the user- Returns:
- The newly updated role object
-
updateUserGroupProjectRole
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\')") public Join<Project,UserGroup> updateUserGroupProjectRole(Project project, UserGroup userGroup, ProjectRole projectRole, ProjectMetadataRole metadataRole) throws ProjectWithoutOwnerException
- Specified by:
updateUserGroupProjectRole
in interfaceProjectService
- 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
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\')") public Join<Project,UserGroup> updateUserGroupProjectMetadataRole(Project project, UserGroup userGroup, ProjectMetadataRole metadataRole)
Description copied from interface:ProjectService
- Specified by:
updateUserGroupProjectMetadataRole
in interfaceProjectService
- Parameters:
project
- The project to updateuserGroup
- The user group to updatemetadataRole
- theProjectMetadataRole
to set for the group- Returns:
- The newly updated role object
-
addSampleToProject
@Transactional @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or (hasPermission(#project, \'isProjectOwner\'))") public ProjectSampleJoin addSampleToProject(Project project, Sample sample, boolean owner)
- Specified by:
addSampleToProject
in interfaceProjectService
- 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
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or ( hasPermission(#source, \'isProjectOwner\') and hasPermission(#destination, \'isProjectOwner\'))") public ProjectSampleJoin moveSampleBetweenProjects(Project source, Project destination, Sample sample)
- Specified by:
moveSampleBetweenProjects
in interfaceProjectService
- Parameters:
source
- the sourceProject
destination
- DestinationProject
sample
- The sample to move- Returns:
- Newly created
ProjectSampleJoin
-
shareSamples
@Transactional @PreAuthorize("hasPermission(#source, \'canManageLocalProjectSettings\') and hasPermission(#destination, \'isProjectOwner\') and hasPermission(#samples, \'canReadSample\') and ((not #giveOwner) or hasPermission(#samples, \'canUpdateSample\'))") public java.util.List<ProjectSampleJoin> shareSamples(Project source, Project destination, java.util.Collection<Sample> samples, boolean giveOwner)
- Specified by:
shareSamples
in interfaceProjectService
- 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
@Transactional @PreAuthorize("hasPermission(#source, \'isProjectOwner\') and hasPermission(#destination, \'isProjectOwner\') and hasPermission(#samples, \'canReadSample\') ") public java.util.List<ProjectSampleJoin> moveSamples(Project source, Project destination, java.util.Collection<Sample> samples)
- Specified by:
moveSamples
in interfaceProjectService
- Parameters:
source
- the sourceProject
destination
- theProject
being moved tosamples
- a collection ofSample
sProject
- Returns:
- a list of new
ProjectSampleJoin
-
removeSampleFromProject
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\')") public void removeSampleFromProject(Project project, Sample sample)
Remove the specifiedSample
from theProject
. TheSample
will also be deleted from the system becauseSample
s cannot exist outside of aProject
.- Specified by:
removeSampleFromProject
in interfaceProjectService
- Parameters:
project
- theProject
to remove theSample
from.sample
- theSample
to remove.
-
removeSamplesFromProject
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\')") public void removeSamplesFromProject(Project project, java.lang.Iterable<Sample> samples)
- Specified by:
removeSamplesFromProject
in interfaceProjectService
- Parameters:
project
- theProject
to remove theSample
s from.samples
- theSample
s to remove.
-
getProjectsForUser
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_USER\')") public java.util.List<Join<Project,User>> getProjectsForUser(User user)
- Specified by:
getProjectsForUser
in interfaceProjectService
- Parameters:
user
- the user to get projects for.- Returns:
- the projects associated with the user.
-
getProjectsForUserUnique
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_USER\')") public java.util.List<Project> getProjectsForUserUnique(User user)
- Specified by:
getProjectsForUserUnique
in interfaceProjectService
- Parameters:
user
- the user to get the unique projects for.- Returns:
- the projects associated with the user.
-
userHasProjectRole
@PreAuthorize("hasPermission(#project, \'canReadProject\')") public boolean userHasProjectRole(User user, Project project, ProjectRole projectRole)
- Specified by:
userHasProjectRole
in interfaceProjectService
- 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
@PreAuthorize("hasPermission(#project, \'canReadProject\')") public ProjectUserJoin getProjectUserJoin(User user, Project project)
- Specified by:
getProjectUserJoin
in interfaceProjectService
- Parameters:
user
- The userproject
- The project- Returns:
- the
ProjectRole
of the user on the project
-
getUserGroupProjectJoins
@PreAuthorize("hasPermission(#project, \'canReadProject\')") public java.util.Collection<UserGroupProjectJoin> getUserGroupProjectJoins(User user, Project project)
- Specified by:
getUserGroupProjectJoins
in interfaceProjectService
- Parameters:
user
- The userproject
- The project- Returns:
- the collection of
UserGroupProjectJoin
s of the user on the project
-
addRelatedProject
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#subject,\'isProjectOwner\') and hasPermission(#relatedProject,\'canReadProject\')") public RelatedProjectJoin addRelatedProject(Project subject, Project relatedProject)
- Specified by:
addRelatedProject
in interfaceProjectService
- Parameters:
subject
- The parent projectrelatedProject
- The project to be added to the parent- Returns:
- a
RelatedProjectJoin
describing the relationship
-
getRelatedProjects
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") @PostFilter("hasPermission(filterObject.object, \'canReadProject\')") public java.util.List<RelatedProjectJoin> getRelatedProjects(Project project)
Get allRelatedProjectJoin
s for a givenProject
- Specified by:
getRelatedProjects
in interfaceProjectService
- Parameters:
project
- The parent project- Returns:
- A list of
RelatedProjectJoin
-
getReverseRelatedProjects
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public java.util.List<RelatedProjectJoin> getReverseRelatedProjects(Project project)
Get allRelatedProjectJoin
s where the given Project is the relatedProject property.- Specified by:
getReverseRelatedProjects
in interfaceProjectService
- Parameters:
project
- The child project- Returns:
- A list of
RelatedProjectJoin
-
removeRelatedProject
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project.subject, \'isProjectOwner\')") public void removeRelatedProject(RelatedProjectJoin relatedProject)
Remove aRelatedProjectJoin
- Specified by:
removeRelatedProject
in interfaceProjectService
- Parameters:
relatedProject
- TheRelatedProjectJoin
to remove
-
removeRelatedProject
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#subject,\'isProjectOwner\')") public void removeRelatedProject(Project subject, Project relatedProject)
Remove aRelatedProjectJoin
for the given project and related project- Specified by:
removeRelatedProject
in interfaceProjectService
- Parameters:
subject
- the owning projectrelatedProject
- The related project
-
getProjectsForSample
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#sample, \'canReadSample\')") @PostFilter("hasPermission(filterObject.subject, \'canReadProject\')") public java.util.List<Join<Project,Sample>> getProjectsForSample(Sample sample)
Get the projects that a given sample is on- Specified by:
getProjectsForSample
in interfaceProjectService
- Parameters:
sample
- The sample to get projects for- Returns:
- All the projects a sample exists in
-
addReferenceFileToProject
@Transactional @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'isProjectOwner\')") public Join<Project,ReferenceFile> addReferenceFileToProject(Project project, ReferenceFile referenceFile)
Add aReferenceFile
to aProject
.- Specified by:
addReferenceFileToProject
in interfaceProjectService
- Parameters:
project
- theProject
to add theReferenceFile
to.referenceFile
- theReferenceFile
.- Returns:
- a
Join
representing the relationship between theProject
andReferenceFile
.
-
removeReferenceFileFromProject
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'isProjectOwner\')") public void removeReferenceFileFromProject(Project project, ReferenceFile file)
Remove aReferenceFile
from aProject
- Specified by:
removeReferenceFileFromProject
in interfaceProjectService
- Parameters:
project
- theProject
to remove the reference file from.file
- theReferenceFile
to remove.
-
getUnassociatedProjects
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#p, \'canManageLocalProjectSettings\')") public 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.- Specified by:
getUnassociatedProjects
in interfaceProjectService
- 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
@PreAuthorize("hasRole(\'ROLE_USER\')") public 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- Specified by:
findProjectsForUser
in interfaceProjectService
- 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
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public 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.- Specified by:
findAllProjects
in interfaceProjectService
- 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
-
addUserGroupToProject
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\')") public 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
.- Specified by:
addUserGroupToProject
in interfaceProjectService
- 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.
-
getProjectsWithRemoteSyncStatus
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.util.List<Project> getProjectsWithRemoteSyncStatus(RemoteStatus.SyncStatus syncStatus)
Get a list ofProject
s from remote sites that have a givenRemoteStatus.SyncStatus
- Specified by:
getProjectsWithRemoteSyncStatus
in interfaceProjectService
- Parameters:
syncStatus
- theRemoteStatus.SyncStatus
to getProject
s for- Returns:
- a list of
Project
-
getRemoteProjects
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.util.List<Project> getRemoteProjects()
Get a list of allProject
s from remote sites- Specified by:
getRemoteProjects
in interfaceProjectService
- Returns:
- a list of
Project
-
getProjectsForSequencingObjects
@PreAuthorize("hasRole(\'ROLE_USER\')") @PostFilter("hasPermission(filterObject, \'canReadProject\')") public java.util.Set<Project> getProjectsForSequencingObjects(java.util.Collection<? extends SequencingObject> sequences)
Get a Set of allProject
s referred to by a collection ofSequencingObject
s- Specified by:
getProjectsForSequencingObjects
in interfaceProjectService
- Parameters:
sequences
- theSequencingObject
s to getProject
s for- Returns:
- a set of
Project
-
getProjectsForAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") @PostFilter("hasPermission(filterObject.subject, \'canReadProject\')") public java.util.List<ProjectAnalysisSubmissionJoin> getProjectsForAnalysisSubmission(AnalysisSubmission submission)
Get allProject
s a givenAnalysisSubmission
is shared with- Specified by:
getProjectsForAnalysisSubmission
in interfaceProjectService
- Parameters:
submission
- theAnalysisSubmission
- Returns:
- a list of
ProjectAnalysisSubmissionJoin
s
-
createProjectWithSamples
@Transactional @PreAuthorize("hasPermission(#sampleIds, \'canUpdateSample\')") public Project createProjectWithSamples(Project project, java.util.List<java.lang.Long> sampleIds, boolean owner)
- Specified by:
createProjectWithSamples
in interfaceProjectService
- Parameters:
project
- theProject
to createsampleIds
- IDs of theSample
sowner
- whether to lockSample
modification from new project- Returns:
- the created
Project
-
getProjectsUsedInAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") @PostFilter("hasPermission(filterObject, \'canReadProject\')") public java.util.List<Project> getProjectsUsedInAnalysisSubmission(AnalysisSubmission submission)
Get allProject
s that have data used within anAnalysisSubmission
. Note that this differs fromProjectService.getProjectsForAnalysisSubmission(AnalysisSubmission)
where that method only returns projects which theAnalysisSubmission
is explicitly shared with.- Specified by:
getProjectsUsedInAnalysisSubmission
in interfaceProjectService
- Parameters:
submission
- theAnalysisSubmission
to getProject
s for- Returns:
- a list of
Project
s
-
getProjectsCreated
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.lang.Long getProjectsCreated(java.util.Date createdDate)
Get count of projects created in the time period- Specified by:
getProjectsCreated
in interfaceProjectService
- Parameters:
createdDate
- the minimum date for projects created- Returns:
- An
Long
count of projects created
-
getProjectsCreatedGrouped
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public 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.- Specified by:
getProjectsCreatedGrouped
in interfaceProjectService
- Parameters:
createdDate
- the minimum date for projects createdstatisticTimePeriod
- the enum containing format for which to group the results by- Returns:
- An
GenericStatModel
list
-
-