KickJava   Java API By Example, From Geeks To Geeks.

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


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: Scalene.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  * Representes a triangle scalene. Overrides the callback methods, but does not specify a lifecycle event in the methdos.
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 Scalene extends Triangle {
49
50     /**
51      * Value appended in the overriden callback method that must not be called.
52      */

53     public static final String JavaDoc WRONG_CALL = "WRONG";
54
55     /**
56      * A dummy field, just to have some field in this class.
57      */

58     private int dummyField;
59
60     /**
61      * Gets the dummy field.
62      * @return the dummy field.
63      */

64     public int getDummyField() {
65         return dummyField;
66     }
67
68     /**
69      * Sets the dummy field.
70      * @param dummyField the dummy field.
71      */

72     public void setDummyField(final int dummyField) {
73         this.dummyField = dummyField;
74     }
75
76     /**
77      * Overrides the PrePersist method, but does not specify it as a PrePersist
78      * event. So the container must no call this method.
79      */

80     @Override JavaDoc
81     public void prePersist() {
82         FormsListenerBase.insertEntity(CallbackType.PRE_PERSIST, this, this.getClass().getName() + WRONG_CALL);
83     }
84
85     /**
86      * Overrides the PostPersist method, but does not specify it as a PostPersist
87      * event. So the container must no call this method.
88      */

89     @Override JavaDoc
90     public void postPersist() {
91         FormsListenerBase.insertEntity(CallbackType.POST_PERSIST, this, this.getClass().getName() + WRONG_CALL);
92     }
93
94     /**
95      * Overrides the PreRemove method, but does not specify it as a PreRemove
96      * event. So the container must no call this method.
97      */

98     @Override JavaDoc
99     public void preRemove() {
100         FormsListenerBase.insertEntity(CallbackType.PRE_REMOVE, this, this.getClass().getName() + WRONG_CALL);
101     }
102
103     /**
104      * Overrides the PostRemove method, but does not specify it as a PostRemove
105      * event. So the container must no call this method.
106      */

107     @Override JavaDoc
108     public void postRemove() {
109         FormsListenerBase.insertEntity(CallbackType.POST_REMOVE, this, this.getClass().getName() + WRONG_CALL);
110     }
111
112     /**
113      * Overrides the PreUpdatet method, but does not specify it as a PreUpdate
114      * event. So the container must no call this method.
115      */

116     @Override JavaDoc
117     public void preUpdate() {
118         FormsListenerBase.insertEntity(CallbackType.PRE_UPDATE, this, this.getClass().getName() + WRONG_CALL);
119     }
120
121     /**
122      * Overrides the PostLoad method, but does not specify it as a PostLoad
123      * event. So the container must no call this method.
124      */

125     @Override JavaDoc
126     public void postLoad() {
127         FormsListenerBase.insertEntity(CallbackType.POST_LOAD, this, this.getClass().getName() + WRONG_CALL);
128     }
129
130     /**
131      * Overrides the PostUpdate method, but does not specify it as a PostUpdate
132      * event. So the container must no call this method.
133      */

134     @Override JavaDoc
135     public void postUpdate() {
136         FormsListenerBase.insertEntity(CallbackType.POST_UPDATE, this, this.getClass().getName() + WRONG_CALL);
137     }
138
139     /**
140      * Specifies the PrePersist callback method.
141      *
142      */

143     @PrePersist
144     public void prePersist1() {
145         FormsListenerBase.insertEntity(CallbackType.PRE_PERSIST, this, this.getClass().getName());
146     }
147
148     /**
149      * Specifies the PostPersist callback method.
150      *
151      */

152     @PostPersist
153     public void postPersist1() {
154         FormsListenerBase.insertEntity(CallbackType.POST_PERSIST, this, this.getClass().getName());
155     }
156
157     /**
158      * Specifies the PreRemove callback method.
159      *
160      */

161     @PreRemove
162     public void preRemove1() {
163         FormsListenerBase.insertEntity(CallbackType.PRE_REMOVE, this, this.getClass().getName());
164     }
165
166     /**
167      * Specifies the PostRemove callback method.
168      *
169      */

170     @PostRemove
171     public void postRemove1() {
172         FormsListenerBase.insertEntity(CallbackType.POST_REMOVE, this, this.getClass().getName());
173     }
174
175     /**
176      * Specifies the PreUpdate callback method.
177      *
178      */

179     @PreUpdate
180     public void preUpdate1() {
181         FormsListenerBase.insertEntity(CallbackType.PRE_UPDATE, this, this.getClass().getName());
182     }
183
184     /**
185      * Specifies the PostLoad callback method.
186      *
187      */

188     @PostLoad
189     public void postLoad1() {
190         FormsListenerBase.insertEntity(CallbackType.POST_LOAD, this, this.getClass().getName());
191     }
192
193     /**
194      * Specifies the PostUpdate callback method.
195      *
196      */

197     @PostUpdate
198     public void postUpdate1() {
199         FormsListenerBase.insertEntity(CallbackType.POST_UPDATE, this, this.getClass().getName());
200     }
201 }
202
Popular Tags