001: /* WfAssignmentIteratorSSBean.java */
002: package org.enhydra.shark.ejb;
003:
004: import java.rmi.RemoteException;
005:
006: import javax.ejb.EJBException;
007: import javax.ejb.EJBObject;
008: import javax.ejb.SessionBean;
009: import javax.ejb.SessionContext;
010: import javax.naming.Context;
011: import javax.naming.InitialContext;
012: import javax.rmi.PortableRemoteObject;
013:
014: import org.enhydra.shark.api.client.wfmodel.WfAssignment;
015: import org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator;
016:
017: /**
018: * @ejb.bean
019: * name="WfAssignmentIteratorSS"
020: * type="Stateful"
021: * display-name="WfAssignmentIterator"
022: * jndi-name="org/enhydra/shark/ejb/WfAssignmentIteratorSS"
023: * local-jndi-name="org/enhydra/shark/ejb/WfAssignmentIteratorSSLocal"
024: * transaction-type="Container"
025: * view-type="both"
026: * local-business-interface="org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator"
027: *
028: * @ejb.ejb-ref ejb-name="WfAssignmentSS"
029: * view-type="both"
030: * ref-name="org/enhydra/shark/ejb/WfAssignmentSS"
031: *
032: * @ejb:interface
033: * extends="org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator,javax.ejb.EJBObject"
034: *
035: * @ejb:transaction
036: * type="Required"
037: *
038: * @jonas:bean
039: * ejb-name="WfAssignmentIteratorSS"
040: * jndi-name="org/enhydra/shark/ejb/WfAssignmentIteratorSS"
041: *
042: * OMG definition: The WfAssignmentIterator interface specializes the WfBase::BaseIterator
043: * interface and adds WfAssignment specific operations.
044: * <p>
045: * We extended OMG's interface by duplicating methods, and adding additional parameter
046: * that represents transaction. If you use methods without SharkTransaction parameter, the
047: * transaction will be implicitly created, and if you use it with SharkTransaction
048: * parameter you must obey to some rules explained in HowTo documentation.
049: * <p>
050: * Also, look at our implementation API documentation of this interface to see which
051: * attributes can be used in query expressions.
052: *
053: * @author V.Puskas
054: * @author S.Bojanic
055: * @author T.Jovanovic
056: * @version 0.1
057: */
058: public abstract class WfAssignmentIteratorSSBean extends
059: BaseIteratorSSBean implements WfAssignmentIterator, SessionBean {
060:
061: private SessionContext context;
062:
063: /**
064: * @ejb:interface-method
065: * view-type="both"
066: */
067: public WfAssignment get_next_object() throws Exception {
068: WfAssignment wfshark = ((WfAssignmentIterator) sharkObj)
069: .get_next_object();
070: WfAssignmentSS wf = null;
071: try {
072: Context initialContext = EJBJNDIContext.getInstance()
073: .getInitialContext();
074: wf = ((org.enhydra.shark.ejb.WfAssignmentSSHome) PortableRemoteObject
075: .narrow(
076: initialContext
077: .lookup("org/enhydra/shark/ejb/WfAssignmentSS"),
078: org.enhydra.shark.ejb.WfAssignmentSSHome.class))
079: .create(wfshark);
080: return (WfAssignmentSS) wf.getPassedEJBObject();
081: } catch (Exception ex) {
082: throw new EJBException(ex);
083: }
084: }
085:
086: /**
087: * @ejb:interface-method
088: * view-type="both"
089: */
090: public WfAssignment get_previous_object() throws Exception {
091: WfAssignment wfshark = ((WfAssignmentIterator) sharkObj)
092: .get_previous_object();
093: WfAssignmentSS wf = null;
094: try {
095: Context initialContext = EJBJNDIContext.getInstance()
096: .getInitialContext();
097: wf = ((org.enhydra.shark.ejb.WfAssignmentSSHome) PortableRemoteObject
098: .narrow(
099: initialContext
100: .lookup("org/enhydra/shark/ejb/WfAssignmentSS"),
101: org.enhydra.shark.ejb.WfAssignmentSSHome.class))
102: .create(wfshark);
103: return (WfAssignmentSS) wf.getPassedEJBObject();
104: } catch (Exception ex) {
105: throw new EJBException(ex);
106: }
107: }
108:
109: /**
110: * @ejb:interface-method
111: * view-type="both"
112: */
113: public WfAssignment[] get_next_n_sequence(int max_number)
114: throws Exception {
115: WfAssignment[] wfsshark = ((WfAssignmentIterator) sharkObj)
116: .get_next_n_sequence(max_number);
117: WfAssignmentSSHome home = null;
118: InitialContext initialContext = EJBJNDIContext.getInstance()
119: .getInitialContext();
120: home = (WfAssignmentSSHome) PortableRemoteObject
121: .narrow(
122: initialContext
123: .lookup("org/enhydra/shark/ejb/WfAssignmentSS"),
124: org.enhydra.shark.ejb.WfAssignmentSSHome.class);
125: int len = wfsshark.length;
126: WfAssignmentSS[] remotes = new WfAssignmentSS[len];
127: for (int i = 0; i < len; i++) {
128: remotes[i] = (WfAssignmentSS) (home.create(wfsshark[i]))
129: .getPassedEJBObject();
130: }
131: return remotes;
132: }
133:
134: /**
135: * @ejb:interface-method
136: * view-type="both"
137: */
138: public WfAssignment[] get_previous_n_sequence(int max_number)
139: throws Exception {
140: WfAssignment[] wfsshark = ((WfAssignmentIterator) sharkObj)
141: .get_previous_n_sequence(max_number);
142: WfAssignmentSSHome home = null;
143: InitialContext initialContext = EJBJNDIContext.getInstance()
144: .getInitialContext();
145: home = (WfAssignmentSSHome) PortableRemoteObject
146: .narrow(
147: initialContext
148: .lookup("org/enhydra/shark/ejb/WfAssignmentSS"),
149: org.enhydra.shark.ejb.WfAssignmentSSHome.class);
150: int len = wfsshark.length;
151: WfAssignmentSS[] remotes = new WfAssignmentSS[len];
152: for (int i = 0; i < len; i++) {
153: remotes[i] = (WfAssignmentSS) (home.create(wfsshark[i]))
154: .getPassedEJBObject();
155: }
156: return remotes;
157: }
158:
159: /**
160: * @ejb.interface-method
161: * view-type="both"
162: **/
163: public EJBObject getPassedEJBObject() throws EJBException {
164: try {
165: return context.getEJBObject();
166: } catch (Exception ex) {
167: throw new EJBException(ex);
168: }
169: }
170:
171: public void setSessionContext(SessionContext ctx)
172: throws EJBException, RemoteException {
173: context = ctx;
174: }
175:
176: /**
177: * @ejb:create-method
178: */
179: public void ejbCreate(
180: org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator iter) {
181: sharkObj = iter;
182: }
183:
184: /* (non-Javadoc)
185: * @see javax.ejb.SessionBean#ejbActivate()
186: */
187: public void ejbActivate() throws EJBException, RemoteException {
188: }
189:
190: /* (non-Javadoc)
191: * @see javax.ejb.SessionBean#ejbPassivate()
192: */
193: public void ejbPassivate() throws EJBException, RemoteException {
194: }
195:
196: /* (non-Javadoc)
197: * @see javax.ejb.SessionBean#ejbRemove()
198: */
199: public void ejbRemove() throws EJBException, RemoteException {
200: }
201: }
|