KickJava   Java API By Example, From Geeks To Geeks.

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


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: Triangle.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.Entity;
28 import javax.persistence.PostLoad;
29 import javax.persistence.PostPersist;
30 import javax.persistence.PostRemove;
31 import javax.persistence.PostUpdate;
32 import javax.persistence.PrePersist;
33 import javax.persistence.PreRemove;
34 import javax.persistence.PreUpdate;
35 import javax.persistence.TableGenerator;
36
37 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
38 import org.objectweb.easybeans.tests.common.listeners.FormsListenerBase;
39
40 /**
41  * Represents the triangle. Defines the callback methods in the class.
42  * @author Gisele Pinheiro Souza
43  * @author Eduardo Studzinski Estima de Castro
44  *
45  */

46 @Entity
47 @TableGenerator(name = "ID_SEQ", allocationSize = 1)
48 public class Triangle extends Form {
49
50     /**
51      * The triangle height.
52      */

53     private float height;
54
55     /**
56      * The triangle base.
57      */

58     private float base;
59
60     /**
61      * Gets the triangle base.
62      * @return the base.
63      */

64     public float getBase() {
65         return base;
66     }
67
68     /**
69      * Sets the triangle base.
70      * @param base the base.
71      */

72     public void setBase(final float base) {
73         this.base = base;
74     }
75
76     /**
77      * Gets the triangle height.
78      * @return the height.
79      */

80     public float getHeight() {
81         return height;
82     }
83
84     /**
85      * Sets the triangle height.
86      * @param height the height.
87      */

88     public void setHeight(final float height) {
89         this.height = height;
90     }
91
92     /**
93      * Inserts in the lifecycle callback logger that the PrePersist callback
94      * method was called.
95      */

96     @PrePersist
97     public void prePersist() {
98         FormsListenerBase.insertEntity(CallbackType.PRE_PERSIST, this, this.getClass().getName());
99     }
100
101     /**
102      * Inserts in the lifecycle callback logger that the PostPersist callback
103      * method was called.
104      */

105     @PostPersist
106     public void postPersist() {
107         FormsListenerBase.insertEntity(CallbackType.POST_PERSIST, this, this.getClass().getName());
108     }
109
110     /**
111      * Inserts in the lifecycle callback logger that the PostRemove callback
112      * method was called.
113      */

114     @PreRemove
115     public void preRemove() {
116         FormsListenerBase.insertEntity(CallbackType.POST_REMOVE, this, this.getClass().getName());
117     }
118
119     /**
120      * Inserts in the lifecycle callback logger that the PostRemove callback
121      * method was called.
122      */

123     @PostRemove
124     public void postRemove() {
125         FormsListenerBase.insertEntity(CallbackType.POST_REMOVE, this, this.getClass().getName());
126     }
127
128     /**
129      * Inserts in the lifecycle callback logger that the PreUpdate callback
130      * method was called.
131      */

132     @PreUpdate
133     public void preUpdate() {
134         FormsListenerBase.insertEntity(CallbackType.PRE_UPDATE, this, this.getClass().getName());
135     }
136
137     /**
138      * Inserts in the lifecycle callback logger that the PostLoad callback
139      * method was called.
140      */

141     @PostLoad
142     public void postLoad() {
143         FormsListenerBase.insertEntity(CallbackType.POST_LOAD, this, this.getClass().getName());
144     }
145
146     /**
147      * Inserts in the lifecycle callback logger that the PostUpdate callback
148      * method was called.
149      */

150     @PostUpdate
151     public void postUpdate() {
152         FormsListenerBase.insertEntity(CallbackType.POST_UPDATE, this, this.getClass().getName());
153     }
154 }
155
Popular Tags