View Javadoc

1   //----------------------------------------------------------------------
2   // 
3   // PerfectJPattern: "Design patterns are good but components are better!" 
4   // Movie.java Copyright (c) 2009 Giovanni Azua Garcia
5   // bravegag@hotmail.com
6   //  
7   // This program is free software; you can redistribute it and/or
8   // modify it under the terms of the GNU General Public License
9   // as published by the Free Software Foundation; either version 3
10  // of the License, or (at your option) any later version.
11  //
12  // This program is distributed in the hope that it will be useful,
13  // but WITHOUT ANY WARRANTY; without even the implied warranty of
14  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  // GNU General Public License for more details.
16  //
17  // You should have received a copy of the GNU General Public License
18  // along with this program; if not, see <http://www.gnu.org/licenses/>.
19  //
20  //----------------------------------------------------------------------
21  package org.perfectjpattern.example.datamodel;
22  
23  import javax.persistence.*;
24  
25  /**
26   * Movie Data model object
27   * 
28   * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
29   * @version $Revision: 1.0 $Date: Feb 11, 2009 11:51:40 AM $
30   */
31  @Entity
32  public 
33  class Movie
34  {
35      //------------------------------------------------------------------------
36      // public
37      //------------------------------------------------------------------------
38      public 
39      Movie()
40      {
41          // empty
42      }
43  
44      //------------------------------------------------------------------------
45      public 
46      Movie(String aDirector, String aTitle, int aYear)
47      {
48          theDirector = aDirector;
49          theTitle = aTitle;
50          theYear = aYear;
51      }
52  
53      //------------------------------------------------------------------------
54      /**
55       * Returns the id
56       *
57       * @return the id
58       */
59      public final Long 
60      getId()
61      {
62          return theId;
63      }
64  
65      //------------------------------------------------------------------------
66      /**
67       * Sets the id
68       * 
69       * @param anId the id to set
70       */
71      public final void 
72      setId(Long anId)
73      {
74          theId = anId;
75      }
76  
77      //------------------------------------------------------------------------
78      /**
79       * Returns the director
80       *
81       * @return the director
82       */
83      public final String 
84      getDirector()
85      {
86          return theDirector;
87      }
88  
89      //------------------------------------------------------------------------
90      /**
91       * Sets the director
92       * 
93       * @param anDirector the director to set
94       */
95      public final void 
96      setDirector(String anDirector)
97      {
98          theDirector = anDirector;
99      }
100 
101     //------------------------------------------------------------------------
102     /**
103      * Returns the title
104      *
105      * @return the title
106      */
107     public final String 
108     getTitle()
109     {
110         return theTitle;
111     }
112 
113     //------------------------------------------------------------------------
114     /**
115      * Sets the title
116      * 
117      * @param anTitle the title to set
118      */
119     public final void 
120     setTitle(String anTitle)
121     {
122         theTitle = anTitle;
123     }
124 
125     //------------------------------------------------------------------------
126     /**
127      * Returns the year
128      *
129      * @return the year
130      */
131     public final int 
132     getYear()
133     {
134         return theYear;
135     }
136 
137     //------------------------------------------------------------------------
138     /**
139      * Sets the year
140      * 
141      * @param anYear the year to set
142      */
143     public final void 
144     setYear(int anYear)
145     {
146         theYear = anYear;
147     }    
148     
149     //------------------------------------------------------------------------
150     // members
151     //------------------------------------------------------------------------
152     @Id
153     @GeneratedValue(strategy = GenerationType.AUTO)
154     private Long theId;
155     private String theDirector;
156     private String theTitle;
157     private int theYear;
158 }