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
Nested Classes Modifier and Type Class Description static class
ShareableCourseStatusHelper.ShareableStatus
Enumeration for the shareable course status
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper
_contentHelper
The content helperprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected I18nUtils
_i18nUtils
The i18n utilsprotected ObservationManager
_observationManager
The observation managerprotected AmetysObjectResolver
_resolver
The ametys object resolverprotected RightManager
_rightManager
The right managerprotected UserManager
_userManager
The user managerstatic String
ROLE
The component role.
-
Constructor Summary
Constructors Constructor Description ShareableCourseStatusHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>
_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 bodyprotected List<String>
_getFooterI18nParams(User user, Content content)
Get the i18n parameters of mail footer textprotected String
_getMailBody(String bodyI18nKey, String footerI18nKey, User user, Content content, String comment)
Get the text body of mailprotected String
_getMailSubject(String subjectI18nKey, Content content)
Get the subject of mailprotected String
_getRequestUri()
Get the request URI.protected List<String>
_getSubjectI18nParams(Content content)
Get the i18n parameters of mail subjectprotected void
_notifyShareableCourseWorkflowModification(Content content)
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 usersUserIdentity
getProposedStateAuthor(Content content)
Get 'proposed' state authorShareableCourseStatusHelper.ShareableStatus
getShareableStatus(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 content-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_observationManager
protected ObservationManager _observationManager
The observation manager
-
_rightManager
protected RightManager _rightManager
The right manager
-
_userManager
protected UserManager _userManager
The user manager
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils
-
_contentHelper
protected ContentHelper _contentHelper
The content helper
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
-
Constructor Detail
-
ShareableCourseStatusHelper
public ShareableCourseStatusHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getShareableStatus
public ShareableCourseStatusHelper.ShareableStatus getShareableStatus(Content content)
Get the shareable status of the course- Parameters:
content
- the content- Returns:
- the shareable course status
-
setWorkflowStateAttribute
public void setWorkflowStateAttribute(ModifiableContent content, LocalDate validationDate, UserIdentity user, ShareableCourseStatusHelper.ShareableStatus status, String comment, boolean ignoreRights)
Set the workflow state attribute (date, login) to the content- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the userstatus
- the shareable course statuscomment
- the comment. Can be nullignoreRights
- true to ignore user rights
-
removeShareableWorkflow
public boolean removeShareableWorkflow(ModifiableContent content)
Remove the shareable course workflow metadata.- Parameters:
content
- The content to clean- Returns:
true
if the content has changed
-
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
public UserIdentity getProposedStateAuthor(Content content)
Get 'proposed' state author- Parameters:
content
- the content- Returns:
- the 'proposed' state author
-
_notifyShareableCourseWorkflowModification
protected void _notifyShareableCourseWorkflowModification(Content content)
Send a notification with the content modified event.- Parameters:
content
- The content to notify on
-
_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
protected String _getMailSubject(String subjectI18nKey, Content content)
Get the subject of mail- Parameters:
subjectI18nKey
- the i18n key to use for subjectcontent
- the content- Returns:
- the subject
-
_getSubjectI18nParams
protected List<String> _getSubjectI18nParams(Content content)
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
protected List<String> _getBodyI18nParams(User user, Content content)
Get the i18n parameters of mail body text- Parameters:
user
- the callercontent
- the content- Returns:
- the i18n parameters
-
_getFooterI18nParams
protected List<String> _getFooterI18nParams(User user, Content content)
Get the i18n parameters of mail footer text- Parameters:
user
- the callercontent
- the content- Returns:
- the i18n parameters
-
_getFiltersText
protected String _getFiltersText(Content content)
Get the list of filter as text for the mail body- Parameters:
content
- the content- Returns:
- the list of filter as text
-
_getContentUri
protected String _getContentUri(Content content)
Get the content uri- Parameters:
content
- the content- Returns:
- the content uri
-
_getRequestUri
protected String _getRequestUri()
Get the request URI.- Returns:
- the full request URI.
-
-