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 classShareableCourseStatusHelper.ShareableStatusEnumeration for the shareable course status
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper_contentHelperThe content helperprotected CurrentUserProvider_currentUserProviderThe current user providerprotected I18nUtils_i18nUtilsThe i18n utilsprotected ObservationManager_observationManagerThe observation managerprotected AmetysObjectResolver_resolverThe ametys object resolverprotected RightManager_rightManagerThe right managerprotected UserManager_userManagerThe user managerstatic StringROLEThe 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 usersUserIdentitygetProposedStateAuthor(Content content)Get 'proposed' state authorShareableCourseStatusHelper.ShareableStatusgetShareableStatus(Content content)Get the shareable status of the coursebooleanremoveShareableWorkflow(ModifiableContent content)Remove the shareable course workflow metadata.voidservice(ServiceManager manager)booleansetProposedStateAttribute(ModifiableContent content, LocalDate proposeDate, UserIdentity user)Set the attribute for 'proposed' statebooleansetRefusedStateAttribute(ModifiableContent content, LocalDate validationDate, UserIdentity user, String comment)Set the attribute for 'validated' statebooleansetValidatedStateAttribute(ModifiableContent content, LocalDate validationDate, UserIdentity user)Set the attribute for 'validated' statevoidsetWorkflowStateAttribute(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:
servicein 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:
trueif 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:
trueif 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:
trueif 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:
trueif 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.
-
-