Interface ProjectRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Project,java.lang.Long>
,IridaJpaRepository<Project,java.lang.Long>
,org.springframework.data.jpa.repository.JpaSpecificationExecutor<Project>
,org.springframework.data.repository.PagingAndSortingRepository<Project,java.lang.Long>
,ProjectRepositoryCustom
,org.springframework.data.repository.Repository<Project,java.lang.Long>
,org.springframework.data.repository.history.RevisionRepository<Project,java.lang.Long,java.lang.Integer>
public interface ProjectRepository extends IridaJpaRepository<Project,java.lang.Long>, ProjectRepositoryCustom
Specialized repository forProject
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXCLUDE_PROJECT
static java.lang.String
MANAGER_IN_GROUP
static java.lang.String
MANAGER_ON_PROJECT
static java.lang.String
PROJECT_MANAGER_PERMISSION
static java.lang.String
PROJECT_NAME_LIKE
Sub-expressions for filtering and paging projects on different property names.static java.lang.String
PROJECT_PERMISSIONS
static java.lang.String
USER_IN_GROUP
static java.lang.String
USER_ON_PROJECT
Sub-expressions for filtering and paging projects on permissions (via user groups and project membership).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<GenericStatModel>
countProjectsCreatedGrouped(java.util.Date createdDate, java.lang.String groupByFormat)
Get a list ofGenericStatModel
s for projects created in the past n time period and grouped by the format provided.java.lang.Long
countProjectsCreatedInTimePeriod(java.util.Date createdDate)
Get a count of allProject
s created within time periodorg.springframework.data.domain.Page<Project>
findAllProjectsByNameExcludingProject(java.lang.String name, Project exclude, org.springframework.data.domain.Pageable page)
org.springframework.data.domain.Page<Project>
findManageableProjectsByName(java.lang.String name, Project exclude, User user, org.springframework.data.domain.Pageable page)
java.util.List<Project>
getProjectsWithRemoteSyncStatus(RemoteStatus.SyncStatus syncStatus)
Get a list ofProject
s from remote sites that have a givenRemoteStatus.SyncStatus
java.util.List<Project>
getRemoteProjects()
Get a list of allProject
s from remote sites-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, exists, findAll, findAll, findAll, findOne
-
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll, findAll
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.repositories.ProjectRepositoryCustom
updateProjectModifiedDate
-
-
-
-
Field Detail
-
PROJECT_NAME_LIKE
static final java.lang.String PROJECT_NAME_LIKE
Sub-expressions for filtering and paging projects on different property names.- See Also:
- Constant Field Values
-
EXCLUDE_PROJECT
static final java.lang.String EXCLUDE_PROJECT
- See Also:
- Constant Field Values
-
USER_ON_PROJECT
static final java.lang.String USER_ON_PROJECT
Sub-expressions for filtering and paging projects on permissions (via user groups and project membership).- See Also:
- Constant Field Values
-
USER_IN_GROUP
static final java.lang.String USER_IN_GROUP
- See Also:
- Constant Field Values
-
PROJECT_PERMISSIONS
static final java.lang.String PROJECT_PERMISSIONS
- See Also:
- Constant Field Values
-
MANAGER_ON_PROJECT
static final java.lang.String MANAGER_ON_PROJECT
- See Also:
- Constant Field Values
-
MANAGER_IN_GROUP
static final java.lang.String MANAGER_IN_GROUP
- See Also:
- Constant Field Values
-
PROJECT_MANAGER_PERMISSION
static final java.lang.String PROJECT_MANAGER_PERMISSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
findAllProjectsByNameExcludingProject
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @Query("from Project p where (p.name like CONCAT(\'%\', :projectName,\'%\')) and p != :exclude") org.springframework.data.domain.Page<Project> findAllProjectsByNameExcludingProject(@Param("projectName") java.lang.String name, @Param("exclude") Project exclude, org.springframework.data.domain.Pageable page)
- Parameters:
name
- the name of the project to search forexclude
- the project to exclude from resultspage
- the page request- Returns:
- a page of
Project
.
-
findManageableProjectsByName
@Query("from Project p where (p.name like CONCAT(\'%\', :projectName,\'%\')) and p != :exclude and ((p in (select puj.project from ProjectUserJoin puj where puj.user = :forUser and puj.projectRole = ca.corefacility.bioinformatics.irida.model.enums.ProjectRole.PROJECT_OWNER)) or (p in (select ugpj.project from UserGroupJoin ugj, UserGroupProjectJoin ugpj where ugj.group = ugpj.userGroup and ugj.user = :forUser and ugpj.projectRole = ca.corefacility.bioinformatics.irida.model.enums.ProjectRole.PROJECT_OWNER)))") org.springframework.data.domain.Page<Project> findManageableProjectsByName(@Param("projectName") java.lang.String name, @Param("exclude") Project exclude, @Param("forUser") User user, org.springframework.data.domain.Pageable page)
- Parameters:
name
- the name of the project to search forexclude
- the project to exclude from resultsuser
- the user account to load projects forpage
- the page request- Returns:
- a page of
Project
-
getProjectsWithRemoteSyncStatus
@Query("FROM Project p WHERE p.remoteStatus.syncStatus=:syncStatus") java.util.List<Project> getProjectsWithRemoteSyncStatus(@Param("syncStatus") 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
@Query("FROM Project p WHERE p.remoteStatus != NULL") java.util.List<Project> getRemoteProjects()
Get a list of allProject
s from remote sites- Returns:
- a list of
Project
-
countProjectsCreatedInTimePeriod
@Query("select count(p.id) from Project p where p.createdDate >= ?1") java.lang.Long countProjectsCreatedInTimePeriod(java.util.Date createdDate)
Get a count of allProject
s created within time period- Parameters:
createdDate
- the minimum created date for projects- Returns:
- a count of
Project
s
-
countProjectsCreatedGrouped
@Query("select new ca.corefacility.bioinformatics.irida.ria.web.admin.dto.statistics.GenericStatModel(function(\'date_format\', p.createdDate, ?2), count(p.id))from Project p where p.createdDate >= ?1 group by function(\'date_format\', p.createdDate, ?2) order by function(\'date_format\', p.createdDate, ?2) asc") java.util.List<GenericStatModel> countProjectsCreatedGrouped(java.util.Date createdDate, java.lang.String groupByFormat)
Get a list ofGenericStatModel
s for projects created in the past n time period and grouped by the format provided.- Parameters:
createdDate
- The minimum created date for projectsgroupByFormat
- The format to use for grouping the results.- Returns:
- A list of
GenericStatModel
s
-
-