CLRA 0.1.2

com.clra.rowing
Class RowingDBRead

java.lang.Object
  |
  +--com.clra.rowing.RowingDBRead

public final class RowingDBRead
extends Object

This utility class defines common routines for reading snapshots from the database. In cases where read-only lists are presented to a user, these routines are faster than their ejbFind counterparts. However, data should never be written directly back to the database, otherwise in-memory caches maintained by EJB's will be out of synch and data will be corrupted. The class RowingUtils defines utilities with similar signatures that are implemented by calls to EJB's. These operations are appropriate if objects should be cached in memory because they will be modified shortly.

Version:
$Revision: 1.2 $ $Date: 2002/01/30 15:02:47 $
Author:
Rick Hall

Field Summary
static SimpleDateFormat dateFormat
          The format used to specify a date and time to the database
static int NULL_INT
          Labels a null integer in the database, per JDBC
static SimpleDateFormat sdfConvert
          The format used to convert a date/time String to a Date
static SimpleDateFormat sdfDBDate
          The format used to get a date out of the data base
static SimpleDateFormat sdfDBTime
          The format used to get a time out of the data base
 
Method Summary
static Collection findAllEnrollmentSnapshots(int member_id)
          Returns a collection of snapshots for all enrollments
static Collection findAllEnrollmentSnapshotsInRange(int member_id, Date start, Date finish)
          Returns a collection of snapshots for enrollments within an inclusive date range.
static Collection findAllRowingSessionSnapshots()
          Returns a collection of snapshots for all rowing sessions
static Collection findAllRowingSessionSnapshotsInRange(Date start, Date finish)
          Returns a collection of snapshots for rowing sessions within an inclusive date range.
static Collection findParticipant2SnapshotsForRowingSession(Integer rowingId)
          Returns a collection of Participant2Snapshot instances for the specified rowing session.
static ParticipantSnapshot loadParticipant(Integer participantId)
          Returns a Participant identified by a participant id.
static ParticipantSnapshot loadParticipant(Integer memberId, Integer rowingId)
          Returns a Participant identified by a member and rowing id.
static RowingSessionSnapshot loadRowingSession(Integer rowingId)
           
static EnrollmentSnapshot mapResultSetToEnrollmentSnapshot(java.sql.ResultSet rs)
          Constructs an EnrollmentSnapshot from the current row of a result set.
static Participant2Snapshot mapResultSetToParticipant2Snapshot(java.sql.ResultSet rs)
          Constructs an Participant2Snapshot from the current row of a result set.
static ParticipantSnapshot mapResultSetToParticipantSnapshot(java.sql.ResultSet rs)
          Constructs an ParticipantSnapshot from the current row of a result set.
static RowingSessionSnapshot mapResultSetToRowingSessionSnapshot(java.sql.ResultSet rs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_INT

public static final int NULL_INT
Labels a null integer in the database, per JDBC

dateFormat

public static final SimpleDateFormat dateFormat
The format used to specify a date and time to the database

sdfDBDate

public static final SimpleDateFormat sdfDBDate
The format used to get a date out of the data base

sdfDBTime

public static final SimpleDateFormat sdfDBTime
The format used to get a time out of the data base

sdfConvert

public static final SimpleDateFormat sdfConvert
The format used to convert a date/time String to a Date
Method Detail

loadRowingSession

public static RowingSessionSnapshot loadRowingSession(Integer rowingId)
                                               throws java.sql.SQLException,
                                                      RowingException,
                                                      javax.ejb.NoSuchEntityException

findAllRowingSessionSnapshots

public static Collection findAllRowingSessionSnapshots()
                                                throws RowingException
Returns a collection of snapshots for all rowing sessions

findAllRowingSessionSnapshotsInRange

public static Collection findAllRowingSessionSnapshotsInRange(Date start,
                                                              Date finish)
                                                       throws RowingException
Returns a collection of snapshots for rowing sessions within an inclusive date range.

findAllEnrollmentSnapshots

public static Collection findAllEnrollmentSnapshots(int member_id)
                                             throws RowingException
Returns a collection of snapshots for all enrollments

findAllEnrollmentSnapshotsInRange

public static Collection findAllEnrollmentSnapshotsInRange(int member_id,
                                                           Date start,
                                                           Date finish)
                                                    throws RowingException
Returns a collection of snapshots for enrollments within an inclusive date range.

loadParticipant

public static ParticipantSnapshot loadParticipant(Integer participantId)
                                           throws java.sql.SQLException,
                                                  RowingException,
                                                  javax.ejb.NoSuchEntityException
Returns a Participant identified by a participant id.
Returns:
NEVER
Throws:
javax.ejb.NoSuchEntityException - if the id does not identify a participant

loadParticipant

public static ParticipantSnapshot loadParticipant(Integer memberId,
                                                  Integer rowingId)
                                           throws java.sql.SQLException,
                                                  RowingException
Returns a Participant identified by a member and rowing id. The combination member_id/rowing_id is an alternate key on the Participant table. Therefore this routine returns either a null Participant or a unique Participant.
Returns:
possibly null

findParticipant2SnapshotsForRowingSession

public static Collection findParticipant2SnapshotsForRowingSession(Integer rowingId)
                                                            throws RowingException
Returns a collection of Participant2Snapshot instances for the specified rowing session.
Returns:
a non-null collection of Participant2Snapshot instances, possibly empty

mapResultSetToRowingSessionSnapshot

public static RowingSessionSnapshot mapResultSetToRowingSessionSnapshot(java.sql.ResultSet rs)
                                                                 throws java.sql.SQLException,
                                                                        RowingException

mapResultSetToParticipantSnapshot

public static ParticipantSnapshot mapResultSetToParticipantSnapshot(java.sql.ResultSet rs)
                                                             throws java.sql.SQLException,
                                                                    RowingException
Constructs an ParticipantSnapshot from the current row of a result set.
Parameters:
rs - A result set containing the following columns:
  • member_id
  • rowing_id
  • participant_id
  • requested
  • replaces_id
  • initial_seat
  • final_seat
  • attendance
rs - A non-null result set containing the columns specified above.
Throws:
RowingException - if the result set is exhausted.
java.sql.SQLException - if some database-related error occurs

mapResultSetToParticipant2Snapshot

public static Participant2Snapshot mapResultSetToParticipant2Snapshot(java.sql.ResultSet rs)
                                                               throws java.sql.SQLException,
                                                                      RowingException
Constructs an Participant2Snapshot from the current row of a result set.
Parameters:
rs - A result set containing the same columns as ParticipantSnapshot, plus following columns:
  • name_first
  • name_middle
  • name_last
  • name_suffix
rs - A non-null result set containing the columns specified above.
Throws:
RowingException - if the result set is exhausted.
java.sql.SQLException - if some database-related error occurs

mapResultSetToEnrollmentSnapshot

public static EnrollmentSnapshot mapResultSetToEnrollmentSnapshot(java.sql.ResultSet rs)
                                                           throws java.sql.SQLException,
                                                                  RowingException
Constructs an EnrollmentSnapshot from the current row of a result set.
Parameters:
rs - A result set containing the following columns:
  • rowing_id
  • rowing_date
  • rowing_level
  • rowing_type
  • rowing_state
  • participant_id
  • requested
  • initial_seat
  • final_seat
  • attendance
  • member_id
rs - A non-null result set containing the columns specified above.
Throws:
RowingException - if the result set is exhausted.
java.sql.SQLException - if some database-related error occurs

CLRA 0.1.2