Class AiccManifest

java.lang.Object
dev.jcputney.elearning.parser.input.aicc.AiccManifest
All Implemented Interfaces:
PackageManifest, Serializable

public final class AiccManifest extends Object implements PackageManifest
Represents the AICC manifest for a course.

This class is used to parse the AICC manifest file and extract information about the course, assignable units, descriptors, and course structures.

It also provides methods to retrieve the title, description, launch URL, identifier, version, and duration of the course.

See Also:
  • Constructor Details

    • AiccManifest

      public AiccManifest()
      Default constructor for the AiccManifest class. This constructor is primarily used by frameworks and test methods that require an instance of the AiccManifest class without additional initialization or configuration logic.
    • AiccManifest

      public AiccManifest(AiccCourse course, List<AssignableUnit> assignableUnits, List<Descriptor> descriptors, List<CourseStructure> courseStructures) throws ModuleParsingException
      Constructs an AiccManifest object that maps the relationship between the AICC course, its assignable units, descriptors, and course structures, and derives the launch URL of the root assignable unit.
      Parameters:
      course - the AICC course to which the manifest corresponds
      assignableUnits - a list of assignable units associated with the course
      descriptors - a list of descriptors providing metadata for assignable units
      courseStructures - a list of course structures defining the hierarchical relationships and structure of the course
      Throws:
      ModuleParsingException - if the root assignable unit or its ID cannot be determined, or if there is inconsistent data in the manifest mappings
  • Method Details

    • normalizeMasteryScore

      public static Double normalizeMasteryScore(String rawMastery)
      Normalizes a raw mastery score string into a standardized Double format. The raw input can be in various formats, such as a percentage (e.g., "85%") or a decimal (e.g., "0.85"). This method strips any unnecessary characters like '%' and adjusts the value appropriately if it appears to be a percentage.
      Parameters:
      rawMastery - The raw mastery score as a String. It can include optional percentage symbols and may contain extraneous whitespace. If null or blank, the method returns null.
      Returns:
      The normalized mastery score as a Double. Returns null if the input is invalid or cannot be parsed as a number. If the input is a valid percentage greater than 1, the result is scaled to a decimal (e.g., "85%" becomes 0.85). For valid decimals less than or equal to 1, the same value is returned unchanged.
    • getTitle

      public String getTitle()
      Retrieves the title of the course.
      Specified by:
      getTitle in interface PackageManifest
      Returns:
      the title of the course as a String.
    • getDescription

      public String getDescription()
      Retrieves the description of the course.

      Follows this priority order:

      1. Root AU descriptor description (from .des file)
      2. Course description (from .crs file [Course_Description] section)

      Most AICC authoring tools (including Articulate Storyline) store the primary description in the descriptor file (.des), which can contain multi-line text. The [Course_Description] section in the .crs file is often less detailed or may be parsed incorrectly when it contains special characters like colons.

      Specified by:
      getDescription in interface PackageManifest
      Returns:
      the course description as a string
    • getIdentifier

      public String getIdentifier()
      Retrieves the identifier of the course.
      Specified by:
      getIdentifier in interface PackageManifest
      Returns:
      the course identifier as a String
    • getVersion

      public String getVersion()
      Retrieves the version information of the course.
      Specified by:
      getVersion in interface PackageManifest
      Returns:
      the version of the course as a string.
    • getDuration

      public Duration getDuration()
      Retrieves the duration associated with this instance.
      Specified by:
      getDuration in interface PackageManifest
      Returns:
      a Duration object representing the duration, which will always return Duration.ZERO.
    • getCourse

      public AiccCourse getCourse()
      Retrieves the course object associated with this instance.
      Returns:
      an AiccCourse object representing the course.
    • setCourse

      public void setCourse(AiccCourse course)
      Sets the course for the current instance.
      Parameters:
      course - the AICC course to be set
    • getAssignableUnits

      public List<AssignableUnit> getAssignableUnits()
      Retrieves the list of assignable units.
      Returns:
      a list of AssignableUnit objects representing the assignable units.
    • setAssignableUnits

      public void setAssignableUnits(List<AssignableUnit> assignableUnits)
      Sets the list of assignable units.
      Parameters:
      assignableUnits - the list of AssignableUnit objects to be assigned
    • getDescriptors

      public List<Descriptor> getDescriptors()
      Retrieves the list of descriptors.
      Returns:
      a list of Descriptor objects representing the stored descriptors.
    • setDescriptors

      public void setDescriptors(List<Descriptor> descriptors)
      Sets the list of descriptors.
      Parameters:
      descriptors - the list of Descriptor objects to be set
    • getCourseStructures

      public List<CourseStructure> getCourseStructures()
      Retrieves the list of course structures.
      Returns:
      a list of CourseStructure objects representing the course structures.
    • setCourseStructures

      public void setCourseStructures(List<CourseStructure> courseStructures)
      Sets the list of course structures.
      Parameters:
      courseStructures - the list of CourseStructure objects to be assigned
    • getLaunchUrl

      public String getLaunchUrl()
      Retrieves the launch URL.
      Specified by:
      getLaunchUrl in interface PackageManifest
      Returns:
      the launch URL as a String
    • setLaunchUrl

      public void setLaunchUrl(String launchUrl)
      Sets the launch URL for this object.
      Parameters:
      launchUrl - the URL to be set as the launch URL
    • getPrerequisitesTable

      public List<Map<String,String>> getPrerequisitesTable()
      Retrieves the prerequisites table containing a list of maps where each map represents a set of prerequisite details with key-value pairs.
      Returns:
      a list of maps, where each map contains prerequisite details as key-value pairs.
    • setPrerequisitesTable

      public void setPrerequisitesTable(List<Map<String,String>> prerequisitesTable)
      Sets the prerequisites table with the provided list of maps containing prerequisite details.
      Parameters:
      prerequisitesTable - the list of maps where each map represents a prerequisite. Each map should contain key-value pairs with string data related to the prerequisites.
    • getObjectivesRelationTable

      public List<Map<String,String>> getObjectivesRelationTable()
      Retrieves the objectives relation table.
      Returns:
      a list of maps where each map contains key-value pairs representing the objectives relations.
    • setObjectivesRelationTable

      public void setObjectivesRelationTable(List<Map<String,String>> objectivesRelationTable)
      Sets the objectives relation table with the provided list of mappings.
      Parameters:
      objectivesRelationTable - a list of maps where each map represents a relationship between objectives. The keys and values in the map are expected to be string representations of the relevant data.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object