001: // DistrictEC2R.java
002: package org.objectweb.jonas.stests.appli;
003:
004: import org.objectweb.jonas.common.Log;
005: import org.objectweb.util.monolog.api.Logger;
006: import org.objectweb.util.monolog.api.BasicLevel;
007:
008: /**
009: *
010: */
011: public abstract class DistrictEC2R implements javax.ejb.EntityBean {
012:
013: static private Logger logger = null;
014: javax.ejb.EntityContext ejbContext;
015:
016: public java.lang.String ejbCreate(int did, String wid, String name,
017: int order) throws javax.ejb.CreateException {
018: logger.log(BasicLevel.DEBUG, "");
019: setDistrictId(did);
020: setNextOrder(order);
021: setDistrictName(name);
022: setWarehouseId(wid);
023: return null;
024: }
025:
026: public void ejbPostCreate(int did, String wid, String name,
027: int order) {
028: logger.log(BasicLevel.DEBUG, "");
029: }
030:
031: // ------------------------------------------------------------------
032: // Persistent fields
033: //
034: // ------------------------------------------------------------------
035: public abstract int getDistrictId();
036:
037: public abstract void setDistrictId(int id);
038:
039: public abstract int getNextOrder();
040:
041: public abstract void setNextOrder(int o);
042:
043: public abstract String getWarehouseId();
044:
045: public abstract void setWarehouseId(String w);
046:
047: public abstract String getDistrictName();
048:
049: public abstract void setDistrictName(String w);
050:
051: // ------------------------------------------------------------------
052: // Standard call back methods
053: // ------------------------------------------------------------------
054:
055: public void setEntityContext(javax.ejb.EntityContext ctx) {
056: if (logger == null) {
057: logger = Log.getLogger("org.objectweb.jonas_tests");
058: }
059: logger.log(BasicLevel.DEBUG, "");
060: ejbContext = ctx;
061: }
062:
063: public void unsetEntityContext() {
064: logger.log(BasicLevel.DEBUG, "");
065: ejbContext = null;
066: }
067:
068: public void ejbRemove() throws javax.ejb.RemoveException {
069: logger.log(BasicLevel.DEBUG, "");
070: }
071:
072: public void ejbLoad() {
073: logger.log(BasicLevel.DEBUG, "");
074: }
075:
076: public void ejbStore() {
077: logger.log(BasicLevel.DEBUG, "");
078: }
079:
080: public void ejbPassivate() {
081: logger.log(BasicLevel.DEBUG, "");
082: }
083:
084: public void ejbActivate() {
085: logger.log(BasicLevel.DEBUG, "");
086: }
087:
088: public void setNextOrderId(int order) {
089: setNextOrder(order);
090: }
091:
092: /**
093: * Gets the district's next order number
094: *
095: * @throws RemoteException if an RMI exception occurs
096: *
097: * @param increment a boolean. If true, the order number is incremented after
098: * after it is returned. If false, the order number is not incremented.
099: *
100: * @return an int which represents the next order number
101: */
102: public int getNextOrderId(boolean increment) {
103: int temp = getNextOrder();
104: if (increment) {
105: setNextOrder(temp + 1);
106:
107: }
108: logger.log(BasicLevel.DEBUG,
109: "DistrictBean getNextOrderId returns :" + temp);
110: return temp;
111: }
112:
113: }
|