View Javadoc

1   /*
2    * Copyright 2007 The International Moth Class Association (IMCA)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.imca.model.entities;
17  
18  import javax.persistence.Entity;
19  import javax.persistence.GeneratedValue;
20  import javax.persistence.GenerationType;
21  import javax.persistence.Id;
22  import javax.persistence.NamedQueries;
23  import javax.persistence.NamedQuery;
24  import javax.persistence.OneToOne;
25  
26  /**
27   * An persistence entity description. There is no logic just getter and setters,
28   * for the properties. This Object represents a table in the database and the
29   * properties are fields.
30   *
31   * @author dougculnane
32   */
33  @Entity
34  @NamedQueries( { 
35      @NamedQuery(name = "EventEntryBasicSearch",
36              query = "SELECT o FROM EventEntryEntity o WHERE " +
37                      "o.boatName LIKE :search OR o.sailNumber " +
38                      "LIKE :search") 
39  })
40  public class EventEntryEntity {
41  
42      /**
43       * Object Identifier.
44       */
45      @Id
46      @GeneratedValue(strategy=GenerationType.TABLE)
47      private long id;
48  
49      @OneToOne
50      private BoatEntity boat;
51  
52      private String sailNumber = "";
53  
54      private String boatName = "";
55  
56      @OneToOne
57      private EventEntity event;
58      
59      @OneToOne
60      private BoatVersionEntity boatVersion;
61  
62      @OneToOne
63      private SailingClubEntity sailingClub;
64  
65      @OneToOne
66      private PersonEntity person;
67  
68      @OneToOne
69      private FeeEntity fee;
70  
71      public BoatEntity getBoat() {
72          return boat;
73      }
74  
75      public void setBoat(BoatEntity boat) {
76          this.boat = boat;
77      }
78  
79      public String getBoatName() {
80          return boatName;
81      }
82  
83      public void setBoatName(String boatName) {
84          this.boatName = boatName;
85      }
86  
87      public FeeEntity getFee() {
88          return fee;
89      }
90  
91      public void setFee(FeeEntity fee) {
92          this.fee = fee;
93      }
94  
95      public long getId() {
96          return id;
97      }
98  
99      public void setId(long id) {
100         this.id = id;
101     }
102 
103     public BoatVersionEntity getBoatVersion() {
104         return boatVersion;
105     }
106 
107     public void setBoatVersion(BoatVersionEntity boatVersion) {
108         this.boatVersion = boatVersion;
109     }
110 
111     public PersonEntity getPerson() {
112         return person;
113     }
114 
115     public void setPerson(PersonEntity person) {
116         this.person = person;
117     }
118 
119     public SailingClubEntity getSailingClub() {
120         return sailingClub;
121     }
122 
123     public void setSailingClub(SailingClubEntity sailingClub) {
124         this.sailingClub = sailingClub;
125     }
126 
127     public String getSailNumber() {
128         return sailNumber;
129     }
130 
131     public void setSailNumber(String sailNumber) {
132         this.sailNumber = sailNumber;
133     }
134 
135     public EventEntity getEvent() {
136         return event;
137     }
138 
139     public void setEvent(EventEntity event) {
140         this.event = event;
141     }
142 
143     /**
144      * Override the Object method to give a usable human readable 
145      * representation of the Object.
146      */
147     public String toString(){
148         return event.toString() + " - " 
149                 + boat.toString()  + " - " 
150                 + person.toString();
151     }
152 
153 }