Class OdfXSLTHelper

java.lang.Object
org.ametys.odf.OdfXSLTHelper
All Implemented Interfaces:
Serviceable
Direct Known Subclasses:
OdfXSLTHelper

public class OdfXSLTHelper extends Object implements Serviceable
Helper component to be used from XSL stylesheets.
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • degreeLabel

      public static String degreeLabel(String cdmValue)
      Get the label associated with the degree key
      Parameters:
      cdmValue - The code of degree
      Returns:
      The label of degree or code if not found
    • getCode

      public static String getCode(String tableRefEntryId)
      Get the code associated with the given reference table's entry
      Parameters:
      tableRefEntryId - The id of entry
      Returns:
      the code or null if not found
    • getEntryId

      public static String getEntryId(String tableRefId, String code)
      Get the id of reference table's entry
      Parameters:
      tableRefId - The id of content type
      code - The code
      Returns:
      the id or null if not found
    • degreeLabel

      public static String degreeLabel(String cdmValue, String lang)
      Get the label associated with the degree key
      Parameters:
      cdmValue - The cdm value of degree
      lang - The language
      Returns:
      The label of degree or empty string if not found
    • getSubProgramStructure

      public static Node getSubProgramStructure(String subprogramId)
      Get the whole structure of a subprogram, including the structure of child subprograms
      Parameters:
      subprogramId - The id of subprogram
      Returns:
      Node with the subprogram structure
    • getSubProgramStructure

      public static Node getSubProgramStructure(String subprogramId, int depth)
      Get the structure of a subprogram, including the structure of child subprograms until the given depth
      Parameters:
      subprogramId - The id of subprogram
      depth - Set a positive number to get structure of child subprograms until given depth. Set a negative number to get the whole structure recursively, including the structure of child subprograms. This parameter concerns only subprograms.
      Returns:
      Node with the subprogram structure
    • getParentProgram

      public static NodeList getParentProgram(String subprogramId)
      Get the parent program information
      Parameters:
      subprogramId - The id of subprogram
      Returns:
      a node for each program's information
    • getCertificationLabel

      public static String getCertificationLabel(String abstractProgramId)
      Get the certification label of a AbstractProgram. Returns null if the program is not certified.
      Parameters:
      abstractProgramId - the id of program or subprogram
      Returns:
      the certification label
    • getProgram

      public static Node getProgram(String programId)
      Get the program information
      Parameters:
      programId - The id of program
      Returns:
      Node with the program's information
    • getParentProgramStructure

      public static NodeList getParentProgramStructure(String subprogramId, int depth)
      Get the structure of a parent programs, including the structure of child subprograms until the given depth.
      Parameters:
      subprogramId - The id of subprogram
      depth - Set a positive number to get structure of child subprograms until given depth. Set a negative number to get the whole structure recursively, including the structure of child subprograms. This parameter concerns only subprograms.
      Returns:
      a node for each program's structure
    • getProgramPaths

      public static NodeList getProgramPaths(String programItemId, String separator)
      Get the paths of a ProgramItem util the root program(s) Paths are built with content's title
      Parameters:
      programItemId - the id of program items
      separator - The path separator
      Returns:
      the paths in program
    • getProgramStructure

      public static Node getProgramStructure(String programId, int depth)
      Get the structure of a program until the given depth.
      Parameters:
      programId - The id of program
      depth - Set a positive number to get structure of child subprograms until given depth. Set a negative number to get the whole structure recursively, including the structure of child subprograms. This parameter concerns only subprograms.
      Returns:
      Node with the program structure
    • getTableRefItems

      public static Node getTableRefItems(String tableRefId, String lang)
      Get the items of a reference table
      Parameters:
      tableRefId - the id of reference table
      lang - the language to use for labels
      Returns:
      the items
    • getTableRefItems

      public static Node getTableRefItems(String tableRefId, String lang, boolean ordered)
      Get the items of a reference table
      Parameters:
      tableRefId - the id of reference table
      lang - the language to use for labels
      ordered - true to sort items by 'order' attribute
      Returns:
      the items
    • getTableRefItems

      public static Node getTableRefItems(String tableRefId, String lang, boolean ordered, boolean includeArchived)
      Get the items of a reference table
      Parameters:
      tableRefId - the id of reference table
      lang - the language to use for labels
      ordered - true to sort items by 'order' attribute
      includeArchived - true to include archived items
      Returns:
      the items
    • getRootOrgUnitId

      public static String getRootOrgUnitId()
      Get the id of root orgunit
      Returns:
      The id of root
    • getOrgUnitIdByUAICode

      public static String getOrgUnitIdByUAICode(String uaiCode)
      Get the id of the first orgunit matching the given UAI code
      Parameters:
      uaiCode - the UAI code
      Returns:
      the id of orgunit or null if not found
    • getEducationalBooklet

      public static AmetysNodeList getEducationalBooklet(String programItemId)
      Get the more recent educational booklet for a ProgramItem
      Parameters:
      programItemId - the program item id
      Returns:
      the pdf as an ametys node list
    • getCumulatedHours

      public static Double getCumulatedHours(String contentId)
      Count the hours accumulation in the ProgramItem
      Parameters:
      contentId - The id of the ProgramItem
      Returns:
      The hours accumulation
    • getEcts

      public static NodeList getEcts(String courseId, String coursePathAsString)
      Get the ECTS value at the given educational path
      Parameters:
      courseId - The course id
      coursePathAsString - The course path as string (semicolon separated). Can be a partial path.
      Returns:
      the ECTS value for the given educational path
    • getValueForPath

      public static NodeList getValueForPath(String programItemId, String dataPath, String programItemPathAsString, String defaultValuePath)
      Get the attribute of a content at the given path for a given educational path
      Parameters:
      programItemId - The program item id
      dataPath - The path of attribute to retrieve. The path must contain the path of repeater holding the value (ex: path/to/repeater/attributeName)
      programItemPathAsString - The program item path as string (semicolon separated). Can be a partial path
      defaultValuePath - The data path of the default value in there is no specific value at the given educational path
      Returns:
      The value into a "value" node or null if an error occurred
    • minute2hour

      public static 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