Class ProjectSubscriptionServiceImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl<java.lang.Long,ProjectSubscription>
-
- ca.corefacility.bioinformatics.irida.service.impl.ProjectSubscriptionServiceImpl
-
- All Implemented Interfaces:
CRUDService<java.lang.Long,ProjectSubscription>
,ProjectSubscriptionService
@Service public class ProjectSubscriptionServiceImpl extends CRUDServiceImpl<java.lang.Long,ProjectSubscription> implements ProjectSubscriptionService
A specialized service layer for project subscriptions.
-
-
Field Summary
-
Fields inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
CREATED_DATE_SORT_PROPERTY, repository, validator, valueType
-
-
Constructor Summary
Constructors Constructor Description ProjectSubscriptionServiceImpl(ProjectSubscriptionRepository projectSubscriptionRepository, ProjectUserJoinRepository pujRepository, UserGroupProjectJoinRepository ugpjRepository, javax.validation.Validator validator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProjectSubscription
addProjectSubscriptionForProjectAndUser(Project project, User user)
java.util.List<Project>
getProjectsForUserWithEmailSubscriptions(User user)
org.springframework.data.domain.Page<ProjectSubscription>
getProjectSubscriptionsForUser(User user, int page, int size, org.springframework.data.domain.Sort sort)
Get a page of project subscriptions associated with a user.java.util.List<User>
getUsersWithEmailSubscriptions()
org.springframework.data.domain.Page<ProjectSubscription>
list(int page, int size, org.springframework.data.domain.Sort sort)
List objects ofType
in the database, limited to some specific pageProjectSubscription
read(java.lang.Long id)
Read the object type by unique identifier.void
removeProjectSubscriptionForProjectAndUser(Project project, User user)
ProjectSubscription
update(ProjectSubscription projectSubscription)
Update an object-
Methods inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
count, create, delete, exists, findAll, findRevisions, findRevisions, list, list, readMultiple, search, search, updateFields, 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, create, delete, exists, findAll, findRevisions, findRevisions, list, list, readMultiple, search, search, updateFields, updateMultiple
-
-
-
-
Constructor Detail
-
ProjectSubscriptionServiceImpl
@Autowired public ProjectSubscriptionServiceImpl(ProjectSubscriptionRepository projectSubscriptionRepository, ProjectUserJoinRepository pujRepository, UserGroupProjectJoinRepository ugpjRepository, javax.validation.Validator validator)
-
-
Method Detail
-
read
@PreAuthorize("hasRole(\'ROLE_USER\')") public ProjectSubscription read(java.lang.Long id) throws EntityNotFoundException
Read the object type by unique identifier.- Specified by:
read
in interfaceCRUDService<java.lang.Long,ProjectSubscription>
- Overrides:
read
in classCRUDServiceImpl<java.lang.Long,ProjectSubscription>
- Parameters:
id
- The unique identifier for this object.- Returns:
- The object corresponding to the unique identifier.
- Throws:
EntityNotFoundException
- If the identifier does not exist in the database.
-
list
@PreAuthorize("hasRole(\'ROLE_USER\')") public org.springframework.data.domain.Page<ProjectSubscription> list(int page, int size, org.springframework.data.domain.Sort sort) throws java.lang.IllegalArgumentException
List objects ofType
in the database, limited to some specific page- Specified by:
list
in interfaceCRUDService<java.lang.Long,ProjectSubscription>
- Overrides:
list
in classCRUDServiceImpl<java.lang.Long,ProjectSubscription>
- Parameters:
page
- the specific page to usesize
- the size of the pagessort
- ASort
object for ordering the results- Returns:
- a list of objects in the given range
- Throws:
java.lang.IllegalArgumentException
-
getProjectSubscriptionsForUser
@PreAuthorize("hasRole(\'ROLE_USER\')") public org.springframework.data.domain.Page<ProjectSubscription> getProjectSubscriptionsForUser(User user, int page, int size, org.springframework.data.domain.Sort sort)
Get a page of project subscriptions associated with a user.- Specified by:
getProjectSubscriptionsForUser
in interfaceProjectSubscriptionService
- Parameters:
user
- the user to show project subscriptions forpage
- the current page of resultssize
- the number of results on the pagesort
- the sort properties- Returns:
Page
ofProjectSubscription
s
-
update
@PreAuthorize("hasRole(\'ROLE_USER\')") public ProjectSubscription update(ProjectSubscription projectSubscription)
Update an object- Specified by:
update
in interfaceCRUDService<java.lang.Long,ProjectSubscription>
- Overrides:
update
in classCRUDServiceImpl<java.lang.Long,ProjectSubscription>
- Parameters:
projectSubscription
- The object to update- Returns:
- The updated object
-
getUsersWithEmailSubscriptions
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.util.List<User> getUsersWithEmailSubscriptions()
- Specified by:
getUsersWithEmailSubscriptions
in interfaceProjectSubscriptionService
- Returns:
- A List of
User
s
-
getProjectsForUserWithEmailSubscriptions
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.util.List<Project> getProjectsForUserWithEmailSubscriptions(User user)
- Specified by:
getProjectsForUserWithEmailSubscriptions
in interfaceProjectSubscriptionService
- Parameters:
user
- the user to show project subscriptions for- Returns:
- A List of
Project
s
-
addProjectSubscriptionForProjectAndUser
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\') or hasPermission(#userGroup, \'canUpdateUserGroup\')") public ProjectSubscription addProjectSubscriptionForProjectAndUser(Project project, User user)
- Specified by:
addProjectSubscriptionForProjectAndUser
in interfaceProjectSubscriptionService
- Parameters:
project
- the projectuser
- the user- Returns:
- The newly created project subscription
-
removeProjectSubscriptionForProjectAndUser
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\') or hasPermission(#userGroup, \'canUpdateUserGroup\')") public void removeProjectSubscriptionForProjectAndUser(Project project, User user)
- Specified by:
removeProjectSubscriptionForProjectAndUser
in interfaceProjectSubscriptionService
- Parameters:
project
- the projectuser
- the user
-
-