001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2006 Danet GmbH (www.danet.de), BU BTS.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: ProcessRemoteWrapper.java,v 1.1 2007/05/03 21:58:24 mlipp Exp $
021: *
022: * $Log: ProcessRemoteWrapper.java,v $
023: * Revision 1.1 2007/05/03 21:58:24 mlipp
024: * Internal refactoring for making better use of local EJBs.
025: *
026: */
027: package domain;
028:
029: import java.io.Serializable;
030: import java.rmi.RemoteException;
031: import java.security.Principal;
032: import java.util.Collection;
033: import java.util.Date;
034: import java.util.List;
035: import java.util.Map;
036:
037: import org.mozilla.javascript.Scriptable;
038:
039: import de.danet.an.workflow.api.Activity;
040: import de.danet.an.workflow.api.InvalidKeyException;
041: import de.danet.an.workflow.api.Process;
042: import de.danet.an.workflow.api.ProcessDefinition;
043: import de.danet.an.workflow.apix.ExtProcess;
044: import de.danet.an.workflow.internalapi.ScriptException;
045: import de.danet.an.workflow.omgcore.AlreadyRunningException;
046: import de.danet.an.workflow.omgcore.AlreadySuspendedException;
047: import de.danet.an.workflow.omgcore.CannotChangeRequesterException;
048: import de.danet.an.workflow.omgcore.CannotResumeException;
049: import de.danet.an.workflow.omgcore.CannotStartException;
050: import de.danet.an.workflow.omgcore.CannotStopException;
051: import de.danet.an.workflow.omgcore.CannotSuspendException;
052: import de.danet.an.workflow.omgcore.InvalidDataException;
053: import de.danet.an.workflow.omgcore.InvalidPriorityException;
054: import de.danet.an.workflow.omgcore.InvalidStateException;
055: import de.danet.an.workflow.omgcore.NotRunningException;
056: import de.danet.an.workflow.omgcore.NotSuspendedException;
057: import de.danet.an.workflow.omgcore.ProcessData;
058: import de.danet.an.workflow.omgcore.ResultNotAvailableException;
059: import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
060: import de.danet.an.workflow.omgcore.UpdateNotAllowedException;
061: import de.danet.an.workflow.omgcore.WfAuditEvent;
062: import de.danet.an.workflow.omgcore.WfProcessMgr;
063: import de.danet.an.workflow.omgcore.WfRequester;
064: import de.danet.an.workflow.omgcore.WfExecutionObject.State;
065:
066: /**
067: * This class provides ...
068: *
069: * @author mnl
070: *
071: */
072: public class ProcessRemoteWrapper implements ExtProcess {
073:
074: private VolatileProcess process;
075:
076: /**
077: * Create a new instance with all attributes initialized
078: * to defaults or the given values.
079: *
080: * @param process
081: */
082: public ProcessRemoteWrapper(VolatileProcess process) {
083: super ();
084: this .process = process;
085: }
086:
087: /**
088: * @throws CannotStopException
089: * @throws NotRunningException
090: * @see de.danet.an.workflow.domain.AbstractProcess#abort()
091: */
092: public void abort() throws CannotStopException, NotRunningException {
093: process.abort();
094: }
095:
096: /**
097: * @param state
098: * @return
099: * @throws InvalidStateException
100: * @see de.danet.an.workflow.domain.AbstractProcess#activitiesInState(java.lang.String)
101: */
102: public Collection activitiesInState(String state)
103: throws InvalidStateException {
104: return process.activitiesInState(state);
105: }
106:
107: /**
108: * @param blockActivity
109: * @return
110: * @see de.danet.an.workflow.domain.AbstractProcess#activitiesOfBlockActivity(java.lang.String)
111: */
112: public Collection activitiesOfBlockActivity(String blockActivity) {
113: return process.activitiesOfBlockActivity(blockActivity);
114: }
115:
116: /**
117: * @return
118: * @see domain.VolatileProcess#auditEventBase()
119: */
120: public WfAuditEvent auditEventBase() {
121: return process.auditEventBase();
122: }
123:
124: /**
125: * @param newState
126: * @throws InvalidStateException
127: * @throws TransitionNotAllowedException
128: * @see de.danet.an.workflow.domain.AbstractProcess#changeState(de.danet.an.workflow.omgcore.WfExecutionObject.State)
129: */
130: public void changeState(State newState)
131: throws InvalidStateException, TransitionNotAllowedException {
132: process.changeState(newState);
133: }
134:
135: /**
136: * @param newState
137: * @throws InvalidStateException
138: * @throws TransitionNotAllowedException
139: * @see de.danet.an.workflow.domain.AbstractExecutionObject#changeState(java.lang.String)
140: */
141: public void changeState(String newState)
142: throws InvalidStateException, TransitionNotAllowedException {
143: process.changeState(newState);
144: }
145:
146: /**
147: * @return
148: * @see domain.VolatileProcess#cleanupMode()
149: */
150: public int cleanupMode() {
151: return process.cleanupMode();
152: }
153:
154: /**
155: * @param activity
156: * @param s
157: * @see domain.VolatileProcess#complete(java.lang.Long, de.danet.an.workflow.omgcore.WfExecutionObject.State)
158: */
159: public void complete(Long activity, State s) {
160: process.complete(activity, s);
161: }
162:
163: /**
164: * @return
165: * @see domain.VolatileProcess#createTime()
166: */
167: public Date createTime() {
168: return process.createTime();
169: }
170:
171: /**
172: * @return
173: * @see de.danet.an.workflow.domain.AbstractExecutionObject#debugEnabled()
174: */
175: public boolean debugEnabled() {
176: return process.debugEnabled();
177: }
178:
179: /**
180: * @param channel
181: * @param message
182: * @return
183: * @throws InvalidDataException
184: * @see domain.VolatileProcess#deliverChannelMessage(java.lang.String, java.util.Map)
185: */
186: public boolean deliverChannelMessage(String channel, Map message)
187: throws InvalidDataException {
188: return process.deliverChannelMessage(channel, message);
189: }
190:
191: /**
192: * @return
193: * @see de.danet.an.workflow.domain.AbstractExecutionObject#description()
194: */
195: public String description() {
196: return process.description();
197: }
198:
199: /**
200: * @param obj
201: * @return
202: * @see de.danet.an.workflow.domain.AbstractExecutionObject#equals(java.lang.Object)
203: */
204: public boolean equals(Object obj) {
205: return process.equals(obj);
206: }
207:
208: /**
209: * @param expressionData
210: * @return
211: * @see de.danet.an.workflow.domain.AbstractProcess#evalExpressions(java.lang.Object[][])
212: */
213: public Serializable[] evalExpressions(Object[][] expressionData) {
214: return process.evalExpressions(expressionData);
215: }
216:
217: /**
218: * @param script
219: * @return
220: * @throws ScriptException
221: * @see de.danet.an.workflow.domain.AbstractProcess#evalScript(java.lang.String)
222: */
223: public Serializable evalScript(String script)
224: throws ScriptException {
225: return process.evalScript(script);
226: }
227:
228: /**
229: * @return
230: * @see domain.VolatileProcess#getXPDL()
231: */
232: public String getXPDL() {
233: return process.getXPDL();
234: }
235:
236: /**
237: * @param event
238: * @see de.danet.an.workflow.domain.AbstractProcess#handleAuditEvent(de.danet.an.workflow.omgcore.WfAuditEvent)
239: */
240: public void handleAuditEvent(WfAuditEvent event) {
241: process.handleAuditEvent(event);
242: }
243:
244: /**
245: * @param info
246: * @see de.danet.an.workflow.domain.AbstractProcess#handleTimeout(java.io.Serializable)
247: */
248: public void handleTimeout(Serializable info) {
249: process.handleTimeout(info);
250: }
251:
252: /**
253: * @return
254: * @see de.danet.an.workflow.domain.AbstractExecutionObject#hashCode()
255: */
256: public int hashCode() {
257: return process.hashCode();
258: }
259:
260: /**
261: * @return
262: * @see domain.VolatileProcess#history()
263: */
264: public Collection history() {
265: return process.history();
266: }
267:
268: /**
269: * @return
270: * @see de.danet.an.workflow.domain.AbstractExecutionObject#howClosed()
271: */
272: public State howClosed() {
273: return process.howClosed();
274: }
275:
276: /**
277: * @return
278: * @see de.danet.an.workflow.domain.AbstractProcess#jsScope()
279: */
280: public Scriptable jsScope() {
281: return process.jsScope();
282: }
283:
284: /**
285: * @return
286: * @see de.danet.an.workflow.domain.AbstractExecutionObject#key()
287: */
288: public String key() {
289: return process.key();
290: }
291:
292: /**
293: * @return
294: * @see de.danet.an.workflow.domain.AbstractExecutionObject#lastStateTime()
295: */
296: public Date lastStateTime() {
297: return process.lastStateTime();
298: }
299:
300: /**
301: * @param channel
302: * @return
303: * @see domain.VolatileProcess#lookForMessage(java.lang.String)
304: */
305: public Map lookForMessage(String channel) {
306: return process.lookForMessage(channel);
307: }
308:
309: /**
310: * @return
311: * @see domain.VolatileProcess#manager()
312: */
313: public WfProcessMgr manager() {
314: return process.manager();
315: }
316:
317: /**
318: * @return
319: * @see de.danet.an.workflow.domain.AbstractExecutionObject#name()
320: */
321: public String name() {
322: return process.name();
323: }
324:
325: /**
326: * @return
327: * @see de.danet.an.workflow.domain.AbstractExecutionObject#priority()
328: */
329: public int priority() {
330: return process.priority();
331: }
332:
333: /**
334: * @return
335: * @see domain.VolatileProcess#processContext()
336: */
337: public ProcessData processContext() {
338: return process.processContext();
339: }
340:
341: /**
342: * @return
343: * @see domain.VolatileProcess#processCreator()
344: */
345: public Principal processCreator() {
346: return process.processCreator();
347: }
348:
349: /**
350: * @return
351: * @see domain.VolatileProcess#processDefinition()
352: */
353: public ProcessDefinition processDefinition() {
354: return process.processDefinition();
355: }
356:
357: /**
358: * @return
359: * @throws RemoteException
360: * @see domain.VolatileProcess#removeOnClose()
361: */
362: public boolean removeOnClose() throws RemoteException {
363: return process.removeOnClose();
364: }
365:
366: /**
367: * @return
368: * @see domain.VolatileProcess#requester()
369: */
370: public WfRequester requester() {
371: return process.requester();
372: }
373:
374: /**
375: * @return
376: * @throws ResultNotAvailableException
377: * @see domain.VolatileProcess#result()
378: */
379: public ProcessData result() throws ResultNotAvailableException {
380: return process.result();
381: }
382:
383: /**
384: * @throws CannotResumeException
385: * @throws NotRunningException
386: * @throws NotSuspendedException
387: * @see de.danet.an.workflow.domain.AbstractExecutionObject#resume()
388: */
389: public void resume() throws CannotResumeException,
390: NotRunningException, NotSuspendedException {
391: process.resume();
392: }
393:
394: /**
395: * @param act
396: * @see domain.VolatileProcess#setActivities(java.util.Collection)
397: */
398: public void setActivities(Collection act) {
399: process.setActivities(act);
400: }
401:
402: /**
403: * @param debug
404: * @throws InvalidStateException
405: * @see de.danet.an.workflow.domain.AbstractProcess#setDebugEnabled(boolean)
406: */
407: public void setDebugEnabled(boolean debug)
408: throws InvalidStateException {
409: process.setDebugEnabled(debug);
410: }
411:
412: /**
413: * @param newValue
414: * @see de.danet.an.workflow.domain.AbstractExecutionObject#setDescription(java.lang.String)
415: */
416: public void setDescription(String newValue) {
417: process.setDescription(newValue);
418: }
419:
420: /**
421: * @param newValue
422: * @see de.danet.an.workflow.domain.AbstractExecutionObject#setName(java.lang.String)
423: */
424: public void setName(String newValue) {
425: process.setName(newValue);
426: }
427:
428: /**
429: * @param newValue
430: * @throws InvalidPriorityException
431: * @throws UpdateNotAllowedException
432: * @see de.danet.an.workflow.domain.AbstractExecutionObject#setPriority(int)
433: */
434: public void setPriority(int newValue)
435: throws InvalidPriorityException, UpdateNotAllowedException {
436: process.setPriority(newValue);
437: }
438:
439: /**
440: * @param newValues
441: * @throws InvalidDataException
442: * @throws UpdateNotAllowedException
443: * @see de.danet.an.workflow.domain.AbstractProcess#setProcessContext(de.danet.an.workflow.omgcore.ProcessData)
444: */
445: public void setProcessContext(ProcessData newValues)
446: throws InvalidDataException, UpdateNotAllowedException {
447: process.setProcessContext(newValues);
448: }
449:
450: /**
451: * @param requester
452: * @throws CannotChangeRequesterException
453: * @see domain.VolatileProcess#setRequester(de.danet.an.workflow.omgcore.WfRequester)
454: */
455: public void setRequester(WfRequester requester)
456: throws CannotChangeRequesterException {
457: process.setRequester(requester);
458: }
459:
460: /**
461: * @throws CannotStartException
462: * @throws AlreadyRunningException
463: * @see de.danet.an.workflow.domain.AbstractProcess#start()
464: */
465: public void start() throws CannotStartException,
466: AlreadyRunningException {
467: process.start();
468: }
469:
470: /**
471: * @param due
472: * @param info
473: * @see domain.VolatileProcess#startTimer(java.util.Date, java.io.Serializable)
474: */
475: public void startTimer(Date due, Serializable info) {
476: process.startTimer(due, info);
477: }
478:
479: /**
480: * @return
481: * @see de.danet.an.workflow.domain.AbstractExecutionObject#state()
482: */
483: public String state() {
484: return process.state();
485: }
486:
487: /**
488: * @return
489: * @see domain.VolatileProcess#steps()
490: */
491: public Collection steps() {
492: return process.steps();
493: }
494:
495: /**
496: *
497: * @see domain.VolatileProcess#stopTimers()
498: */
499: public void stopTimers() {
500: process.stopTimers();
501: }
502:
503: /**
504: * @param channel
505: * @param message
506: * @throws InvalidDataException
507: * @see domain.VolatileProcess#submitChannelMessage(java.lang.String, java.util.Map)
508: */
509: public void submitChannelMessage(String channel, Map message)
510: throws InvalidDataException {
511: process.submitChannelMessage(channel, message);
512: }
513:
514: /**
515: * @throws CannotSuspendException
516: * @throws NotRunningException
517: * @throws AlreadySuspendedException
518: * @see de.danet.an.workflow.domain.AbstractExecutionObject#suspend()
519: */
520: public void suspend() throws CannotSuspendException,
521: NotRunningException, AlreadySuspendedException {
522: process.suspend();
523: }
524:
525: /**
526: * @throws CannotStopException
527: * @throws NotRunningException
528: * @see de.danet.an.workflow.domain.AbstractProcess#terminate()
529: */
530: public void terminate() throws CannotStopException,
531: NotRunningException {
532: process.terminate();
533: }
534:
535: /**
536: * @return
537: * @see domain.VolatileProcess#toProcess()
538: */
539: public Process toProcess() {
540: return process.toProcess();
541: }
542:
543: /**
544: * @return
545: * @see de.danet.an.workflow.domain.AbstractProcess#toString()
546: */
547: public String toString() {
548: return process.toString();
549: }
550:
551: /**
552: * @return
553: * @see domain.VolatileProcess#transitionsLocal()
554: */
555: public List transitions() {
556: return process.transitionsLocal();
557: }
558:
559: /**
560: * @return
561: * @see de.danet.an.workflow.domain.AbstractExecutionObject#typedState()
562: */
563: public State typedState() {
564: return process.typedState();
565: }
566:
567: /**
568: * @return
569: * @see de.danet.an.workflow.domain.AbstractProcess#unresolvedRequester()
570: */
571: public WfRequester unresolvedRequester() {
572: return process.unresolvedRequester();
573: }
574:
575: /**
576: * @return
577: * @see de.danet.an.workflow.domain.AbstractExecutionObject#validStates()
578: */
579: public Collection validStates() {
580: return process.validStates();
581: }
582:
583: /**
584: * @return
585: * @see de.danet.an.workflow.domain.AbstractExecutionObject#whileOpen()
586: */
587: public State whileOpen() {
588: return process.whileOpen();
589: }
590:
591: /**
592: * @return
593: * @see de.danet.an.workflow.domain.AbstractExecutionObject#whyNotRunning()
594: */
595: public State whyNotRunning() {
596: return process.whyNotRunning();
597: }
598:
599: /**
600: * @return
601: * @see de.danet.an.workflow.domain.AbstractExecutionObject#workflowState()
602: */
603: public State workflowState() {
604: return process.workflowState();
605: }
606:
607: /* (non-Javadoc)
608: * Comment copied from interface or superclass.
609: */
610: public Activity activityByKey(String key) throws RemoteException,
611: InvalidKeyException {
612: throw new UnsupportedOperationException();
613: }
614:
615: /**
616: * @return
617: * @see de.danet.an.workflow.domain.AbstractProcess#requestingProcess()
618: */
619: public Process requestingProcess() {
620: return process.requestingProcess();
621: }
622:
623: }
|