com.bigbross.bossa.history
Class Historian

java.lang.Object
  extended bycom.bigbross.bossa.history.Historian
All Implemented Interfaces:
Serializable

public class Historian
extends Object
implements Serializable

This class keeps the historical records of a Bossa engine.

Author:
BigBross Team
See Also:
Serialized Form

Constructor Summary
Historian(Bossa engine)
          Creates a new empty historian.
 
Method Summary
 void exportHistory(Date end, String file)
          Exports to a XML file all events that took place before the provided date.
 List getCaseHistory(Date start, Date end, String caseTypeId, int caseId)
          Returns the events that took place between the start date and the end date, including the start date and excluding the end date, and are related to a case.
 List getCaseHistory(Date start, String caseTypeId, int caseId)
          Returns the events that took place after the start date, inclusive, until now and are related to a case.
 List getCaseHistory(String caseTypeId, int caseId)
          Return all events that took place until now and are related to a case.
 List getCaseTypeHistory(Date start, Date end, String caseTypeId)
          Returns the events that took place between the start date and the end date, including the start date and excluding the end date, and are related to a case type.
 List getCaseTypeHistory(Date start, String caseTypeId)
          Returns the events that took place after the start date, inclusive, until now and are related to a case type.
 List getCaseTypeHistory(String caseTypeId)
          Return all events that took place until now and are related to a case type.
 List getHistory()
          Return all events that took place until now.
 List getHistory(Date start)
          Returns the events that took place after the start date, inclusive, until now.
 List getHistory(Date start, Date end)
          Returns the events that took place between the start date and the end date, including the start date and excluding the end date.
 List getResourceHistory(Date start, Date end, String resourceId)
          Returns the events that took place between the start date and the end date, including the start date and excluding the end date, and are related to a resource.
 List getResourceHistory(Date start, String resourceId)
          Returns the events that took place after the start date, inclusive, until now and are related to a resource.
 List getResourceHistory(String resourceId)
          Return all events that took place until now and are related to a resource.
 void purgeHistory(Date end)
          Removes from history all events that took place before the provided date.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Historian

public Historian(Bossa engine)
Creates a new empty historian.

Parameters:
engine - the bossa engine this historian is part.
Method Detail

getHistory

public List getHistory()
Return all events that took place until now.

Returns:
all events that took place until now.

getHistory

public List getHistory(Date start)
Returns the events that took place after the start date, inclusive, until now.

Parameters:
start - the start date.
Returns:
the events that took place after the start date until now.

getHistory

public List getHistory(Date start,
                       Date end)
Returns the events that took place between the start date and the end date, including the start date and excluding the end date.

Parameters:
start - the start date.
end - the end date.
Returns:
the events that took place between the two dates.

getCaseTypeHistory

public List getCaseTypeHistory(String caseTypeId)
Return all events that took place until now and are related to a case type.

Parameters:
caseTypeId - the id of the case type.
Returns:
all events that took place until now related to the case type.

getCaseTypeHistory

public List getCaseTypeHistory(Date start,
                               String caseTypeId)
Returns the events that took place after the start date, inclusive, until now and are related to a case type.

Parameters:
start - the start date.
caseTypeId - the id of the case type.
Returns:
the events that took place after the start date until now related to the case type.

getCaseTypeHistory

public List getCaseTypeHistory(Date start,
                               Date end,
                               String caseTypeId)
Returns the events that took place between the start date and the end date, including the start date and excluding the end date, and are related to a case type.

Parameters:
start - the start date.
end - the end date.
caseTypeId - the id of the case type.
Returns:
the events that took place between the two dates, related to the case type.

getCaseHistory

public List getCaseHistory(String caseTypeId,
                           int caseId)
Return all events that took place until now and are related to a case.

Parameters:
caseTypeId - the id of the case type.
caseId - the id of the case.
Returns:
all events that took place util now related to the case.

getCaseHistory

public List getCaseHistory(Date start,
                           String caseTypeId,
                           int caseId)
Returns the events that took place after the start date, inclusive, until now and are related to a case.

Parameters:
start - the start date.
caseTypeId - the id of the case type.
caseId - the id of the case.
Returns:
the events that took place after the start date until now related to the case.

getCaseHistory

public List getCaseHistory(Date start,
                           Date end,
                           String caseTypeId,
                           int caseId)
Returns the events that took place between the start date and the end date, including the start date and excluding the end date, and are related to a case.

Parameters:
start - the start date.
end - the end date.
caseTypeId - the id of the case type.
caseId - the id of the case.
Returns:
the events that took place between the two dates, related to the case.

getResourceHistory

public List getResourceHistory(String resourceId)
Return all events that took place until now and are related to a resource.

Parameters:
resourceId - the id of the resource.
Returns:
all events that took place until now related to the resource.

getResourceHistory

public List getResourceHistory(Date start,
                               String resourceId)
Returns the events that took place after the start date, inclusive, until now and are related to a resource.

Parameters:
start - the start date.
resourceId - the id of the resource.
Returns:
the events that took place after the start date until now related to the resource.

getResourceHistory

public List getResourceHistory(Date start,
                               Date end,
                               String resourceId)
Returns the events that took place between the start date and the end date, including the start date and excluding the end date, and are related to a resource.

Parameters:
start - the start date.
end - the end date.
resourceId - the id of the resource.
Returns:
the events that took place between the two dates, related to the resource.

purgeHistory

public void purgeHistory(Date end)
                  throws BossaException
Removes from history all events that took place before the provided date. Events that happened exactly at the provided date are not removed.

Parameters:
end - the limit date for event removal.
Throws:
PersistenceException - if an error occours when making the execution of this method persistent.
BossaException

exportHistory

public void exportHistory(Date end,
                          String file)
                   throws DataTransferException
Exports to a XML file all events that took place before the provided date. Events that happened exactly at the provided date are not exported. This method complements the purgeHistory method, providing a way to save events before purging them.

The format of the exported file is the same used by the EventsXMLHelper class. This class may also be used to export any event list obtained from the other historian methods.

Parameters:
end - the limit date for event removal.
file - the name of the file.
Throws:
DataTransferException
See Also:
purgeHistory(Date), EventsXMLHelper


Copyright © 2003,2004 OpenBR Sistemas S/C Ltda.