Class PilotageStatusHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.odfpilotage.helper.PilotageStatusHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class PilotageStatusHelper extends AbstractLogEnabled implements Component, Serviceable
Helper for ODF pilotage status
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PilotageStatusHelper.PilotageStatus
Enumeration for the pilotage status
-
Field Summary
Fields Modifier and Type Field Description private static String
__CFVU_MCC_VALIDATION_AUTHOR
The attribute name for the author of the CFVU MCC validationprivate static String
__CFVU_MCC_VALIDATION_COMMENT
The attribute name for the comment of the CFVU MCC validationprivate static String
__CFVU_MCC_VALIDATION_DATE
The attribute name for the date of the CFVU MCC validationprivate static String
__CFVU_VALIDATION_AUTHOR
The attribute name for the author of the CFVU validationprivate static String
__CFVU_VALIDATION_COMMENT
The attribute name for the comment of the CFVU validationprivate static String
__CFVU_VALIDATION_DATE
The attribute name for the date of the CFVU validationprivate static String
__MENTION_VALIDATION_AUTHOR
The attribute name for the author of the mention validationprivate static String
__MENTION_VALIDATION_COMMENT
The attribute name for the comment of the mention validationprivate static String
__MENTION_VALIDATION_DATE
The attribute name for the date of the mention validationprivate static String
__ORGUNIT_VALIDATION_AUTHOR
The attribute name for the author of the orgUnit validationprivate static String
__ORGUNIT_VALIDATION_COMMENT
The attribute name for the comment of the orgUnit validationprivate static String
__ORGUNIT_VALIDATION_DATE
The attribute name for the date of the orgUnit validationprivate static String
__PILOTAGE_COMPOSITE
The attribute name for the pilotage compositeprivate static String
__PILOTAGE_STATUS
The attribute name for the pilotage statusprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected ObservationManager
_observationManager
The observation managerprotected ODFHelper
_odfHelper
The odf helperprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected RightManager
_rightManager
The right managerstatic String
MENTION_VALIDATION_SUPER_RIGHT_ID
The super right for mention validation statestatic String
ORGUNIT_VALIDATION_SUPER_RIGHT_ID
The super right for orgunit validation statestatic String
ROLE
The component role.
-
Constructor Summary
Constructors Constructor Description PilotageStatusHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_notifyPilotageWorkflowModification(Content content)
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 knowUserIdentity
getCFVUMCCValidationAuthor(Content content)
Get CFVU MCC validation authorString
getCFVUMCCValidationComment(Content content)
Get CFVU MCC validation commentLocalDate
getCFVUMCCValidationDate(Content content)
Get CFVU MMC validation dateUserIdentity
getCFVUValidationAuthor(Content content)
Get CFVU validation authorString
getCFVUValidationComment(Content content)
Get CFVU validation commentLocalDate
getCFVUValidationDate(Content content)
Get CFVU validation dateUserIdentity
getMentionValidationAuthor(Content content)
Get mention validation authorString
getMentionValidationComment(Content content)
Get mention validation commentLocalDate
getMentionValidationDate(Content content)
Get mention validation dateUserIdentity
getOrgUnitValidationAuthor(Content content)
Get orgUnit validation authorString
getOrgUnitValidationComment(Content content)
Get orgUnit validation commentLocalDate
getOrgUnitValidationDate(Content content)
Get orgUnit validation dateSet<Program>
getParentPrograms(ProgramItem programItem)
Get all program parent from the program itemSet<Program>
getParentProgramsWithPilotageStatus(ProgramItem programItem)
Get all program parent with a pilotage status from the program itemProgram
getParentProgramWithHigherPilotageStatus(ProgramItem programItem)
Get parent program or it self from program item with the higher pilotage status.Map<String,Object>
getPilotageButtonInfo(String contentId)
Get the pilotage information status for a client side element.PilotageStatusHelper.PilotageStatus
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
removeCFVUMCCValidationAttribute(ModifiableDefaultContent content)
Remove validation attribute for 'CFVU MCC validated' stateboolean
removeCFVUValidationAttribute(ModifiableDefaultContent content)
Remove validation attribute for 'CFVU validated' stateboolean
removeMentionValidationAttribute(ModifiableDefaultContent content)
Remove validation attribute for 'mention validated' stateboolean
removeOrgUnitValidationAttribute(ModifiableDefaultContent content)
Remove validation attribute for 'orgunit validated' statevoid
removePilotageStatus(ModifiableDefaultContent content, PilotageStatusHelper.PilotageStatus status)
Remove the validation attribute from the contentboolean
removePilotageWorkflow(ModifiableDefaultContent content)
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 content-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
MENTION_VALIDATION_SUPER_RIGHT_ID
public static final String MENTION_VALIDATION_SUPER_RIGHT_ID
The super right for mention validation state- See Also:
- Constant Field Values
-
ORGUNIT_VALIDATION_SUPER_RIGHT_ID
public static final String ORGUNIT_VALIDATION_SUPER_RIGHT_ID
The super right for orgunit validation state- See Also:
- Constant Field Values
-
__PILOTAGE_COMPOSITE
private static final String __PILOTAGE_COMPOSITE
The attribute name for the pilotage composite- See Also:
- Constant Field Values
-
__PILOTAGE_STATUS
private static final String __PILOTAGE_STATUS
The attribute name for the pilotage status- See Also:
- Constant Field Values
-
__MENTION_VALIDATION_DATE
private static final String __MENTION_VALIDATION_DATE
The attribute name for the date of the mention validation- See Also:
- Constant Field Values
-
__MENTION_VALIDATION_AUTHOR
private static final String __MENTION_VALIDATION_AUTHOR
The attribute name for the author of the mention validation- See Also:
- Constant Field Values
-
__MENTION_VALIDATION_COMMENT
private static final String __MENTION_VALIDATION_COMMENT
The attribute name for the comment of the mention validation- See Also:
- Constant Field Values
-
__ORGUNIT_VALIDATION_DATE
private static final String __ORGUNIT_VALIDATION_DATE
The attribute name for the date of the orgUnit validation- See Also:
- Constant Field Values
-
__ORGUNIT_VALIDATION_AUTHOR
private static final String __ORGUNIT_VALIDATION_AUTHOR
The attribute name for the author of the orgUnit validation- See Also:
- Constant Field Values
-
__ORGUNIT_VALIDATION_COMMENT
private static final String __ORGUNIT_VALIDATION_COMMENT
The attribute name for the comment of the orgUnit validation- See Also:
- Constant Field Values
-
__CFVU_VALIDATION_DATE
private static final String __CFVU_VALIDATION_DATE
The attribute name for the date of the CFVU validation- See Also:
- Constant Field Values
-
__CFVU_VALIDATION_AUTHOR
private static final String __CFVU_VALIDATION_AUTHOR
The attribute name for the author of the CFVU validation- See Also:
- Constant Field Values
-
__CFVU_VALIDATION_COMMENT
private static final String __CFVU_VALIDATION_COMMENT
The attribute name for the comment of the CFVU validation- See Also:
- Constant Field Values
-
__CFVU_MCC_VALIDATION_DATE
private static final String __CFVU_MCC_VALIDATION_DATE
The attribute name for the date of the CFVU MCC validation- See Also:
- Constant Field Values
-
__CFVU_MCC_VALIDATION_AUTHOR
private static final String __CFVU_MCC_VALIDATION_AUTHOR
The attribute name for the author of the CFVU MCC validation- See Also:
- Constant Field Values
-
__CFVU_MCC_VALIDATION_COMMENT
private static final String __CFVU_MCC_VALIDATION_COMMENT
The attribute name for the comment of the CFVU MCC validation- See Also:
- Constant Field Values
-
_odfHelper
protected ODFHelper _odfHelper
The odf helper
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_rightManager
protected RightManager _rightManager
The right manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_observationManager
protected ObservationManager _observationManager
The observation manager
-
-
Constructor Detail
-
PilotageStatusHelper
public PilotageStatusHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getParentPrograms
public Set<Program> getParentPrograms(ProgramItem programItem)
Get all program parent from the program item- Parameters:
programItem
- the program item- Returns:
- the set of program parent
-
getParentProgramsWithPilotageStatus
public Set<Program> getParentProgramsWithPilotageStatus(ProgramItem programItem)
Get all program parent with a pilotage status from the program item- Parameters:
programItem
- the program item- Returns:
- the set of program parent
-
hasEditSuperRight
public boolean hasEditSuperRight(Program program)
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
public 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 know- Parameters:
program1
- program 1program2
- progam 2- Returns:
- the int compare number
-
getParentProgramWithHigherPilotageStatus
public Program getParentProgramWithHigherPilotageStatus(ProgramItem programItem)
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
public Map<String,Object> getPilotageButtonInfo(String contentId)
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
public PilotageStatusHelper.PilotageStatus getPilotageStatus(Content content)
Get the pilotage status of the content- Parameters:
content
- the content- Returns:
- the pilotage status
-
_notifyPilotageWorkflowModification
protected void _notifyPilotageWorkflowModification(Content content)
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
public boolean removeMentionValidationAttribute(ModifiableDefaultContent content)
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
public boolean removeOrgUnitValidationAttribute(ModifiableDefaultContent content)
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
public boolean removeCFVUValidationAttribute(ModifiableDefaultContent content)
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
public boolean removeCFVUMCCValidationAttribute(ModifiableDefaultContent content)
Remove validation attribute for 'CFVU MCC validated' state- Parameters:
content
- the content- Returns:
true
if the content has changed.
-
getMentionValidationDate
public LocalDate getMentionValidationDate(Content content)
Get mention validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getMentionValidationComment
public String getMentionValidationComment(Content content)
Get mention validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getMentionValidationAuthor
public UserIdentity getMentionValidationAuthor(Content content)
Get mention validation author- Parameters:
content
- the content- Returns:
- the validation author
-
getOrgUnitValidationDate
public LocalDate getOrgUnitValidationDate(Content content)
Get orgUnit validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getOrgUnitValidationComment
public String getOrgUnitValidationComment(Content content)
Get orgUnit validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getOrgUnitValidationAuthor
public UserIdentity getOrgUnitValidationAuthor(Content content)
Get orgUnit validation author- Parameters:
content
- the content- Returns:
- the validation author
-
getCFVUValidationDate
public LocalDate getCFVUValidationDate(Content content)
Get CFVU validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getCFVUValidationComment
public String getCFVUValidationComment(Content content)
Get CFVU validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getCFVUValidationAuthor
public UserIdentity getCFVUValidationAuthor(Content content)
Get CFVU validation author- Parameters:
content
- the content- Returns:
- the validation author
-
getCFVUMCCValidationDate
public LocalDate getCFVUMCCValidationDate(Content content)
Get CFVU MMC validation date- Parameters:
content
- the content- Returns:
- the validation date
-
getCFVUMCCValidationComment
public String getCFVUMCCValidationComment(Content content)
Get CFVU MCC validation comment- Parameters:
content
- the content- Returns:
- the validation comment
-
getCFVUMCCValidationAuthor
public UserIdentity getCFVUMCCValidationAuthor(Content content)
Get CFVU MCC validation author- Parameters:
content
- the content- Returns:
- the validation author
-
removePilotageWorkflow
public boolean removePilotageWorkflow(ModifiableDefaultContent content)
Remove the pilotage workflow metadata.- Parameters:
content
- The content to clean- Returns:
true
if the content has changed
-
saveContent
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.- Parameters:
content
- The content to save- Returns:
true
if the content has changed
-
-