Class PilotageHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.odfpilotage.helper.PilotageHelper
-
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
- Direct Known Subclasses:
ElementRetriever
public class PilotageHelper extends AbstractLogEnabled implements Component, Serviceable, Initializable
The pilotage helper.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PilotageHelper.StepHolderStatus
Enumeration for the step holder status
-
Field Summary
Fields Modifier and Type Field Description protected AbstractCacheManager
_cacheManager
The cache managerprotected ODFHelper
_odfHelper
The helper for ODF contentsprotected OdfReferenceTableHelper
_refTableHelper
The helper for reference tables from ODFprotected static String
_STEP_HOLDERS_BY_ITEM_CACHE_ID
The cache id for step holders by program itemstatic String
MCC_MODALITE_SESSION1
MCC Course naturestatic String
MCC_MODALITE_SESSION2
MCC Course naturestatic String
MCC_SESSION_NATURE
MCC Course naturestatic String
NORME
Normestatic String
ROLE
The avalon role
-
Constructor Summary
Constructors Constructor Description PilotageHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<Container>
_getSteps(ProgramItem programItem, String yearId, Cache<String,Set<Container>> cache)
Internal method to get the steps of a program item, can be directly called by subclasses.protected Set<Container>
_getStepsHolder(ProgramItem programItem, String yearId, Cache<String,Set<Container>> cache)
Get the potential steps holder (step or field "etapePorteuse" in courses) of theProgramItem
.protected Set<Container>
_getStepsToCache(ProgramItem programItem, String yearId, Cache<String,Set<Container>> cache)
Get the steps to add to the cache.protected boolean
_isContainerOfNature(ProgramItem programItem, String natureId)
Filter the program item to keep only container with the given nature.Pair<PilotageHelper.StepHolderStatus,Container>
getStepHolder(ProgramItem programItem)
Get the step holder of a program itemSet<Container>
getSteps(ProgramItem programItem)
Get the steps of a program itemOptional<String>
getYearId()
Get the year container nature identifier.void
initialize()
void
service(ServiceManager manager)
static Double
transformEqTD2Double(String eqTD)
Transform eqTD (can be a quotient) to a double value.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
MCC_MODALITE_SESSION1
public static final String MCC_MODALITE_SESSION1
MCC Course nature- See Also:
- Constant Field Values
-
MCC_MODALITE_SESSION2
public static final String MCC_MODALITE_SESSION2
MCC Course nature- See Also:
- Constant Field Values
-
MCC_SESSION_NATURE
public static final String MCC_SESSION_NATURE
MCC Course nature- See Also:
- Constant Field Values
-
NORME
public static final String NORME
Norme- See Also:
- Constant Field Values
-
_STEP_HOLDERS_BY_ITEM_CACHE_ID
protected static final String _STEP_HOLDERS_BY_ITEM_CACHE_ID
The cache id for step holders by program item
-
_odfHelper
protected ODFHelper _odfHelper
The helper for ODF contents
-
_refTableHelper
protected OdfReferenceTableHelper _refTableHelper
The helper for reference tables from ODF
-
_cacheManager
protected AbstractCacheManager _cacheManager
The cache manager
-
-
Constructor Detail
-
PilotageHelper
public PilotageHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getStepHolder
public Pair<PilotageHelper.StepHolderStatus,Container> getStepHolder(ProgramItem programItem)
Get the step holder of a program item- Parameters:
programItem
- The program item- Returns:
Pair
with the step holder status as a key, and the step holder (if found) as a value
-
_getStepsHolder
protected Set<Container> _getStepsHolder(ProgramItem programItem, String yearId, Cache<String,Set<Container>> cache)
Get the potential steps holder (step or field "etapePorteuse" in courses) of theProgramItem
.- Parameters:
programItem
- The program itemyearId
- The identifier of the year container naturecache
- The cache- Returns:
- The list of potential steps holder linked to the programItem. It there are several, there is no defined step holder.
-
_isContainerOfNature
protected boolean _isContainerOfNature(ProgramItem programItem, String natureId)
Filter the program item to keep only container with the given nature.- Parameters:
programItem
- The program itemnatureId
- The container nature identifier- Returns:
true
if it is a container of the given nature,false
otherwise
-
getSteps
public Set<Container> getSteps(ProgramItem programItem)
Get the steps of a program item- Parameters:
programItem
- The program item- Returns:
- The steps of the given program item
-
_getSteps
protected Set<Container> _getSteps(ProgramItem programItem, String yearId, Cache<String,Set<Container>> cache)
Internal method to get the steps of a program item, can be directly called by subclasses.- Parameters:
programItem
- The program itemyearId
- The identifier of the year container naturecache
- The cache- Returns:
- The steps of the given program item
-
_getStepsToCache
protected Set<Container> _getStepsToCache(ProgramItem programItem, String yearId, Cache<String,Set<Container>> cache)
Get the steps to add to the cache.
-
getYearId
public Optional<String> getYearId()
Get the year container nature identifier.- Returns:
- an
Optional
of the year identifier
-
transformEqTD2Double
public static Double transformEqTD2Double(String eqTD)
Transform eqTD (can be a quotient) to a double value.- Parameters:
eqTD
- The eqTD to parse- Returns:
- The double value equivalent to the given eqTD
-
-