com.mycompany.expense
Class Report

java.lang.Object
  extended bycom.mycompany.expense.Report
All Implemented Interfaces:
java.io.Serializable

public class Report
extends java.lang.Object
implements java.io.Serializable

This class represents a report in the ReportRegistry.

Version:
1.0
Author:
Hans Bergsten, Gefion Software
See Also:
Serialized Form

Field Summary
private  int currentEntryId
           
private  java.util.Map entries
           
private  int id
           
private  java.lang.String owner
           
private  int status
           
static int STATUS_ACCEPTED
           
static int STATUS_NEW
           
static int STATUS_OPEN
           
static int STATUS_REJECTED
           
static int STATUS_SUBMITTED
           
private  java.lang.String title
           
 
Constructor Summary
Report()
          Creates a new, empty instance.
Report(Report src)
          Creates an instance that is a copy of the provided instance.
 
Method Summary
 void addEntry(ReportEntry entry)
          Sets the "id" property of the provided ReportEntry and saves a copy of the ReportEntry (so that changes to the provided instance doesn't change the content of the report).
private  java.util.Map copyEntries()
          Returns a Map with copies of all entries.
private  int getCurrentEntryId()
          Returns the current ID value.
 java.util.Date getEndDate()
          Returns the report end date.
 java.util.List getEntries()
          Returns a List with copies of all entries.
private  java.util.List getEntriesSortedByDate()
          Returns all entries sorted by date.
 ReportEntry getEntry(int id)
          Returns a copy of the entry with the specified ID.
 int getId()
          Returns the report ID.
 java.lang.String getOwner()
          Returns the report owner.
 java.util.Date getStartDate()
          Returns the report start date.
 int getStatus()
          Returns the report status.
 java.lang.String getTitle()
          Returns the report title.
 double getTotal()
          Returns the total of all entry amounts.
 void removeEntry(int id)
          Removes the entry with the specified ID.
private  void setCurrentEntryId(int currentEntryId)
          Sets the current ID value.
private  void setEntries(java.util.Map entries)
          Sets the entries.
 void setId(int id)
          Sets the report ID.
 void setOwner(java.lang.String owner)
          Sets the report owner.
 void setStatus(int status)
          Sets the report status.
 void setTitle(java.lang.String title)
          Sets the report title.
 java.lang.String toString()
          Returns a String with all report properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATUS_NEW

public static final int STATUS_NEW
See Also:
Constant Field Values

STATUS_OPEN

public static final int STATUS_OPEN
See Also:
Constant Field Values

STATUS_SUBMITTED

public static final int STATUS_SUBMITTED
See Also:
Constant Field Values

STATUS_ACCEPTED

public static final int STATUS_ACCEPTED
See Also:
Constant Field Values

STATUS_REJECTED

public static final int STATUS_REJECTED
See Also:
Constant Field Values

currentEntryId

private int currentEntryId

id

private int id

title

private java.lang.String title

owner

private java.lang.String owner

status

private int status

entries

private java.util.Map entries
Constructor Detail

Report

public Report()
Creates a new, empty instance.


Report

public Report(Report src)
Creates an instance that is a copy of the provided instance.

Method Detail

getId

public int getId()
Returns the report ID.


setId

public void setId(int id)
Sets the report ID.


getTitle

public java.lang.String getTitle()
Returns the report title.


setTitle

public void setTitle(java.lang.String title)
Sets the report title.


getOwner

public java.lang.String getOwner()
Returns the report owner.


setOwner

public void setOwner(java.lang.String owner)
Sets the report owner.


getStatus

public int getStatus()
Returns the report status.


setStatus

public void setStatus(int status)
Sets the report status.


addEntry

public void addEntry(ReportEntry entry)
Sets the "id" property of the provided ReportEntry and saves a copy of the ReportEntry (so that changes to the provided instance doesn't change the content of the report).


removeEntry

public void removeEntry(int id)
Removes the entry with the specified ID.


getEntry

public ReportEntry getEntry(int id)
Returns a copy of the entry with the specified ID.


getEntries

public java.util.List getEntries()
Returns a List with copies of all entries.


getStartDate

public java.util.Date getStartDate()
Returns the report start date.


getEndDate

public java.util.Date getEndDate()
Returns the report end date.


getTotal

public double getTotal()
Returns the total of all entry amounts.


toString

public java.lang.String toString()
Returns a String with all report properties.


getEntriesSortedByDate

private java.util.List getEntriesSortedByDate()
Returns all entries sorted by date.


getCurrentEntryId

private int getCurrentEntryId()
Returns the current ID value.


setCurrentEntryId

private void setCurrentEntryId(int currentEntryId)
Sets the current ID value.


copyEntries

private java.util.Map copyEntries()
Returns a Map with copies of all entries.


setEntries

private void setEntries(java.util.Map entries)
Sets the entries.