KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > geometricforms > Form


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: Form.java 1102 2006-08-16 13:07:26Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.entity.geometricforms;
26
27 import javax.persistence.EntityListeners;
28 import javax.persistence.EnumType;
29 import javax.persistence.Enumerated;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.MappedSuperclass;
34 import javax.persistence.NamedQuery;
35 import javax.persistence.TableGenerator;
36
37 import org.objectweb.easybeans.tests.common.listeners.FormsListener00;
38
39 /**
40  * Represents a geometric form.
41  * @author Gisele Pinheiro Souza
42  * @author Eduardo Studzinski Estima de Castro
43  *
44  */

45 @MappedSuperclass
46 @EntityListeners(FormsListener00.class)
47 @NamedQuery(name = "findAllByType", query = "SELECT f FROM Form f WHERE f.formType = :formType")
48 @TableGenerator(name = "ID_SEQ", allocationSize = 1)
49 public class Form {
50
51     /**
52      * The entity identifier.
53      */

54     private int id;
55
56     /**
57      * The form area.
58      */

59     private float area;
60
61     /**
62      *The form perimeter.
63      */

64     private float perimeter;
65
66     /**
67      * The form type.
68      */

69    private FormType formType;
70
71    /**
72     * Gets the form type.
73     * @return the form type.
74     */

75     @Enumerated(EnumType.STRING)
76     public FormType getFormType() {
77         return formType;
78     }
79
80     /**
81      * Sets the form type.
82      * @param formType the form type.
83      */

84     public void setFormType(final FormType formType) {
85         this.formType = formType;
86     }
87
88
89     /**
90      * Gets the form area.
91      * @return the area.
92      */

93     public float getArea() {
94         return area;
95     }
96
97     /**
98      * Sets the form area.
99      * @param area the area.
100      */

101     public void setArea(final float area) {
102         this.area = area;
103     }
104
105     /**
106      * Gets the form identifier.
107      * @return the identifier.
108      */

109     @Id
110     @GeneratedValue(strategy=GenerationType.TABLE, generator="ID_SEQ")
111     public int getId() {
112         return id;
113     }
114
115     /**
116      * Sets the form identifier.
117      * @param id the form identifier.
118      */

119     public void setId(final int id) {
120         this.id = id;
121     }
122
123     /**
124      * Gets the form perimeter.
125      * @return the form perimeter.
126      */

127     public float getPerimeter() {
128         return perimeter;
129     }
130
131     /**
132      * Sets the form perimeter.
133      * @param perimeter the form perimeter.
134      */

135     public void setPerimeter(final float perimeter) {
136         this.perimeter = perimeter;
137     }
138
139 }
140
Popular Tags