Class ReportHelper
- java.lang.Object
-
- org.ametys.plugins.odfpilotage.helper.ReportHelper
-
- All Implemented Interfaces:
Component
,Serviceable
public class ReportHelper extends Object implements Component, Serviceable
Helper for report creation.
-
-
Field Summary
Fields Modifier and Type Field Description private static String
__READABLE_DF
protected ODFHelper
_odfHelper
The ODF helperprotected OdfReferenceTableHelper
_refTableHelper
The ODF enumeration helperprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected RootOrgUnitProvider
_rootOrgUnitProvider
The root orgunit providerstatic String
ROLE
The avalon role
-
Constructor Summary
Constructors Constructor Description ReportHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private List<String>
_getDirectSubOrgUnitsUAICodes(String orgUnitId)
Retrieve the direct children's uai codesList<Program>
filterProgramsFromOrgUnits(OrgUnit orgUnit, String lang, String catalog)
Get Programs with the current catalog, language and selected orgUnit.String
formatNumberToSax(Long number)
Format the given longString
getAccronymOrUaiCode(String uaiCode)
Get the accronym if exists or UAI code of the orgunit given by the UAI code.String
getAccronymOrUaiCode(OrgUnit orgUnit)
Get the accronym if exists or UAI code of the orgunit given.String
getCodeDIP(ModifiableDefaultContent content)
Get code DIPString
getCodeVRSVDI(ModifiableDefaultContent content)
Get code VRSVDIMap<ProgramItem,Object>
getCoursesFromContent(ProgramItem programItem)
Get the list of courses underneath the given ametys objectAmetysObjectIterable<Program>
getProgramsByOrgUnitId(String orgUnitId, String lang, String catalog)
Get the programs' iterator of all programs contained in the organization unit with the given idString
getReadableCurrentDate()
Get the current date to the following format : 'dd/MM/yyyy'AmetysObjectIterable<OrgUnit>
getRootOrgUnitsByUaiCode(String uaiCode)
Retrieves an organization unit with its uai code.Set<Container>
getSteps(ProgramItem programItem)
Get the steps which can hold this program item.Set<Container>
getStepsHolders(ProgramItem programItem, org.slf4j.Logger logger, String logPrefix)
Get the potential steps holder (step or field "etapePorteuse" in courses) of theProgramItem
.List<String>
getSubOrgUnits(String orgUnitId)
Get the ids of the organization units beneath the organization unit with the given idList<String>
getSubOrgUnits(OrgUnit orgUnit)
Get the ids of all the sub org unitsList<String>
getUaiCodes(String orgUnitId)
Get the uaiCodes of the organization units involved in the groups reportString
minute2hour(int duree)
Convert a duration in minutes to a string representing the duration in hours.void
saxContentAttribute(TransformerHandler handler, ModifiableDefaultContent content, String attributeName, String tagName)
Generates SAX events for a multiple enumerated attribute.void
saxNaturesEnseignement(TransformerHandler handler, org.slf4j.Logger logger)
Sax the "natures d'enseignement" from the reference table.void
service(ServiceManager manager)
-
-
-
Field Detail
-
__READABLE_DF
private static final String __READABLE_DF
- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_rootOrgUnitProvider
protected RootOrgUnitProvider _rootOrgUnitProvider
The root orgunit provider
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_refTableHelper
protected OdfReferenceTableHelper _refTableHelper
The ODF enumeration helper
-
-
Constructor Detail
-
ReportHelper
public ReportHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getReadableCurrentDate
public String getReadableCurrentDate()
Get the current date to the following format : 'dd/MM/yyyy'- Returns:
- The date as a
String
-
getUaiCodes
public List<String> getUaiCodes(String orgUnitId)
Get the uaiCodes of the organization units involved in the groups report- Parameters:
orgUnitId
- The parent UAI code- Returns:
- if the uai code given by the user is valid, the list will contain solely this one if it is invalid, the list will contain no element and a warning message will be displayed if it is null, the list will contain all existing uai codes
-
getAccronymOrUaiCode
public String getAccronymOrUaiCode(OrgUnit orgUnit)
Get the accronym if exists or UAI code of the orgunit given.- Parameters:
orgUnit
- The orgUnit- Returns:
- The accronym if it exists, otherwise the UAI code
-
getAccronymOrUaiCode
public String getAccronymOrUaiCode(String uaiCode)
Get the accronym if exists or UAI code of the orgunit given by the UAI code.- Parameters:
uaiCode
- The UAI code of the orgUnit- Returns:
- The accronym if it exists, otherwise the UAI code
-
_getDirectSubOrgUnitsUAICodes
private List<String> _getDirectSubOrgUnitsUAICodes(String orgUnitId)
Retrieve the direct children's uai codes- Parameters:
orgUnitId
- the id of the parent org unit- Returns:
- the direct children's uai codes of the root organization unit
-
filterProgramsFromOrgUnits
public List<Program> filterProgramsFromOrgUnits(OrgUnit orgUnit, String lang, String catalog)
Get Programs with the current catalog, language and selected orgUnit.- Parameters:
orgUnit
- Selected orgunitlang
- Selected languagecatalog
- Selected catalog- Returns:
- A List of Program in the catalog, language and selected orgUnit
-
getRootOrgUnitsByUaiCode
public AmetysObjectIterable<OrgUnit> getRootOrgUnitsByUaiCode(String uaiCode)
Retrieves an organization unit with its uai code.- Parameters:
uaiCode
- The UAI code- Returns:
- the root organization units corresponding to this uai code
-
getSubOrgUnits
public List<String> getSubOrgUnits(String orgUnitId)
Get the ids of the organization units beneath the organization unit with the given id- Parameters:
orgUnitId
- the id of the parent organization unit- Returns:
- the list of child organization units ids
-
getSubOrgUnits
public List<String> getSubOrgUnits(OrgUnit orgUnit)
Get the ids of all the sub org units- Parameters:
orgUnit
- the organization unit- Returns:
- the list of child organization units ids
-
formatNumberToSax
public String formatNumberToSax(Long number)
Format the given long- Parameters:
number
- the long- Returns:
- string representation of this long
-
getProgramsByOrgUnitId
public AmetysObjectIterable<Program> getProgramsByOrgUnitId(String orgUnitId, String lang, String catalog)
Get the programs' iterator of all programs contained in the organization unit with the given id- Parameters:
orgUnitId
- the id of the organization unitlang
- the lang of the programscatalog
- the catalog of the programs- Returns:
- the programs iterator
-
getCoursesFromContent
public Map<ProgramItem,Object> getCoursesFromContent(ProgramItem programItem)
Get the list of courses underneath the given ametys object- Parameters:
programItem
- The program item to gather the courses from- Returns:
- the map representation of the tree of ametys objects
-
getCodeVRSVDI
public String getCodeVRSVDI(ModifiableDefaultContent content)
Get code VRSVDI- Parameters:
content
- the content- Returns:
- the codeVRSVDI if it's set, otherwise the second part of the content code
-
getCodeDIP
public String getCodeDIP(ModifiableDefaultContent content)
Get code DIP- Parameters:
content
- the content- Returns:
- the codeDIP if it's set, otherwise the first part of the content code
-
saxContentAttribute
public void saxContentAttribute(TransformerHandler handler, ModifiableDefaultContent content, String attributeName, String tagName) throws SAXException
Generates SAX events for a multiple enumerated attribute. The attribute must be of type content or string- Parameters:
handler
- The handlercontent
- The contentattributeName
- The attribute nametagName
- The name of the tag- Throws:
SAXException
- if an error occurs
-
minute2hour
public String minute2hour(int duree)
Convert a duration in minutes to a string representing the duration in hours.- Parameters:
duree
- in minutes- Returns:
- the duration in hours
-
saxNaturesEnseignement
public void saxNaturesEnseignement(TransformerHandler handler, org.slf4j.Logger logger) throws SAXException
Sax the "natures d'enseignement" from the reference table.- Parameters:
handler
- The transformer handlerlogger
- The logger- Throws:
SAXException
- if an error occurs
-
getSteps
public Set<Container> getSteps(ProgramItem programItem)
Get the steps which can hold this program item.- Parameters:
programItem
- The program item- Returns:
- The list of steps linked to the programItem
-
getStepsHolders
public Set<Container> getStepsHolders(ProgramItem programItem, org.slf4j.Logger logger, String logPrefix)
Get the potential steps holder (step or field "etapePorteuse" in courses) of theProgramItem
.- Parameters:
programItem
- The program itemlogger
- The loggerlogPrefix
- The log prefix- Returns:
- The list of potential steps holder linked to the programItem. It there are several, there is no defined step holder.
-
-