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 ProjectSubscriptionaddProjectSubscriptionForProjectAndUser(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 ofTypein the database, limited to some specific pageProjectSubscriptionread(java.lang.Long id)Read the object type by unique identifier.voidremoveProjectSubscriptionForProjectAndUser(Project project, User user)ProjectSubscriptionupdate(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 EntityNotFoundExceptionRead the object type by unique identifier.- Specified by:
readin interfaceCRUDService<java.lang.Long,ProjectSubscription>- Overrides:
readin 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.IllegalArgumentExceptionList objects ofTypein the database, limited to some specific page- Specified by:
listin interfaceCRUDService<java.lang.Long,ProjectSubscription>- Overrides:
listin classCRUDServiceImpl<java.lang.Long,ProjectSubscription>- Parameters:
page- the specific page to usesize- the size of the pagessort- ASortobject 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:
getProjectSubscriptionsForUserin 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:
PageofProjectSubscriptions
-
update
@PreAuthorize("hasRole(\'ROLE_USER\')") public ProjectSubscription update(ProjectSubscription projectSubscription)Update an object- Specified by:
updatein interfaceCRUDService<java.lang.Long,ProjectSubscription>- Overrides:
updatein 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:
getUsersWithEmailSubscriptionsin interfaceProjectSubscriptionService- Returns:
- A List of
Users
-
getProjectsForUserWithEmailSubscriptions
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.util.List<Project> getProjectsForUserWithEmailSubscriptions(User user)- Specified by:
getProjectsForUserWithEmailSubscriptionsin interfaceProjectSubscriptionService- Parameters:
user- the user to show project subscriptions for- Returns:
- A List of
Projects
-
addProjectSubscriptionForProjectAndUser
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canManageLocalProjectSettings\') or hasPermission(#userGroup, \'canUpdateUserGroup\')") public ProjectSubscription addProjectSubscriptionForProjectAndUser(Project project, User user)- Specified by:
addProjectSubscriptionForProjectAndUserin 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:
removeProjectSubscriptionForProjectAndUserin interfaceProjectSubscriptionService- Parameters:
project- the projectuser- the user
-
-