java.lang.Object
com.pragmatickm.task.model.TaskLog
- All Implemented Interfaces:
Iterable<TaskLog.Entry>
A TaskLog is a persistent list of entries stored for a task.
When the data is first accessed, it is read from an XML file.
When the XML file updated, the data is re-read.
When the data is changed, the XML file is re-written immediately.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntry
(TaskLog.Entry entry) Adds a new entry to the log, writing the new XML file immediately.Gets the set of all entries.getEntries
(Calendar scheduledOn) Gets the entries grouped by "scheduledOn" value or empty list if there are none.Gets a snapshot of the entries grouped by "scheduledOn" value.getFirstIncompleteScheduledOn
(Calendar from, Recurring recurring) Gets the first incomplete scheduled on date.getMostRecentEntry
(Calendar scheduledOn) Gets the most recent entry from the task log on the given date ornull
if none.static TaskLog
getTaskLog
(PageRef xmlFile) To avoid repetitive parsing, only one TaskLog is created for each unique PageRef.iterator()
Iterates through a snapshot of the entries.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getTaskLog
To avoid repetitive parsing, only one TaskLog is created for each unique PageRef. -
getXmlFile
-
getEntries
Gets the set of all entries. This is a snapshot view and will not change even when the log has been updated. To get a new snapshot, call this method again.
Entries are in order by "on" time.
- Throws:
IOException
-
iterator
Iterates through a snapshot of the entries.- Specified by:
iterator
in interfaceIterable<TaskLog.Entry>
- See Also:
-
getEntriesByScheduledOnDate
Gets a snapshot of the entries grouped by "scheduledOn" value. Has anull
key for any entries without a "scheduledOn" date. The cache key is the date in YYYY-MM-DD format.- Throws:
IOException
- See Also:
-
getEntries
Gets the entries grouped by "scheduledOn" value or empty list if there are none. Supportsnull
for all entries without a "scheduledOn" date.- Throws:
IOException
-
addEntry
Adds a new entry to the log, writing the new XML file immediately.- Throws:
IOException
-
getMostRecentEntry
Gets the most recent entry from the task log on the given date ornull
if none.- Throws:
IOException
-
getFirstIncompleteScheduledOn
public UnmodifiableCalendar getFirstIncompleteScheduledOn(Calendar from, Recurring recurring) throws IOException Gets the first incomplete scheduled on date.- Throws:
IOException
-