org.workjournal
Class JournalEntry

java.lang.Object
  |
  +--org.workjournal.JournalEntry

public class JournalEntry
extends java.lang.Object

This class represents a journal entry, which is simply a record about something that has been done, such as a period of contract work, and includes things like work date, start time, end time, etc.

Author:
Thornton Rose
See Also:
Journal, Formats

Constructor Summary
JournalEntry()
          Construct a new JournalEntry.
JournalEntry(long id)
          Construct a new JournalEntry with the given ID.
 
Method Summary
 java.lang.Object clone()
          Clone this entry.
 void copy(JournalEntry entry)
          Make this entry a copy of the given entry to this entry.
 boolean equals(java.lang.Object obj)
          Determine if this entry is equal to the given object.
 float getEndHours()
          Get the end time as hours.
 java.lang.String getEndHoursFormatted()
          Get the end time hours formatted as Formats.HOURS_FORMAT.
 java.lang.String getEndTime()
          Get end time.
 float getHours()
          Calculate and return the work hours (start hours - end hours - meal hours)
 java.lang.String getHoursFormatted()
          Get work hours formatted as Formats.HOURS_FORMAT.
 long getId()
          Get entry ID.
 float getMeals()
          Get the meal time as hours.
 java.lang.String getMealsFormatted()
          Get the meal time hours formatted as Formats.HOURS_FORMAT.
 java.lang.String getMealTime()
          Get meal time.
 java.lang.String getNotes()
          Get the work notes.
 float getStartHours()
          Get the start time as hours.
 java.lang.String getStartHoursFormatted()
          Get the start time hours formatted as HOURS_FORMAT.
 java.lang.String getStartTime()
          Get start time.
 java.util.Date getWorkDate()
          Get the work date.
 java.lang.String getWorkDateDbFormatted()
          Get the work date formatted as Formats.DB_DATE_FORMAT.
 java.lang.String getWorkDateDowFormatted()
          Get the work date formatted as Formats.DOW_DATE_FORMAT.
 java.lang.String getWorkDateFormatted()
          Get the work date formatted as Formats.DATE_FORMAT.
 void setEndTime(java.lang.String endTime)
          Set end time to given time.
 void setId(long id)
          Set entry ID.
 void setMealTime(java.lang.String mealTime)
          Set meal time to given time.
 void setNotes(java.lang.String notes)
          Set the work notes to the given notes.
 void setStartTime(java.lang.String startTime)
          Set start time to given time.
 void setWorkDate(java.util.Date workDate)
          Set work date to given date.
 void setWorkDate(java.lang.String workDate)
          Set work date from the given string, which is assumed to be formatted according to Formats.DATE_FORMAT.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JournalEntry

public JournalEntry()
Construct a new JournalEntry.

JournalEntry

public JournalEntry(long id)
Construct a new JournalEntry with the given ID.
Method Detail

getId

public long getId()
Get entry ID.
Returns:
Entry ID.

setId

public void setId(long id)
Set entry ID.
Parameters:
id - New ID.

getWorkDate

public java.util.Date getWorkDate()
Get the work date. Note that the time part of the work date will always be midnight (00:00:00.00).
Returns:
Work date.

getWorkDateFormatted

public java.lang.String getWorkDateFormatted()
Get the work date formatted as Formats.DATE_FORMAT.
Returns:
Formatted work date.

getWorkDateDowFormatted

public java.lang.String getWorkDateDowFormatted()
Get the work date formatted as Formats.DOW_DATE_FORMAT.
Returns:
Formatted work date.

getWorkDateDbFormatted

public java.lang.String getWorkDateDbFormatted()
Get the work date formatted as Formats.DB_DATE_FORMAT.
Returns:
Formatted work date.

setWorkDate

public void setWorkDate(java.util.Date workDate)
Set work date to given date. Note that only the time part of the given date will be ignored.
Parameters:
workDate - New work date.

setWorkDate

public void setWorkDate(java.lang.String workDate)
                 throws java.text.ParseException
Set work date from the given string, which is assumed to be formatted according to Formats.DATE_FORMAT.
Parameters:
workDate - New work date.

getStartTime

public java.lang.String getStartTime()
Get start time.
Returns:
Start time.

getStartHours

public float getStartHours()
Get the start time as hours.
Returns:
Start time hours.

getStartHoursFormatted

public java.lang.String getStartHoursFormatted()
Get the start time hours formatted as HOURS_FORMAT.
Returns:
Formatted start time hours.

setStartTime

public void setStartTime(java.lang.String startTime)
Set start time to given time.
Parameters:
startTime - New start time.

getEndTime

public java.lang.String getEndTime()
Get end time.
Returns:
End time.

getEndHours

public float getEndHours()
Get the end time as hours.
Returns:
End time hours.

getEndHoursFormatted

public java.lang.String getEndHoursFormatted()
Get the end time hours formatted as Formats.HOURS_FORMAT.
Returns:
Formatted end time hours.

setEndTime

public void setEndTime(java.lang.String endTime)
Set end time to given time.
Parameters:
endTime - New end time.

getMealTime

public java.lang.String getMealTime()
Get meal time.
Returns:
Meal time.

getMeals

public float getMeals()
Get the meal time as hours.
Returns:
Meal time hours.

getMealsFormatted

public java.lang.String getMealsFormatted()
Get the meal time hours formatted as Formats.HOURS_FORMAT.
Returns:
Formatted meal time hours.

setMealTime

public void setMealTime(java.lang.String mealTime)
Set meal time to given time.
Parameters:
mealTime - New meal time.

getHours

public float getHours()
Calculate and return the work hours (start hours - end hours - meal hours)
Returns:
Work hours.

getHoursFormatted

public java.lang.String getHoursFormatted()
Get work hours formatted as Formats.HOURS_FORMAT.
Returns:
Formatted hours.

getNotes

public java.lang.String getNotes()
Get the work notes.
Returns:
Work notes.

setNotes

public void setNotes(java.lang.String notes)
Set the work notes to the given notes.
Parameters:
notes - New notes.

equals

public boolean equals(java.lang.Object obj)
Determine if this entry is equal to the given object.
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Clone this entry.
Overrides:
clone in class java.lang.Object

copy

public void copy(JournalEntry entry)
Make this entry a copy of the given entry to this entry.