Class PilotageStatusHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.odfpilotage.helper.PilotageStatusHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Helper for ODF pilotage status
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration for the pilotage status -
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected ObservationManager
The observation managerprotected ODFHelper
The odf helperprotected AmetysObjectResolver
The Ametys object resolverprotected RightManager
The right managerstatic final String
The super right for mention validation statestatic final String
The super right for orgunit validation statestatic final String
The component role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Send a notification with the content modified event.int
comparePilotageStatus
(Program program1, Program program2) Compare two programs depends on their pilotage status Pilotage status order : NONE lower than MENTION_VALIDATED lower than ORGUNIT_VALIDATED lower than CFVU_VALIDATED lower than CFVU_VALIDATED lower than CFVU_MCC_VALIDATED -1 if pilotage status of program 1 is lower than pilotage status of program 2 0 if they have the same pilotage status 1 if pilotage status of program 1 is higher than pilotage status of program 2 -2 if we don't knowgetCFVUMCCValidationAuthor
(Content content) Get CFVU MCC validation authorgetCFVUMCCValidationComment
(Content content) Get CFVU MCC validation commentgetCFVUMCCValidationDate
(Content content) Get CFVU MMC validation dategetCFVUValidationAuthor
(Content content) Get CFVU validation authorgetCFVUValidationComment
(Content content) Get CFVU validation commentgetCFVUValidationDate
(Content content) Get CFVU validation dategetMentionValidationAuthor
(Content content) Get mention validation authorgetMentionValidationComment
(Content content) Get mention validation commentgetMentionValidationDate
(Content content) Get mention validation dategetOrgUnitValidationAuthor
(Content content) Get orgUnit validation authorgetOrgUnitValidationComment
(Content content) Get orgUnit validation commentgetOrgUnitValidationDate
(Content content) Get orgUnit validation dategetParentPrograms
(ProgramItem programItem) Get all program parent from the program itemgetParentProgramsWithPilotageStatus
(ProgramItem programItem) Get all program parent with a pilotage status from the program itemgetParentProgramWithHigherPilotageStatus
(CoursePart coursePart) Get parent program or it self from program item with the higher pilotage status.getParentProgramWithHigherPilotageStatus
(ProgramItem programItem) Get parent program or it self from program item with the higher pilotage status.getPilotageButtonInfo
(String contentId) Get the pilotage information status for a client side element.getPilotageStatus
(Content content) Get the pilotage status of the contentboolean
hasEditSuperRight
(Program program) Return true if the current user has the edit super right depend on the pilotage status of the programboolean
Remove validation attribute for 'CFVU MCC validated' stateboolean
Remove validation attribute for 'CFVU validated' stateboolean
Remove validation attribute for 'mention validated' stateboolean
Remove validation attribute for 'orgunit validated' statevoid
Remove the validation attribute from the contentboolean
Remove the pilotage workflow metadata.protected boolean
saveContent
(ModifiableDefaultContent content) Save the content if needed, add a version (checkpoint) and move the Live label if the last version was validated.void
service
(ServiceManager manager) boolean
setCFVUMCCValidationAttribute
(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'CFVU MCC validated' stateboolean
setCFVUValidationAttribute
(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'CFVU validated' stateboolean
setMentionValidationAttribute
(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'mention validated' stateboolean
setOrgUnitValidationAttribute
(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'orgunit validated' statevoid
setValidationAttribute
(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment, PilotageStatusHelper.PilotageStatus status) Set the validation attribute (date, login, comment) to the contentMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role. -
MENTION_VALIDATION_SUPER_RIGHT_ID
The super right for mention validation state- See Also:
-
ORGUNIT_VALIDATION_SUPER_RIGHT_ID
The super right for orgunit validation state- See Also:
-
_odfHelper
The odf helper -
_resolver
The Ametys object resolver -
_rightManager
The right manager -
_currentUserProvider
The current user provider -
_observationManager
The observation manager
-
-
Constructor Details
-
PilotageStatusHelper
public PilotageStatusHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getParentPrograms
Get all program parent from the program item- Parameters:
programItem
- the program item- Returns:
- the set of program parent
-
getParentProgramsWithPilotageStatus
Get all program parent with a pilotage status from the program item- Parameters:
programItem
- the program item- Returns:
- the set of program parent
-
hasEditSuperRight
Return true if the current user has the edit super right depend on the pilotage status of the program- Parameters:
program
- the program- Returns:
- true if the user has the super right
-
comparePilotageStatus
Compare two programs depends on their pilotage status Pilotage status order : NONE lower than MENTION_VALIDATED lower than ORGUNIT_VALIDATED lower than CFVU_VALIDATED lower than CFVU_VALIDATED lower than CFVU_MCC_VALIDATED -1 if pilotage status of program 1 is lower than pilotage status of program 2 0 if they have the same pilotage status 1 if pilotage status of program 1 is higher than pilotage status of program 2 -2 if we don't know- Parameters:
program1
- program 1program2
- progam 2- Returns:
- the int compare number
-
getParentProgramWithHigherPilotageStatus
Get parent program or it self from program item with the higher pilotage status. Program with pilotage status NONE are ignored, so can be null if there are no program with active pilotage status.- Parameters:
coursePart
- the course part- Returns:
- the program parent
-
getParentProgramWithHigherPilotageStatus
Get parent program or it self from program item with the higher pilotage status. Program with pilotage status NONE are ignored, so can be null if there are no program with active pilotage status.- Parameters:
programItem
- the program item- Returns:
- the program parent
-
getPilotageButtonInfo
Get the pilotage information status for a client side element. The button is enabled if the pilotage status of root programs is NONE or if the current user has super edit right on root program of higher status- Parameters:
contentId
- the content id- Returns:
- the pilotage information
-
getPilotageStatus
Get the pilotage status of the content- Parameters:
content
- the content- Returns:
- the pilotage status
-
_notifyPilotageWorkflowModification
Send a notification with the content modified event.- Parameters:
content
- The content to notify on
-
setValidationAttribute
public void setValidationAttribute(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment, PilotageStatusHelper.PilotageStatus status) Set the validation attribute (date, login, comment) to the content- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the usercomment
- the commentstatus
- the pilotage status
-
removePilotageStatus
public void removePilotageStatus(ModifiableDefaultContent content, PilotageStatusHelper.PilotageStatus status) Remove the validation attribute from the content- Parameters:
content
- the contentstatus
- the pilotage status
-
setMentionValidationAttribute
public boolean setMentionValidationAttribute(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'mention validated' state- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the usercomment
- the comment- Returns:
true
if the content has changed.
-
removeMentionValidationAttribute
Remove validation attribute for 'mention validated' state- Parameters:
content
- the content- Returns:
true
if the content has changed.
-
setOrgUnitValidationAttribute
public boolean setOrgUnitValidationAttribute(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'orgunit validated' state- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the usercomment
- the comment- Returns:
true
if the content has changed.
-
removeOrgUnitValidationAttribute
Remove validation attribute for 'orgunit validated' state- Parameters:
content
- the content- Returns:
true
if the content has changed.
-
setCFVUValidationAttribute
public boolean setCFVUValidationAttribute(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'CFVU validated' state- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the logincomment
- the comment- Returns:
true
if the content has changed.
-
removeCFVUValidationAttribute
Remove validation attribute for 'CFVU validated' state- Parameters:
content
- the content- Returns:
true
if the content has changed.
-
setCFVUMCCValidationAttribute
public boolean setCFVUMCCValidationAttribute(ModifiableDefaultContent content, LocalDate validationDate, UserIdentity user, String comment) Set the validation attribute for 'CFVU MCC validated' state- Parameters:
content
- the contentvalidationDate
- the validation dateuser
- the usercomment
- the comment- Returns:
true
if the content has changed.
-
removeCFVUMCCValidationAttribute
Remove validation attribute for 'CFVU MCC validated' state- Parameters:
content
- the content- Returns:
true
if the content has changed.
-
getMentionValidationDate
Get mention validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getMentionValidationComment
Get mention validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getMentionValidationAuthor
Get mention validation author- Parameters:
content
- the content- Returns:
- the validation author
-
getOrgUnitValidationDate
Get orgUnit validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getOrgUnitValidationComment
Get orgUnit validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getOrgUnitValidationAuthor
Get orgUnit validation author- Parameters:
content
- the content- Returns:
- the validation author
-
getCFVUValidationDate
Get CFVU validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getCFVUValidationComment
Get CFVU validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getCFVUValidationAuthor
Get CFVU validation author- Parameters:
content
- the content- Returns:
- the validation author
-
getCFVUMCCValidationDate
Get CFVU MMC validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getCFVUMCCValidationComment
Get CFVU MCC validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getCFVUMCCValidationAuthor
Get CFVU MCC validation author- Parameters:
content
- the content- Returns:
- the validation author
-
removePilotageWorkflow
Remove the pilotage workflow metadata.- Parameters:
content
- The content to clean- Returns:
true
if the content has changed
-
saveContent
Save the content if needed, add a version (checkpoint) and move the Live label if the last version was validated.- Parameters:
content
- The content to save- Returns:
true
if the content has changed
-