Class CostComputationComponent
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.odfpilotage.cost.CostComputationComponent
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class CostComputationComponent extends AbstractLogEnabled implements Component, Serviceable
This component computes values used by the cost modeling tool
-
-
Field Summary
Fields Modifier and Type Field Description private static String
__EFFECTIF_ESTIMATED
private static String
__ETAPE_PORTEUSE
private static String
__VALUE_YEAR
protected ODFHelper
_odfHelper
The ODF helperprotected OdfReferenceTableHelper
_refTableHelper
The ODF enumeration helperprotected ReportHelper
_reportHelper
The report helperprotected AmetysObjectResolver
_resolver
The ametys object resolverstatic String
ROLE
The Avalon role name
-
Constructor Summary
Constructors Constructor Description CostComputationComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
_calculEqTD(double effectif, double effectifTotal, double eqTDTotal)
Compute the TD equivalentprotected void
_computeEffectiveAndVentilation(CostComputationData costData, CoursePart coursePart, Course courseParent, NormDetails normDetails, String coursePartPath, CostComputationDataCache cache)
Handle all effectives computations from a course partprotected double
_computeEqTDLocal(double duration, long groupes, Double eqTD)
Compute the total TD equivalentprotected void
_computeEqTDVentilation(CostComputationData costData, CoursePart coursePart, Double enteredEffective, Double globalEffective, Double eqTDTotal)
Compute the effective and the eqTD ventilation by stepprotected Effectives
_computeGlobalAndEnteredEffectives(CostComputationData costData, CoursePart coursePart, ProgramItem programItem, Double initialWeight, CostComputationDataCache cache)
Compute the global and entered effectivesprotected long
_computeGroups(double enteredEffective, double computedEffective, NormDetails normDetails)
compute the number of groups neededprotected Effectives
_computeLocalEffective(CostComputationData costData, CoursePart coursePart, ProgramItem programItem, String programItemPath, CostComputationDataCache cache)
Compute the local effectiveprotected void
_computeLocalEffectiveByWeight(CostComputationData costData, ProgramItem programItem, ProgramItem programItemParent, Effectives computedEffective, String programItemPath, CostComputationDataCache cache)
Compute the local effective of a programItemprotected Effectives
_getComputedGlobalAndEnteredEffectives(CostComputationData costData, CoursePart coursePart, CostComputationDataCache cache)
Get the computed global and entered effectivesprotected Effectives
_getComputedLocalEffective(CostComputationData costData, CoursePart coursePart, Course courseParent, String coursePartPath, CostComputationDataCache cache)
Get the computed local effectiveprotected Double
_getCourseWeight(ProgramItem programItem, ProgramItem programItemParent, CostComputationData costData)
Divide the effective of a program item by the total effective of a course list to retrieve the weightprotected String
_getNorm(Content content, String nature, String prefix, boolean isStepholder, CostComputationDataCache cache)
Retrieve the norm value of a contentprotected String
_getNorm(CoursePart coursePart, String coursePartPrefix, Container stepHolder, CostComputationDataCache cache)
Retrieve the value of the normprotected Optional<NormDetails>
_getNormDetails(Container stepHolder, CoursePart coursePart, String coursePartPrefix, CostComputationDataCache cache)
Get all informations about the normprivate Optional<NormDetails>
_getNormFromNature(String nature, CostComputationDataCache cache)
protected String
_getOrgUnits(Course courseHolder)
Retrieve the orgUnitprotected Container
_getStepHolder(Course courseHolder, String coursePartPrefix)
Get the step holder associated to the courseprotected Map<String,Container>
_getSteps(CostComputationData costData, ProgramItem programItem, String programItemPath)
Get all steps of a program itemprotected Set<Container>
_getStepsHolder(ProgramItem programItem, String coursePartPrefix)
Find steps holdersprotected double
_getWeight(ProgramItem programItem)
Define the weight of an itemprotected void
_populateCourse(CostComputationData costData, Course course, String coursePath, CostComputationDataCache cache)
Explore the course and iterate its course part to populate themprotected void
_populateCoursePart(CostComputationData costData, CoursePart coursePart, Course courseParent, String coursePartPath, CostComputationDataCache cache)
Fill a costData object with informations about the course and the course partprotected void
_populateOrgUnit(CostComputationData costData, OrgUnit orgUnit, CostComputationDataCache cache, String orgUnitPath, String catalog, String lang)
Iterate and explore each program of an orgUnitprotected void
_populateOrgUnits(CostComputationData costData, OrgUnit orgUnit, CostComputationDataCache cache, String catalog, String lang)
Iterate and explore each orgUnit of the structureprotected void
_populateProgram(CostComputationData costData, Program program, String programPath, CostComputationDataCache cache)
Iterate and explore each container of the catalogprotected void
_populateStep(CostComputationData costData, ProgramItem programItem, String objectPath, CostComputationDataCache cache)
Iterate recursively each child of the current programItem to find the lowest course levelprotected void
_populateSubProgram(CostComputationData costData, Program program, String programPath, CostComputationDataCache cache)
Iterate and explore each sub program of the catalogprotected void
_setProgramItemStructure(ProgramItem programItem, CostComputationData costData, CostComputationDataCache cache)
Iterate the program item structure and compute the global effective for each course partCostComputationData
computeCostsOnOrgUnits(OrgUnit orgUnit, String catalog, String lang)
Call methods to initialize data and compute groups distribution from an orgUnitCostComputationData
computeCostsOnOrgUnits(OrgUnit orgUnit, String catalog, String lang, OverriddenData overriddenData)
Call methods to initialize data and compute groups distribution from an orgUnitCostComputationData
computeCostsOnProgram(Program program)
Call methods to initialize data and compute groups distribution from a programCostComputationData
computeCostsOnProgram(Program program, OverriddenData overriddenData)
Call methods to initialize data and compute groups distribution from a programCostComputationData
computeCostsOnPrograms(List<Program> programs)
Call methods to initialize data and compute groups distribution from a catalogCostComputationData
computeCostsOnPrograms(List<Program> programs, OverriddenData overriddenData)
Call methods to initialize data and compute groups distribution from a catalogvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
__VALUE_YEAR
private static final String __VALUE_YEAR
- See Also:
- Constant Field Values
-
__ETAPE_PORTEUSE
private static final String __ETAPE_PORTEUSE
- See Also:
- Constant Field Values
-
__EFFECTIF_ESTIMATED
private static final String __EFFECTIF_ESTIMATED
- See Also:
- Constant Field Values
-
_refTableHelper
protected OdfReferenceTableHelper _refTableHelper
The ODF enumeration helper
-
_reportHelper
protected ReportHelper _reportHelper
The report helper
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
-
Constructor Detail
-
CostComputationComponent
public CostComputationComponent()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
computeCostsOnOrgUnits
public CostComputationData computeCostsOnOrgUnits(OrgUnit orgUnit, String catalog, String lang)
Call methods to initialize data and compute groups distribution from an orgUnit- Parameters:
orgUnit
- the orgUnitcatalog
- the cataloglang
- the lang- Returns:
- CostData object containing informations about the formation
-
computeCostsOnOrgUnits
public CostComputationData computeCostsOnOrgUnits(OrgUnit orgUnit, String catalog, String lang, OverriddenData overriddenData)
Call methods to initialize data and compute groups distribution from an orgUnit- Parameters:
orgUnit
- the orgUnitcatalog
- the cataloglang
- the langoverriddenData
- overridden data by the user- Returns:
- CostData object containing informations about the formation
-
computeCostsOnPrograms
public CostComputationData computeCostsOnPrograms(List<Program> programs)
Call methods to initialize data and compute groups distribution from a catalog- Parameters:
programs
- the catalog- Returns:
- CostData object containing informations about the formation
-
computeCostsOnPrograms
public CostComputationData computeCostsOnPrograms(List<Program> programs, OverriddenData overriddenData)
Call methods to initialize data and compute groups distribution from a catalog- Parameters:
programs
- the catalogoverriddenData
- overridden data by the user- Returns:
- CostData object containing informations about the formation
-
computeCostsOnProgram
public CostComputationData computeCostsOnProgram(Program program)
Call methods to initialize data and compute groups distribution from a program- Parameters:
program
- the program- Returns:
- CostData object containing informations about the formation
-
computeCostsOnProgram
public CostComputationData computeCostsOnProgram(Program program, OverriddenData overriddenData)
Call methods to initialize data and compute groups distribution from a program- Parameters:
program
- the programoverriddenData
- overridden data by the user- Returns:
- CostData object containing informations about the formation
-
_setProgramItemStructure
protected void _setProgramItemStructure(ProgramItem programItem, CostComputationData costData, CostComputationDataCache cache)
Iterate the program item structure and compute the global effective for each course part- Parameters:
programItem
- the program itemcostData
- object containing informations about the formationcache
- the cache values
-
_populateOrgUnits
protected void _populateOrgUnits(CostComputationData costData, OrgUnit orgUnit, CostComputationDataCache cache, String catalog, String lang)
Iterate and explore each orgUnit of the structure- Parameters:
orgUnit
- the orgUnitcostData
- object containing informations about the formationcache
- the cache valuescatalog
- the cataloglang
- the lang
-
_populateOrgUnit
protected void _populateOrgUnit(CostComputationData costData, OrgUnit orgUnit, CostComputationDataCache cache, String orgUnitPath, String catalog, String lang)
Iterate and explore each program of an orgUnit- Parameters:
orgUnit
- the orgUnitcostData
- object containing informations about the formationcache
- the cache valuesorgUnitPath
- the current pathcatalog
- the cataloglang
- the lang
-
_populateProgram
protected void _populateProgram(CostComputationData costData, Program program, String programPath, CostComputationDataCache cache)
Iterate and explore each container of the catalog- Parameters:
program
- the catalogcostData
- object containing informations about the formationprogramPath
- the current pathcache
- the cache values
-
_populateSubProgram
protected void _populateSubProgram(CostComputationData costData, Program program, String programPath, CostComputationDataCache cache)
Iterate and explore each sub program of the catalog- Parameters:
program
- the catalogcostData
- object containing informations about the formationprogramPath
- the current pathcache
- the cache values
-
_populateStep
protected void _populateStep(CostComputationData costData, ProgramItem programItem, String objectPath, CostComputationDataCache cache)
Iterate recursively each child of the current programItem to find the lowest course level- Parameters:
costData
- object containing informations about the formationobjectPath
- the current pathprogramItem
- the current nodecache
- the cache values
-
_populateCourse
protected void _populateCourse(CostComputationData costData, Course course, String coursePath, CostComputationDataCache cache)
Explore the course and iterate its course part to populate them- Parameters:
costData
- object containing informations about the formationcoursePath
- the current pathcourse
- the coursecache
- the cache values
-
_populateCoursePart
protected void _populateCoursePart(CostComputationData costData, CoursePart coursePart, Course courseParent, String coursePartPath, CostComputationDataCache cache)
Fill a costData object with informations about the course and the course part- Parameters:
costData
- object containing informations about the formationcoursePart
- the object to explorecourseParent
- The parent of the course partcoursePartPath
- the current pathcache
- the cache values
-
_computeEffectiveAndVentilation
protected void _computeEffectiveAndVentilation(CostComputationData costData, CoursePart coursePart, Course courseParent, NormDetails normDetails, String coursePartPath, CostComputationDataCache cache)
Handle all effectives computations from a course part- Parameters:
costData
- object containing informations about the formationcoursePart
- the object to explorecourseParent
- the parent of the course partnormDetails
- informations about the norm of the course partcoursePartPath
- the course part pathcache
- the cache values
-
_computeEqTDVentilation
protected void _computeEqTDVentilation(CostComputationData costData, CoursePart coursePart, Double enteredEffective, Double globalEffective, Double eqTDTotal)
Compute the effective and the eqTD ventilation by step- Parameters:
costData
- object containing informations about the formationcoursePart
- the object to exploreenteredEffective
- the entered effective of the coursePartglobalEffective
- the global effective of the courseParteqTDTotal
- the total eqTD value of the coursePart
-
_getCourseWeight
protected Double _getCourseWeight(ProgramItem programItem, ProgramItem programItemParent, CostComputationData costData)
Divide the effective of a program item by the total effective of a course list to retrieve the weight- Parameters:
programItem
- the program itemprogramItemParent
- the parent of the program itemcostData
- object containing informations about the formation- Returns:
- the weight of the program item
-
_getStepHolder
protected Container _getStepHolder(Course courseHolder, String coursePartPrefix)
Get the step holder associated to the course- Parameters:
courseHolder
- the course holder of a course partcoursePartPrefix
- the current prefix- Returns:
- the step holder
-
_getNorm
protected String _getNorm(CoursePart coursePart, String coursePartPrefix, Container stepHolder, CostComputationDataCache cache)
Retrieve the value of the norm- Parameters:
coursePart
- informations about the teaching hours of a coursecoursePartPrefix
- the current prefixstepHolder
- the step holder of the coursecache
- the cache values- Returns:
- the norm value
-
_getNormDetails
protected Optional<NormDetails> _getNormDetails(Container stepHolder, CoursePart coursePart, String coursePartPrefix, CostComputationDataCache cache)
Get all informations about the norm- Parameters:
stepHolder
- the step holdercoursePart
- informations about the teaching hours of a coursecoursePartPrefix
- the current prefixcache
- the cache values- Returns:
- norm details
-
_getNormFromNature
private Optional<NormDetails> _getNormFromNature(String nature, CostComputationDataCache cache)
-
_getComputedGlobalAndEnteredEffectives
protected Effectives _getComputedGlobalAndEnteredEffectives(CostComputationData costData, CoursePart coursePart, CostComputationDataCache cache)
Get the computed global and entered effectives- Parameters:
costData
- object containing informations about the formationcoursePart
- the course partcache
- the cached values- Returns:
- the computed global and entered effectives
-
_computeGlobalAndEnteredEffectives
protected Effectives _computeGlobalAndEnteredEffectives(CostComputationData costData, CoursePart coursePart, ProgramItem programItem, Double initialWeight, CostComputationDataCache cache)
Compute the global and entered effectives- Parameters:
costData
- object containing informations about the formationcoursePart
- the course partprogramItem
- the item we want to evaluate the capacityinitialWeight
- the weightcache
- the cached values- Returns:
- the computed effective
-
_getComputedLocalEffective
protected Effectives _getComputedLocalEffective(CostComputationData costData, CoursePart coursePart, Course courseParent, String coursePartPath, CostComputationDataCache cache)
Get the computed local effective- Parameters:
costData
- object containing informations about the formationcoursePart
- the course partcourseParent
- the course parent of the course partcoursePartPath
- the course part pathcache
- the cache values- Returns:
- the computed effective
-
_computeLocalEffective
protected Effectives _computeLocalEffective(CostComputationData costData, CoursePart coursePart, ProgramItem programItem, String programItemPath, CostComputationDataCache cache)
Compute the local effective- Parameters:
costData
- object containing informations about the formationcoursePart
- the course partprogramItem
- the item we want to evaluate the capacityprogramItemPath
- the current pathcache
- the cache values- Returns:
- the computed effective
-
_computeLocalEffectiveByWeight
protected void _computeLocalEffectiveByWeight(CostComputationData costData, ProgramItem programItem, ProgramItem programItemParent, Effectives computedEffective, String programItemPath, CostComputationDataCache cache)
Compute the local effective of a programItem- Parameters:
costData
- object containing informations about the formationprogramItem
- the current programItemprogramItemParent
- the parent of the programItemcomputedEffective
- the computed effectiveprogramItemPath
- the current pathcache
- the values cache
-
_getSteps
protected Map<String,Container> _getSteps(CostComputationData costData, ProgramItem programItem, String programItemPath)
Get all steps of a program item- Parameters:
costData
- object containing informations about the formationprogramItem
- the current nodeprogramItemPath
- the current path- Returns:
- all steps of a program item
-
_getWeight
protected double _getWeight(ProgramItem programItem)
Define the weight of an item- Parameters:
programItem
- the item to evaluate- Returns:
- the weight
-
_calculEqTD
protected double _calculEqTD(double effectif, double effectifTotal, double eqTDTotal)
Compute the TD equivalent- Parameters:
effectif
- the capacityeffectifTotal
- the total capacityeqTDTotal
- the total TD equivalent- Returns:
- the computed TD equivalent
-
_computeEqTDLocal
protected double _computeEqTDLocal(double duration, long groupes, Double eqTD)
Compute the total TD equivalent- Parameters:
duration
- the duration of the TDgroupes
- the group repartitioneqTD
- the TD equivalent- Returns:
- the computed TD equivalent
-
_computeGroups
protected long _computeGroups(double enteredEffective, double computedEffective, NormDetails normDetails)
compute the number of groups needed- Parameters:
enteredEffective
- the forecast capacitycomputedEffective
- the computed capacitynormDetails
- all informations needed to compute the norm- Returns:
- the number of groups to open
-
_getStepsHolder
protected Set<Container> _getStepsHolder(ProgramItem programItem, String coursePartPrefix)
Find steps holders- Parameters:
programItem
- the item we want to explorecoursePartPrefix
- the current prefix- Returns:
- a list of steps holders
-
_getNorm
protected String _getNorm(Content content, String nature, String prefix, boolean isStepholder, CostComputationDataCache cache)
Retrieve the norm value of a content- Parameters:
content
- the contentnature
- the nature of the contentprefix
- the current prefixisStepholder
- define if the content is a step holder or notcache
- the cache values- Returns:
- the norm of the content
-
_getOrgUnits
protected String _getOrgUnits(Course courseHolder)
Retrieve the orgUnit- Parameters:
courseHolder
- the course- Returns:
- the orgUnit
-
-