Class CostComputationTreeHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.contentstree.ContentsTreeHelper
-
- org.ametys.odf.tree.ODFContentsTreeHelper
-
- org.ametys.plugins.odfpilotage.helper.CostComputationTreeHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class CostComputationTreeHelper extends ODFContentsTreeHelper implements Contextualizable
This component handle the content of the cost modeling tool
-
-
Field Summary
Fields Modifier and Type Field Description private static String
__COST_DATA_KEY
private static int
_ACTION
protected ContentWorkflowHelper
_contentWorkflowHelper
Workflow helper componentprotected Context
_context
The contextprotected CostComputationComponent
_costComputationComponent
The cost computation componentprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected OdfReferenceTableHelper
_refTableHelper
The ODF enumeration helper-
Fields inherited from class org.ametys.odf.tree.ODFContentsTreeHelper
_odfHelper, _shareableCourseHelper, _shareableStatusHelper, _workflowProvider, ROLE
-
Fields inherited from class org.ametys.plugins.contentstree.ContentsTreeHelper
_ametysResolver, _contentTypesEP, _contentTypesHelper, _treeExtensionPoint
-
-
Constructor Summary
Constructors Constructor Description CostComputationTreeHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addEffectif(Map<String,Object> json, Content content, String contentPath, CostComputationData costData)
Retrieve the effective and add it to the JSON structureprotected void
_addEqTD(Map<String,Object> json, Content content, String contentPath, CostComputationData costData)
Retrieve the TD equivalent value and add it to the JSON structureprotected void
_addGroupe(Map<String,Object> json, Long groupeAOuvrir, Long groupeCalcule)
Retrieve the number of groups and add it to the JSON structureprotected void
_addNorm(Map<String,Object> json, NormDetails normDetails)
Add norm informationsprotected void
_addRapportHE(Map<String,Object> json, Content content, String contentPath, CostComputationData costData)
Compute the H/E report and add it to the JSON structureprotected void
_addVolumeHoraire(Map<String,Object> json, Content content, CostComputationData costData)
Retrieve hourly volume of a content and add it to the JSON structureprivate Boolean
_containsTeachingNature(Set<String> overriddenType)
protected CostComputationData
_getCostData()
Get the cost data from user sessionprivate String
_getTitle(String id)
protected void
_handleContainer(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Fill data in JSON describing the year containerprivate void
_handleCourse(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
protected void
_handleCoursePart(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle coursePart informationsprotected void
_handleODFElement(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Fill data in JSON describing an ODF Elementprotected void
_handleOrgUnit(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle orgUnit informationsprotected void
_handleProgram(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle program informationsprotected void
_handleSubProgram(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle sub program informationsprivate Content
_resolveSilently(String contentId)
protected Map<String,Object>
content2Json(Content content, String contentPath)
Get the default JSON representation of a content of the treevoid
contextualize(Context context)
Map<String,Object>
getChildrenContent(String contentId, String treeId, String contentPath, String catalog, String lang)
Get the children contents according the tree configurationMap<String,List<Content>>
getChildrenContent(Content parentContent, TreeConfiguration treeConfiguration, String catalog, String lang)
Get the children contents according the tree configurationMap<String,Object>
getNodeInformations(String contentId, String catalog, String lang, Map<String,Map<String,String>> overriddenData)
Get the node informationsMap<String,Map<String,Double>>
getOldData()
Retrieve old data to compare with the new computed oneMap<String,Object>
getRootNodeInformations(String contentId, String catalog, String lang, Map<String,Map<String,String>> overriddenData)
Get the root node informationsvoid
launchProgram(Content content, String catalog, String lang, OverriddenData overriddenData)
Launch the cost computation component algorithmMap<String,Map<String,Object>>
refresh(Map<String,String> contentsToRefresh, String contentId, String catalog, String lang, Map<String,Map<String,String>> overridenData)
Launch the cost computation component algorithm with overridden data by the userBoolean
saveOverriddenData(Map<String,Map<String,String>> overriddenData)
Save overridden data to the contentsvoid
service(ServiceManager smanager)
protected void
setCostData(CostComputationData costData)
Set the cost data to user session-
Methods inherited from class org.ametys.odf.tree.ODFContentsTreeHelper
content2Json, getProgramItemDisplayCode, getRootNodeInformations, getShareableStatus, getWorkflowStep, isContentMatching, isShared, isSharedByParents
-
Methods inherited from class org.ametys.plugins.contentstree.ContentsTreeHelper
_getParentContent, _getTreeConfiguration, childContent2Json, filterChildrenContentByRegExp, getChildrenContent, getChildrenContent, getNodeInformations, hasChildrenContent
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_ACTION
private static int _ACTION
-
__COST_DATA_KEY
private static final String __COST_DATA_KEY
- See Also:
- Constant Field Values
-
_costComputationComponent
protected CostComputationComponent _costComputationComponent
The cost computation component
-
_contentWorkflowHelper
protected ContentWorkflowHelper _contentWorkflowHelper
Workflow helper component
-
_refTableHelper
protected OdfReferenceTableHelper _refTableHelper
The ODF enumeration helper
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
-
Constructor Detail
-
CostComputationTreeHelper
public CostComputationTreeHelper()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classODFContentsTreeHelper
- Throws:
ServiceException
-
_getCostData
protected CostComputationData _getCostData()
Get the cost data from user session- Returns:
- the cost data
-
setCostData
protected void setCostData(CostComputationData costData)
Set the cost data to user session- Parameters:
costData
- the cost data
-
launchProgram
public void launchProgram(Content content, String catalog, String lang, OverriddenData overriddenData)
Launch the cost computation component algorithm- Parameters:
content
- the content to computecatalog
- the cataloglang
- the langoverriddenData
- overridden data by the user
-
getChildrenContent
public Map<String,List<Content>> getChildrenContent(Content parentContent, TreeConfiguration treeConfiguration, String catalog, String lang)
Get the children contents according the tree configuration- Parameters:
parentContent
- the root contenttreeConfiguration
- the tree configurationcatalog
- the cataloglang
- the lang- Returns:
- the children content for each child attributes
-
getChildrenContent
public Map<String,Object> getChildrenContent(String contentId, String treeId, String contentPath, String catalog, String lang)
Get the children contents according the tree configuration- Parameters:
contentId
- the parent contenttreeId
- the tree configurationcontentPath
- the content pathcatalog
- the cataloglang
- the lang- Returns:
- the children content
-
getRootNodeInformations
public Map<String,Object> getRootNodeInformations(String contentId, String catalog, String lang, Map<String,Map<String,String>> overriddenData)
Get the root node informations- Parameters:
contentId
- The contentcatalog
- the cataloglang
- the langoverriddenData
- overridden data by the user- Returns:
- The informations
-
getNodeInformations
public Map<String,Object> getNodeInformations(String contentId, String catalog, String lang, Map<String,Map<String,String>> overriddenData)
Get the node informations- Parameters:
contentId
- The contentcatalog
- the cataloglang
- the langoverriddenData
- Overridden data by the user- Returns:
- The informations
-
content2Json
protected Map<String,Object> content2Json(Content content, String contentPath)
Get the default JSON representation of a content of the tree- Parameters:
content
- the contentcontentPath
- the content path- Returns:
- the content as JSON
-
_addVolumeHoraire
protected void _addVolumeHoraire(Map<String,Object> json, Content content, CostComputationData costData)
Retrieve hourly volume of a content and add it to the JSON structure- Parameters:
json
- the structurecontent
- the contentcostData
- the cost data
-
_addGroupe
protected void _addGroupe(Map<String,Object> json, Long groupeAOuvrir, Long groupeCalcule)
Retrieve the number of groups and add it to the JSON structure- Parameters:
json
- the JSON structuregroupeAOuvrir
- groups to opengroupeCalcule
- calculated groups
-
_addEffectif
protected void _addEffectif(Map<String,Object> json, Content content, String contentPath, CostComputationData costData)
Retrieve the effective and add it to the JSON structure- Parameters:
json
- the JSON structurecontent
- the contentcontentPath
- the content pathcostData
- the cost data
-
_addEqTD
protected void _addEqTD(Map<String,Object> json, Content content, String contentPath, CostComputationData costData)
Retrieve the TD equivalent value and add it to the JSON structure- Parameters:
json
- the JSON structurecontent
- the contentcontentPath
- the content pathcostData
- the cost data
-
_addRapportHE
protected void _addRapportHE(Map<String,Object> json, Content content, String contentPath, CostComputationData costData)
Compute the H/E report and add it to the JSON structure- Parameters:
json
- the JSON structurecontent
- the contentcontentPath
- the content pathcostData
- the cost data
-
_handleCoursePart
protected void _handleCoursePart(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle coursePart informations- Parameters:
content
- the contentjson
- the JSON structurecontentPath
- the content pathcostData
- the cost data
-
_addNorm
protected void _addNorm(Map<String,Object> json, NormDetails normDetails)
Add norm informations- Parameters:
json
- the JSON structurenormDetails
- the norm details
-
_handleSubProgram
protected void _handleSubProgram(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle sub program informations- Parameters:
content
- the contentjson
- the JSON structurecontentPath
- the current pathcostData
- the cost data
-
_handleProgram
protected void _handleProgram(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle program informations- Parameters:
content
- the contentjson
- the JSON structurecontentPath
- the current pathcostData
- the cost data
-
_handleOrgUnit
protected void _handleOrgUnit(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Handle orgUnit informations- Parameters:
content
- the contentjson
- the JSON structurecontentPath
- the current pathcostData
- the cost data
-
_handleCourse
private void _handleCourse(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
-
_handleContainer
protected void _handleContainer(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Fill data in JSON describing the year container- Parameters:
content
- the year containerjson
- the structurecontentPath
- the content pathcostData
- the cost data
-
_handleODFElement
protected void _handleODFElement(Content content, Map<String,Object> json, String contentPath, CostComputationData costData)
Fill data in JSON describing an ODF Element- Parameters:
content
- the year containerjson
- the structurecontentPath
- the content pathcostData
- the cost data
-
_resolveSilently
private Content _resolveSilently(String contentId)
-
refresh
public Map<String,Map<String,Object>> refresh(Map<String,String> contentsToRefresh, String contentId, String catalog, String lang, Map<String,Map<String,String>> overridenData)
Launch the cost computation component algorithm with overridden data by the user- Parameters:
contentsToRefresh
- all open contents in the tool to refreshcontentId
- the root nodecatalog
- the cataloglang
- the langoverridenData
- overridden data by the user- Returns:
- new values associated with their path
-
getOldData
public Map<String,Map<String,Double>> getOldData()
Retrieve old data to compare with the new computed one- Returns:
- all old data to compare
-
saveOverriddenData
public Boolean saveOverriddenData(Map<String,Map<String,String>> overriddenData) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Save overridden data to the contents- Parameters:
overriddenData
- overridden data by the user- Returns:
- true if the saving is successful
- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurredAmetysRepositoryException
- if an error occurred
-
_containsTeachingNature
private Boolean _containsTeachingNature(Set<String> overriddenType)
-
-