Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/clra/web/ParticipantView.java


1   /*
2    * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3    * Distributed under the GPL license. See doc/COPYING.
4    * $RCSfile: ParticipantView.java,v $
5    * $Date: 2003/02/26 03:38:46 $
6    * $Revision: 1.3 $
7    */
8   
9   package com.clra.web;
10  
11  import com.clra.rowing.ParticipantSnapshot;
12  import com.clra.rowing.SeatPreference;
13  
14  /**
15   * Read-only information about a member's participation in rowing session.
16   * A thin-wrapper around ParticipantSnapshot,with some String properties
17   * useful in JSP's.
18   *
19   * @version $Revision: 1.3 $ $Date: 2003/02/26 03:38:46 $
20   * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
21   */
22  public class ParticipantView {
23  
24    private ParticipantSnapshot data;
25  
26    /**
27     * Constructs an invalid instance. Use this constructor only for JSP beans
28     * and immediately set valid values via setValuesFromRowingSession(..).
29     */
30    public ParticipantView() {
31      this.data = null;
32    }
33  
34    public ParticipantView( ParticipantSnapshot data ) {
35      setData( data );
36    }
37  
38    public void setData( ParticipantSnapshot data ) {
39      if ( data == null ) {
40        throw new IllegalArgumentException( "null participant snapshot" );
41      }
42      this.data = data;
43    }
44  
45    public ParticipantSnapshot getData() {
46      if ( data == null ) {
47        throw new IllegalStateException( "null participant data" );
48      }
49      return this.data;
50    }
51  
52    /**
53     * Return the primary key of the member associated with this participant.
54     */
55    Integer getMemberId() {
56      return this.getData().getMemberId();
57    }
58  
59    /**
60     * Returns the primary key of the rowing session a participant has joined.
61     */
62    Integer getRowingId() {
63      return this.getData().getRowingId();
64    }
65  
66    /** Returns the primary key of a participant instance */
67    public Integer getParticipantId() {
68      return this.getData().getParticipantId();
69    }
70  
71    /**
72     * Returns the requested seating position of a signed-up participant,
73     * or blank if a participant is a substitute or an extra.
74     */
75    String getSeatPreference() {
76      String retVal = "";
77      if ( this.getData().getSeatPreference() != null ) {
78        retVal = this.getData().getSeatPreference().getName();
79      }
80      return retVal;
81    }
82  
83    /**
84     * Returns the participant id of the signed-up, but absent, participant
85     * for whom this member is substituting, or null if this member is not a
86     * substitute.
87     */
88    Integer getReplacesId() {
89      return this.getData().getReplacesId();
90    }
91  
92    /**
93     * Returns the initial seat assigned to a participant, or null if
94     * a participant hasn't been assigned an initial boating.</p><p>
95     *
96     * Note that seat id is not the same as seat number. A seat id is a primary
97     * key for a triplet value composed of a rowing_id (identifies a rowing
98     * session), a boat_id (identifies a particular sweep or scull), and
99     * a seat number (identifies a position within a sweep or scull).
100    */
101   Integer getInitialSeatId() {
102     return this.getData().getInitialSeatId();
103   }
104 
105   /**
106    * Returns the final seat assigned to a participant, or null if
107    * a participant has not been assigned to a final boating.</p><p>
108    *
109    * See <tt>getInitialSeatId()</tt> for a note on the distinction between
110    * seat id and seat number.
111    */
112   Integer getFinalSeatId() {
113     return this.getData().getFinalSeatId();
114   }
115 
116   /**
117    * Returns the attendance of a participant at a rowing session,
118    * or blank if a participant has not been assigned an attendance.
119    */
120   String getAttendance() {
121     String retVal = "";
122     if ( this.getData().getAttendance() != null ) {
123       retVal = this.getData().getAttendance().getName();
124     }
125     return retVal;
126   } // getAttendance()
127 
128 } // ParticipantView
129 
130 /*
131  * $Log: ParticipantView.java,v $
132  * Revision 1.3  2003/02/26 03:38:46  rphall
133  * Added copyright and GPL license
134  *
135  * Revision 1.2  2002/02/18 18:06:50  rphall
136  * Ran dos2unix to remove ^M (carriage return) from end of lines
137  *
138  * Revision 1.1.1.1  2002/01/03 21:57:28  rphall
139  * Initial load, 5th try, Jan-03-2002 4:57 PM
140  *
141  * Revision 1.2  2001/12/13 21:23:50  rphall
142  * Changed return values to Strings, Integers
143  *
144  * Revision 1.2  2001/12/13 01:30:21  rphall
145  * Enrollment business and web objects
146  *
147  * Revision 1.1  2001/12/12 04:49:43  rphall
148  * Compiles, but not yet tested
149  *
150  * Revision 1.1  2001/11/23 18:23:16  rphall
151  * Read-only view of participant data
152  *
153  * Revision 1.2  2001/11/18 18:15:01  rphall
154  * Fixed compilation problems
155  *
156  * Revision 1.1  2001/11/18 17:07:07  rphall
157  * Checkpt before major revision of rowing package
158  *
159  */
160