KickJava   Java API By Example, From Geeks To Geeks.

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


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: Equilateral.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 an equilateral triangle. Overrides all callback methods with the
42  * same name.
43  * @author Gisele Pinheiro Souza
44  * @author Eduardo Studzinski Estima de Castro
45  */

46 @Entity
47 @TableGenerator(name = "ID_SEQ", allocationSize = 1)
48 public class Equilateral extends Triangle {
49
50     /**
51      * A dummy field, just to have some field in this class.
52      */

53     private int dummyField;
54
55     /**
56      * Gets the dummy field.
57      * @return return dummy field.
58      */

59     public int getDummyField() {
60         return dummyField;
61     }
62
63     /**
64      * Sets the dummy field.
65      * @param dummyField the dummy field.
66      */

67     public void setDummyField(final int dummyField) {
68         this.dummyField = dummyField;
69     }
70
71     /**
72      * Inserts in the lifecycle callback logger that the PrePersist callback
73      * method was called.
74      */

75     @PrePersist
76     @Override JavaDoc
77     public void prePersist() {
78         FormsListenerBase.insertEntity(CallbackType.PRE_PERSIST, this, this.getClass().getName());
79     }
80
81     /**
82      * Inserts in the lifecycle callback logger that the PostPersist callback
83      * method was called.
84      */

85     @Override JavaDoc
86     @PostPersist
87     public void postPersist() {
88         FormsListenerBase.insertEntity(CallbackType.POST_PERSIST, this, this.getClass().getName());
89     }
90
91     /**
92      * Inserts in the lifecycle callback logger that the PreRemove callback
93      * method was called.
94      */

95     @PreRemove
96     @Override JavaDoc
97     public void preRemove() {
98         FormsListenerBase.insertEntity(CallbackType.PRE_REMOVE, this, this.getClass().getName());
99     }
100
101     /**
102      * Inserts in the lifecycle callback logger that the PostRemove callback
103      * method was called.
104      */

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

115     @PreUpdate
116     @Override JavaDoc
117     public void preUpdate() {
118         FormsListenerBase.insertEntity(CallbackType.PRE_UPDATE, this, this.getClass().getName());
119     }
120
121     /**
122      * Inserts in the lifecycle callback logger that the PostLoad callback
123      * method was called.
124      */

125     @PostLoad
126     @Override JavaDoc
127     public void postLoad() {
128         FormsListenerBase.insertEntity(CallbackType.POST_LOAD, this, this.getClass().getName());
129     }
130
131     /**
132      * Inserts in the lifecycle callback logger that the PostUpdate callback
133      * method was called.
134      */

135     @PostUpdate
136     @Override JavaDoc
137     public void postUpdate() {
138         FormsListenerBase.insertEntity(CallbackType.POST_UPDATE, this, this.getClass().getName());
139     }
140 }
141
Popular Tags