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 Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • 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

      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

      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
    • filterProgramsFromOrgUnits

      public List<Program> filterProgramsFromOrgUnits(OrgUnit orgUnit, String lang, String catalog)
      Get Programs with the current catalog, language and selected orgUnit.
      Parameters:
      orgUnit - Selected orgunit
      lang - Selected language
      catalog - Selected catalog
      Returns:
      A List of Program in the catalog, language and selected orgUnit
    • getRootOrgUnitsByUaiCode

      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

      Get the programs' iterator of all programs contained in the organization unit with the given id
      Parameters:
      orgUnitId - the id of the organization unit
      lang - the lang of the programs
      catalog - the catalog of the programs
      Returns:
      the programs iterator
    • getCoursesFromContent

      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

      Get code VRSVDI
      Parameters:
      content - the content
      Returns:
      the codeVRSVDI if it's set, otherwise the second part of the content code
    • getCodeDIP

      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 handler
      content - The content
      attributeName - The attribute name
      tagName - 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, Logger logger) throws SAXException
      Sax the "natures d'enseignement" from the reference table.
      Parameters:
      handler - The transformer handler
      logger - 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, Logger logger, String logPrefix)
      Get the potential steps holder (step or field "etapePorteuse" in courses) of the ProgramItem.
      Parameters:
      programItem - The program item
      logger - The logger
      logPrefix - The log prefix
      Returns:
      The list of potential steps holder linked to the programItem. It there are several, there is no defined step holder.