Package org.ametys.odf.course
Class ShareableCourseStatusHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.odf.course.ShareableCourseStatusHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
- Direct Known Subclasses:
WebShareableCourseStatusHelper
public class ShareableCourseStatusHelper
extends AbstractLogEnabled
implements Component, Serviceable
Helper for shareable course status
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration for the shareable course status -
Field Summary
Modifier and TypeFieldDescriptionprotected ContentHelper
The content helperprotected CurrentUserProvider
The current user providerprotected I18nUtils
The i18n utilsprotected ObservationManager
The observation managerprotected AmetysObjectResolver
The ametys object resolverprotected RightManager
The right managerprotected UserManager
The user managerstatic final String
The component role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getBodyI18nParams
(User user, Content content) Get the i18n parameters of mail body textprotected String
_getContentUri
(Content content) Get the content uriprotected String
_getFiltersText
(Content content) Get the list of filter as text for the mail body_getFooterI18nParams
(User user, Content content) Get the i18n parameters of mail footer textprotected String
Get the text body of mailprotected String
_getMailSubject
(String subjectI18nKey, Content content) Get the subject of mailprotected String
Get the request URI._getSubjectI18nParams
(Content content) Get the i18n parameters of mail subjectprotected void
Send a notification with the content modified event.protected void
_sendNotificationMail
(Content content, Set<UserIdentity> usersNotified, String comment, String mailSubjectKey, String mailBodyKey, String mailFooterKey) Send mail to usersgetProposedStateAuthor
(Content content) Get 'proposed' state authorgetShareableStatus
(Content content) Get the shareable status of the courseboolean
removeShareableWorkflow
(ModifiableContent content) Remove the shareable course workflow metadata.void
service
(ServiceManager manager) boolean
setProposedStateAttribute
(ModifiableContent content, LocalDate proposeDate, UserIdentity user) Set the attribute for 'proposed' stateboolean
setRefusedStateAttribute
(ModifiableContent content, LocalDate validationDate, UserIdentity user, String comment) Set the attribute for 'validated' stateboolean
setValidatedStateAttribute
(ModifiableContent content, LocalDate validationDate, UserIdentity user) Set the attribute for 'validated' statevoid
setWorkflowStateAttribute
(ModifiableContent content, LocalDate validationDate, UserIdentity user, ShareableCourseStatusHelper.ShareableStatus status, String comment, boolean ignoreRights) Set the workflow state attribute (date, login) to the contentMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role. -
_currentUserProvider
The current user provider -
_observationManager
The observation manager -
_rightManager
The right manager -
_userManager
The user manager -
_i18nUtils
The i18n utils -
_contentHelper
The content helper -
_resolver
The ametys object resolver
-
-
Constructor Details
-
ShareableCourseStatusHelper
public ShareableCourseStatusHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setProposedStateAttribute
public boolean setProposedStateAttribute(ModifiableContent content, LocalDate proposeDate, UserIdentity user) Set the attribute for 'proposed' state- Parameters:
content
- the contentproposeDate
- the proposed dateuser
- the user- Returns:
true
if the content has changed.
-
setValidatedStateAttribute
public boolean setValidatedStateAttribute(ModifiableContent content, LocalDate validationDate, UserIdentity user) Set the attribute for 'validated' state- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the login- Returns:
true
if the content has changed.
-
setRefusedStateAttribute
public boolean setRefusedStateAttribute(ModifiableContent content, LocalDate validationDate, UserIdentity user, String comment) Set the attribute for 'validated' state- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the logincomment
- the comment. Can be null- Returns:
true
if the content has changed.
-
getProposedStateAuthor
Get 'proposed' state author- Parameters:
content
- the content- Returns:
- the 'proposed' state author
-
_sendNotificationMail
protected void _sendNotificationMail(Content content, Set<UserIdentity> usersNotified, String comment, String mailSubjectKey, String mailBodyKey, String mailFooterKey) Send mail to users- Parameters:
content
- the course modifiedusersNotified
- the list of user to notifycomment
- the comment. Can be nullmailSubjectKey
- the mail subject i18n keymailBodyKey
- the mail body i18n keymailFooterKey
- the i18n key for footer body
-
_getMailSubject
Get the subject of mail- Parameters:
subjectI18nKey
- the i18n key to use for subjectcontent
- the content- Returns:
- the subject
-
_getSubjectI18nParams
Get the i18n parameters of mail subject- Parameters:
content
- the content- Returns:
- the i18n parameters
-
_getMailBody
protected String _getMailBody(String bodyI18nKey, String footerI18nKey, User user, Content content, String comment) Get the text body of mail- Parameters:
bodyI18nKey
- the i18n key to use for bodyfooterI18nKey
- the i18n key to use for footer bodyuser
- the callercontent
- the contentcomment
- the comment. Can be null- Returns:
- the text body
-
_getBodyI18nParams
Get the i18n parameters of mail body text- Parameters:
user
- the callercontent
- the content- Returns:
- the i18n parameters
-
_getFiltersText
Get the list of filter as text for the mail body- Parameters:
content
- the content- Returns:
- the list of filter as text
-
_getContentUri
Get the content uri- Parameters:
content
- the content- Returns:
- the content uri
-
_getRequestUri
Get the request URI.- Returns:
- the full request URI.
-