A list of ModuleStatus records for a profile, with filtering helpers for narrowing down to a program, course, module or completion state. Built by LearningManager.modulesList and used from field expressions and templates that display or count a learner's module progress. The filter methods return a new ModulesList rather than mutating this one, so they can be chained.
Extends: CommonList
Properties
| Property | Returns | Description |
|---|---|---|
| courseCodes | Set<String> | The distinct set of course codes referenced by the module statuses in this list. |
| moduleCodes | Set<String> | The distinct set of module codes referenced by the module statuses in this list. |
| programCodes | Set<String> | The distinct set of program codes referenced by the module statuses in this list. |
Inherited from CommonList
Properties
| Property | Returns | Description |
|---|---|---|
| attributes | Map<String,Object> | A general-purpose map for stashing arbitrary values alongside this list, for example to cache data computed while rendering a template. Lazily created on first access, so it is never null. |
| first | T | The first element in this list. |
| last | T | The last element in this list. |
| random | T | Picks a single element from this list at random. |
| randomSort | CommonList<T> | Builds a new list containing this list's elements in a random order. This list is not modified. |
| reverse | CommonList<T> | Builds a new list with the elements of this one in reverse order. This list is not modified. |
Methods
getAttributes() · addQuiet(T t) · getFirst() · getLast() · removeLast() · removeFirst() · getRandom() · getReverse() · getRandomSort() · upTo(int n) · after(int n) · truncate(int maxSize) · forEach(Consumer<? super T> action) · sortByProperty(String propertyName) · sortReverse()
getAttributes()
Returns: Map<String,Object>
A general-purpose map for stashing arbitrary values alongside this list, for example to cache data computed while rendering a template. Lazily created on first access, so it is never null.
addQuiet(T t)
Returns: String
Appends an element to this list, for use directly inside a template expression. Behaves like add(), but returns an empty string instead of a boolean so it does not generate unwanted output when called from a template.
| Parameter | Description |
|---|---|
t | the element to append |
getFirst()
Returns: T
The first element in this list.
getLast()
Returns: T
The last element in this list.
removeLast()
Returns: T
Removes and returns the last element of this list.
removeFirst()
Returns: T
Removes and returns the first element of this list.
getRandom()
Returns: T
Picks a single element from this list at random.
getReverse()
Returns: CommonList<T>
Builds a new list with the elements of this one in reverse order. This list is not modified.
getRandomSort()
Returns: CommonList<T>
Builds a new list containing this list's elements in a random order. This list is not modified.
upTo(int n)
Returns: CommonList<T>
Builds a new list containing at most the first n elements of this list.
| Parameter | Description |
|---|---|
n | the maximum number of leading elements to keep |
after(int n)
Returns: CommonList<T>
Builds a new list with the leading n elements of this list skipped. For example after(2) returns a list without the first 2 elements. The count is 1-indexed, so after(1) skips only the first element and after(0) skips none.
| Parameter | Description |
|---|---|
n | the number of leading elements to skip |
truncate(int maxSize)
Returns: CommonList<T>
Builds a new list containing at most maxSize elements of this list, taken from the start.
| Parameter | Description |
|---|---|
maxSize | the maximum number of elements the new list may contain |
forEach(Consumer<? super T> action)
Returns: void
Applies the given action to each element in this list, in order. Yields to the Governor between elements so that long-running iterations over large lists can be interrupted or throttled.
| Parameter | Description |
|---|---|
action | the action to apply to each element |
sortByProperty(String propertyName)
Returns: CommonList<T>
Builds a new list containing this list's elements sorted by a named bean property, using reflection to read the property from each element. If propertyName is null, or sorting fails for any reason, this same list is returned unchanged.
| Parameter | Description |
|---|---|
propertyName | the name of the bean property to sort elements by |
sortReverse()
Returns: CommonList<T>
Builds a new list with this list's elements in reverse order, by inserting each element at the head of the new list.
Methods
getProgramCodes()
Returns: Set<String>
The distinct set of program codes referenced by the module statuses in this list.
getCourseCodes()
Returns: Set<String>
The distinct set of course codes referenced by the module statuses in this list.
getModuleCodes()
Returns: Set<String>
The distinct set of module codes referenced by the module statuses in this list.
filterByProgram(String progCode)
Returns: ModulesList
Returns a new list containing only the module statuses whose program code matches the given code.
| Parameter | Description |
|---|---|
progCode | the program code to filter by |
filterByCourse(String courseCode)
Returns: ModulesList
Returns a new list containing only the module statuses whose course code matches the given code.
| Parameter | Description |
|---|---|
courseCode | the course code to filter by |
filterByModule(String moduleCode)
Returns: ModulesList
Returns a new list containing only the module statuses whose module code matches the given code.
| Parameter | Description |
|---|---|
moduleCode | the module code to filter by |
filterCompleted()
Returns: ModulesList
Returns a new list containing only the module statuses that are complete.
filterInComplete()
Returns: ModulesList
Returns a new list containing only the module statuses that are not yet complete.