KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > stests > appli > DistrictEC2R


1 // DistrictEC2R.java
2
package org.objectweb.jonas.stests.appli;
3
4 import org.objectweb.jonas.common.Log;
5 import org.objectweb.util.monolog.api.Logger;
6 import org.objectweb.util.monolog.api.BasicLevel;
7
8 /**
9  *
10  */

11 public abstract class DistrictEC2R implements javax.ejb.EntityBean JavaDoc {
12
13     static private Logger logger = null;
14     javax.ejb.EntityContext JavaDoc ejbContext;
15
16  
17     public java.lang.String JavaDoc ejbCreate(int did, String JavaDoc wid, String JavaDoc name, int order)
18         throws javax.ejb.CreateException JavaDoc{
19         logger.log(BasicLevel.DEBUG, "");
20         setDistrictId(did);
21         setNextOrder(order);
22         setDistrictName(name);
23         setWarehouseId(wid);
24         return null;
25     }
26
27     public void ejbPostCreate(int did, String JavaDoc wid, String JavaDoc name, int order) {
28         logger.log(BasicLevel.DEBUG, "");
29     }
30
31     // ------------------------------------------------------------------
32
// Persistent fields
33
//
34
// ------------------------------------------------------------------
35
public abstract int getDistrictId();
36     public abstract void setDistrictId(int id);
37
38     public abstract int getNextOrder();
39     public abstract void setNextOrder(int o);
40
41    public abstract String JavaDoc getWarehouseId();
42     public abstract void setWarehouseId(String JavaDoc w);
43
44     public abstract String JavaDoc getDistrictName();
45     public abstract void setDistrictName(String JavaDoc w);
46
47     // ------------------------------------------------------------------
48
// Standard call back methods
49
// ------------------------------------------------------------------
50

51  
52     public void setEntityContext(javax.ejb.EntityContext JavaDoc ctx) {
53         if (logger == null) {
54             logger = Log.getLogger("org.objectweb.jonas_tests");
55         }
56         logger.log(BasicLevel.DEBUG, "");
57         ejbContext = ctx;
58     }
59
60
61     public void unsetEntityContext() {
62         logger.log(BasicLevel.DEBUG, "");
63         ejbContext = null;
64     }
65
66     public void ejbRemove() throws javax.ejb.RemoveException JavaDoc {
67         logger.log(BasicLevel.DEBUG, "");
68     }
69
70  
71     public void ejbLoad() {
72         logger.log(BasicLevel.DEBUG, "");
73     }
74
75
76     public void ejbStore() {
77         logger.log(BasicLevel.DEBUG, "");
78     }
79         
80
81     public void ejbPassivate() {
82         logger.log(BasicLevel.DEBUG, "");
83     }
84
85
86     public void ejbActivate() {
87         logger.log(BasicLevel.DEBUG, "");
88     }
89
90     public void setNextOrderId(int order) {
91         setNextOrder(order);
92     }
93     /**
94      * Gets the district's next order number
95      *
96      * @throws RemoteException if an RMI exception occurs
97      *
98      * @param increment a boolean. If true, the order number is incremented after
99      * after it is returned. If false, the order number is not incremented.
100      *
101      * @return an int which represents the next order number
102      */

103     public int getNextOrderId(boolean increment) {
104         int temp = getNextOrder();
105         if (increment) {
106             setNextOrder(temp+1);
107  
108         }
109         logger.log(BasicLevel.DEBUG,"DistrictBean getNextOrderId returns :"+temp);
110     return temp;
111   }
112
113 }
114
115
116
117
Popular Tags