001: /*--
002:
003: Copyright (C) 2002 Anthony Eden.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The names "OBE" and "Open Business Engine" must not be used to
019: endorse or promote products derived from this software without prior
020: written permission. For written permission, please contact
021: me@anthonyeden.com.
022:
023: 4. Products derived from this software may not be called "OBE" or
024: "Open Business Engine", nor may "OBE" or "Open Business Engine"
025: appear in their name, without prior written permission from
026: Anthony Eden (me@anthonyeden.com)./*--
027:
028: Copyright (C) 2002-2005 Adrian Price.
029: All rights reserved.
030:
031: Redistribution and use in source and binary forms, with or without
032: modification, are permitted provided that the following conditions
033: are met:
034:
035: 1. Redistributions of source code must retain the above copyright
036: notice, this list of conditions, and the following disclaimer.
037:
038: 2. Redistributions in binary form must reproduce the above copyright
039: notice, this list of conditions, and the disclaimer that follows
040: these conditions in the documentation and/or other materials
041: provided with the distribution.
042:
043: 3. The names "OBE" and "Open Business Engine" must not be used to
044: endorse or promote products derived from this software without prior
045: written permission. For written permission, please contact
046: adrianprice@sourceforge.net.
047:
048: 4. Products derived from this software may not be called "OBE" or
049: "Open Business Engine", nor may "OBE" or "Open Business Engine"
050: appear in their name, without prior written permission from
051: Adrian Price (adrianprice@users.sourceforge.net).
052:
053: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
054: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
055: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
056: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
057: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
058: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
059: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
060: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
061: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
062: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
063: POSSIBILITY OF SUCH DAMAGE.
064:
065: For more information on OBE, please see
066: <http://obe.sourceforge.net/>.
067:
068: */
069:
070: package org.obe.client.api.xmlrpc;
071:
072: import org.apache.xmlrpc.XmlRpcClient;
073: import org.apache.xmlrpc.XmlRpcException;
074: import org.obe.client.api.WMClient;
075: import org.obe.client.api.WMClientFactory;
076: import org.obe.client.api.base.*;
077: import org.obe.client.api.tool.Parameter;
078: import org.obe.client.api.tool.ToolInvocation;
079: import org.obe.xpdl.model.pkg.XPDLPackage;
080: import org.wfmc.audit.WMAAuditEntryIterator;
081: import org.wfmc.wapi.*;
082: import org.wfmc.wapi2.WMEntity;
083: import org.wfmc.wapi2.WMEntityIterator;
084:
085: import java.io.IOException;
086: import java.net.MalformedURLException;
087: import java.util.Hashtable;
088: import java.util.Vector;
089:
090: /**
091: * Class used to connect to and communicate with a workflow engine
092: * via XML-RPC.
093: * <p/>
094: * <p>This interface is based on the WfMC's Interface 2 Client API
095: * specification. Some of the methods have been modified from the original
096: * specification to fit within the normal design of Java applications. For
097: * instance, the WfMC specification functions always return an error object
098: * (even for success) and uses out parameters to return values. This
099: * interface returns the value and throws an exception when an error occurs.
100: * If no error occurs then an exception is not thrown.
101: *
102: * @author Anthony Eden
103: * @author Adrian Price
104: */
105: public final class WMXmlRpcClient implements WMClient {
106: private XmlRpcClient _client;
107: private int _nextQueryId;
108:
109: public WMXmlRpcClient() {
110: }
111:
112: public String getProtocol() {
113: return WMClientFactory.XML_RPC;
114: }
115:
116: public void connect(WMConnectInfo connectInfo)
117: throws WMWorkflowException {
118: if (_client != null)
119: throw new IllegalStateException("Already connected.");
120: try {
121: _client = new XmlRpcClient(connectInfo.getEngineName());
122: // _client.setBasicAuthentication(connectInfo.getUserIdentification(),
123: // connectInfo.getPassword());
124: } catch (MalformedURLException e) {
125: throw new WMConnectException(e);
126: }
127: }
128:
129: public void disconnect() {
130: if (_client == null)
131: throw new IllegalStateException("Not connected.");
132: _client = null;
133: }
134:
135: public WMProcessDefinitionIterator listProcessDefinitions(
136: WMFilter filter, boolean countFlag)
137: throws WMWorkflowException {
138:
139: Object[] list = openList(filter, countFlag,
140: "listProcessDefinitions");
141: return countFlag ? new WMProcessDefinitionIteratorImpl(
142: list.length)
143: : new WMProcessDefinitionIteratorImpl(list);
144: }
145:
146: public WMProcessDefinitionStateIterator listProcessDefinitionStates(
147: String procDefId, WMFilter filter, boolean countFlag)
148: throws WMWorkflowException {
149:
150: // TODO: pass the procDefId parameter.
151: Object[] list = openList(filter, countFlag,
152: "listProcessDefinitionStates");
153: return countFlag ? new WMProcessDefinitionStateIteratorImpl(
154: list.length)
155: : new WMProcessDefinitionStateIteratorImpl(list);
156: }
157:
158: public void changeProcessDefinitionState(
159: String processDefinitionId,
160: WMProcessDefinitionState newState)
161: throws WMWorkflowException {
162:
163: Vector params = new Vector();
164: params.add(processDefinitionId);
165: params.add(newState.stringValue());
166:
167: // changeProcessDefinitionState
168: // param String The process definition id
169: // param String The new state
170:
171: invoke("changeProcessDefinitionState", params);
172: }
173:
174: public String createProcessInstance(String processDefinitionId,
175: String processInstanceName) throws WMWorkflowException {
176:
177: Vector params = new Vector();
178: params.add(processDefinitionId);
179: params.add(processInstanceName);
180:
181: // createProcessInstance
182: // param String The process definition id
183: // param String The process instance name
184: // returns processInstanceId
185:
186: Hashtable data = invoke("createProcessInstance", params);
187:
188: return (String) data.get("processInstanceId");
189: }
190:
191: public String createProcessInstanceVersioned(String name,
192: String processInstanceName) throws WMWorkflowException {
193:
194: Vector params = new Vector();
195: params.add(name);
196: params.add(processInstanceName);
197:
198: // createProcessInstance
199: // param String The process name
200: // param String The process instance name
201: // returns processInstanceId
202:
203: Hashtable data = invoke("createProcessInstanceVersioned",
204: params);
205:
206: return (String) data.get("processInstanceId");
207: }
208:
209: public String startProcess(String processInstanceId)
210: throws WMWorkflowException {
211:
212: Vector params = new Vector();
213: params.add(processInstanceId);
214:
215: // startProcess
216: // param String The process instance id
217: // returns The new processInstanceId
218:
219: Hashtable data = invoke("startProcess", params);
220:
221: return (String) data.get("processInstanceId");
222: }
223:
224: public void terminateProcessInstance(String processInstanceId)
225: throws WMWorkflowException {
226:
227: Vector params = new Vector();
228: params.add(processInstanceId);
229:
230: // terminateProcessInstance
231: // param String The process instance id
232:
233: invoke("terminateProcessInstance", params);
234: }
235:
236: public WMProcessInstanceStateIterator listProcessInstanceStates(
237: String processInstanceId, WMFilter filter, boolean countFlag)
238: throws WMWorkflowException {
239:
240: // TODO: pass processInstanceId
241: Object[] list = openList(filter, countFlag,
242: "listProcessInstanceStates");
243: return countFlag ? new WMProcessInstanceStateIteratorImpl(
244: list.length) : new WMProcessInstanceStateIteratorImpl(
245: list);
246: }
247:
248: public void changeProcessInstanceState(String processInstanceId,
249: WMProcessInstanceState newState) throws WMWorkflowException {
250:
251: Vector params = new Vector();
252: params.add(processInstanceId);
253: params.add(newState.stringValue());
254:
255: // changeProcessInstanceState
256: // param String The process instance id
257: // param String The new state
258:
259: invoke("changeProcessInstanceState", params);
260: }
261:
262: public WMAttributeIterator listProcessInstanceAttributes(
263: String processInstanceId, WMFilter filter, boolean countFlag)
264: throws WMWorkflowException {
265:
266: Object[] list = openList(filter, countFlag,
267: "listProcessInstanceAttributes");
268: return countFlag ? new WMAttributeIteratorImpl(list.length)
269: : new WMAttributeIteratorImpl(list);
270: }
271:
272: public WMAttribute getProcessInstanceAttributeValue(
273: String processInstanceId, String attributeName)
274: throws WMWorkflowException {
275:
276: Vector params = new Vector();
277: params.add(processInstanceId);
278: params.add(attributeName);
279:
280: // getProcessInstanceAttributeValue
281: // param String The process instance id
282: // param String The attribute name
283: // returns Hashtable The attribute
284:
285: Hashtable data = invoke("getProcessInstanceAttributeValue",
286: params);
287:
288: return new WMAttributeImpl((String) data.get("name"),
289: ((Integer) data.get("type")).intValue(), data
290: .get("value"));
291: }
292:
293: public void assignProcessInstanceAttribute(
294: String processInstanceId, String attributeName,
295: Object attributeValue) throws WMWorkflowException {
296:
297: Vector params = new Vector();
298: params.add(processInstanceId);
299: params.add(attributeName);
300: params.add(attributeValue);
301:
302: // assignProcessInstanceAttribute
303: // param String The process instance id
304: // param String The attribute name
305: // param Integer The attribute type
306: // param Integer The attribute value
307:
308: invoke("assignProcessInstanceAttribute", params);
309: }
310:
311: public WMActivityInstanceStateIterator listActivityInstanceStates(
312: String processInstanceId, String activityInstanceId,
313: WMFilter filter, boolean countFlag)
314: throws WMWorkflowException {
315:
316: Object[] list = openList(filter, countFlag,
317: "listActivityInstanceStates");
318: return countFlag ? new WMActivityInstanceStateIteratorImpl(
319: list.length) : new WMActivityInstanceStateIteratorImpl(
320: list);
321: }
322:
323: public void changeActivityInstanceState(String processInstanceId,
324: String activityInstanceId, WMActivityInstanceState newState)
325: throws WMWorkflowException {
326:
327: Vector params = new Vector();
328: params.add(processInstanceId);
329: params.add(activityInstanceId);
330: params.add(newState.stringValue());
331:
332: // changeActivityInstanceState
333: // param String The process instance id
334: // param String The activity instance id
335: // param String The new state
336:
337: invoke("changeActivityInstanceState", params);
338: }
339:
340: public WMAttributeIterator listActivityInstanceAttributes(
341: String processInstanceId, String activityInstanceId,
342: WMFilter filter, boolean countFlag)
343: throws WMWorkflowException {
344:
345: Object[] list = openList(filter, countFlag,
346: "listActivityInstanceAttributes");
347: return countFlag ? new WMAttributeIteratorImpl(list.length)
348: : new WMAttributeIteratorImpl(list);
349: }
350:
351: public WMAttribute getActivityInstanceAttributeValue(
352: String processInstanceId, String activityInstanceId,
353: String attributeName) throws WMWorkflowException {
354:
355: Vector params = new Vector();
356: params.add(processInstanceId);
357: params.add(activityInstanceId);
358: params.add(attributeName);
359:
360: // getActivityInstanceAttributeValue
361: // param String The process instance id
362: // param String The activity instance id
363: // param String The attribute name
364: // returns Hashtable The attribute
365:
366: Hashtable data = invoke("getActivityInstanceAttributeValue",
367: params);
368:
369: return new WMAttributeImpl((String) data.get("name"),
370: ((Integer) data.get("type")).intValue(), data
371: .get("value"));
372: }
373:
374: public void assignActivityInstanceAttribute(
375: String processInstanceId, String activityInstanceId,
376: String attributeName, Object attributeValue)
377: throws WMWorkflowException {
378:
379: Vector params = new Vector();
380: params.add(processInstanceId);
381: params.add(activityInstanceId);
382: params.add(attributeName);
383: params.add(attributeValue);
384:
385: // assignActivityInstanceAttribute
386: // param String The process instance id
387: // param String The activity instance id
388: // param String The attribute name
389: // param Object The attribute value
390:
391: invoke("assignActivityInstanceAttribute", params);
392: }
393:
394: public WMProcessInstanceIterator listProcessInstances(
395: WMFilter filter, boolean countFlag)
396: throws WMWorkflowException {
397:
398: Object[] list = openList(filter, countFlag,
399: "listProcessInstances");
400: return countFlag ? new WMProcessInstanceIteratorImpl(
401: list.length) : new WMProcessInstanceIteratorImpl(list);
402: }
403:
404: public WMProcessInstance getProcessInstance(String processInstanceId)
405: throws WMWorkflowException {
406:
407: Vector params = new Vector();
408: params.add(processInstanceId);
409:
410: // getProcessInstance
411: // param String The process instance id
412: // returns Hashtable The process instace
413:
414: Hashtable data = invoke("getProcessInstance", params);
415:
416: WMProcessInstanceXmlRpcImpl impl = new WMProcessInstanceXmlRpcImpl();
417: impl.read(data);
418: return impl;
419: }
420:
421: public WMActivityInstanceIterator listActivityInstances(
422: WMFilter filter, boolean countFlag)
423: throws WMWorkflowException {
424:
425: Object[] list = openList(filter, countFlag,
426: "listActivityInstances");
427: return countFlag ? new WMActivityInstanceIteratorImpl(
428: list.length) : new WMActivityInstanceIteratorImpl(list);
429: }
430:
431: public WMActivityInstance getActivityInstance(
432: String processInstanceId, String activityInstanceId)
433: throws WMWorkflowException {
434:
435: Vector params = new Vector();
436: params.add(processInstanceId);
437: params.add(activityInstanceId);
438:
439: // getActivityInstance
440: // param String The process instance id
441: // param String The activity instance id
442: // returns Hashtable The process instace
443:
444: Hashtable data = invoke("getActivityInstance", params);
445:
446: WMActivityInstanceXmlRpcImpl impl = new WMActivityInstanceXmlRpcImpl();
447: impl.read(data);
448: return impl;
449: }
450:
451: public WMWorkItemIterator listWorkItems(WMFilter filter,
452: boolean countFlag) throws WMWorkflowException {
453:
454: Object[] list = openList(filter, countFlag, "listWorkItems");
455: return countFlag ? new WMWorkItemIteratorImpl(list.length)
456: : new WMWorkItemIteratorImpl(list);
457: }
458:
459: public WMWorkItem getWorkItem(String processInstanceId,
460: String workItemId) throws WMWorkflowException {
461:
462: // TODO: implement WAPI.getWorkItem
463: throw new WMUnsupportedOperationException("getWorkItem");
464: }
465:
466: public void completeWorkItem(String processInstanceId,
467: String workItemId) throws WMWorkflowException {
468:
469: // TODO: implement WAPI.completeWorkItem
470: throw new WMUnsupportedOperationException("completeWorkItem");
471: }
472:
473: public WMWorkItemStateIterator listWorkItemStates(
474: String processInstanceId, String workItemId,
475: WMFilter filter, boolean countFlag)
476: throws WMWorkflowException {
477:
478: // TODO: implement WAPI.openWorkItemStatesList
479: throw new WMUnsupportedOperationException(
480: "openWorkItemStatesList");
481: }
482:
483: public void changeWorkItemState(String processInstanceId,
484: String workItemId, WMWorkItemState newState)
485: throws WMWorkflowException {
486:
487: // TODO: implement WAPI.changeWorkItemState
488: throw new WMUnsupportedOperationException("changeWorkItemState");
489: }
490:
491: public void reassignWorkItem(String sourceUser, String targetUser,
492: String processInstanceId, String workItemId)
493: throws WMWorkflowException {
494:
495: // TODO: implement WAPI.reassignWorkItem
496: throw new WMUnsupportedOperationException("reassignWorkItem");
497: }
498:
499: public WMAttributeIterator listWorkItemAttributes(
500: String processInstanceId, String workItemId,
501: WMFilter filter, boolean countFlag)
502: throws WMWorkflowException {
503:
504: Object[] list = openList(filter, countFlag,
505: "listWorkItemAttributes");
506: return countFlag ? new WMAttributeIteratorImpl(list.length)
507: : new WMAttributeIteratorImpl(list);
508: }
509:
510: public WMAttribute getWorkItemAttributeValue(
511: String processInstanceId, String workItemId,
512: String attributeName) throws WMWorkflowException {
513:
514: Vector params = new Vector();
515: params.add(processInstanceId);
516: params.add(attributeName);
517:
518: // getWorkItemAttributeValue
519: // param String The process instance id
520: // param String The work item id
521: // param String The attribute name
522: // returns Hashtable The attribute
523:
524: Hashtable data = invoke("getWorkItemAttributeValue", params);
525:
526: return new WMAttributeImpl((String) data.get("name"),
527: ((Integer) data.get("type")).intValue(), data
528: .get("value"));
529: }
530:
531: public void assignWorkItemAttribute(String processInstanceId,
532: String workItemId, String attributeName,
533: Object attributeValue) throws WMWorkflowException {
534:
535: Vector params = new Vector();
536: params.add(processInstanceId);
537: params.add(workItemId);
538: params.add(attributeName);
539: params.add(attributeValue);
540:
541: // assignWorkItemAttribute
542: // param String The process instance id
543: // param String The work item id
544: // param String The attribute name
545: // param Object The attribute value
546:
547: invoke("assignWorkItemAttribute", params);
548: }
549:
550: // Interface 2 version 2.0e (beta) functions, and other OBE extensions.
551:
552: public boolean isWorkListHandlerProfileSupported() {
553: return true;
554: }
555:
556: public boolean isProcessControlStatusProfileSupported() {
557: return true;
558: }
559:
560: public boolean isProcessDefinitionProfileSupported() {
561: return true;
562: }
563:
564: public boolean isProcessAdminProfileSupported() {
565: return true;
566: }
567:
568: public boolean isActivityControlStatusProfileSupported() {
569: return true;
570: }
571:
572: public boolean isActivityAdminProfileSupported() {
573: return true;
574: }
575:
576: public boolean isEntityHandlerProfileSupported() {
577: return false;
578: }
579:
580: public boolean isAuditRecordProfileSupported() {
581: return false;
582: }
583:
584: public boolean isToolAgentProfileSupported() {
585: return false;
586: }
587:
588: public String createPackage(XPDLPackage pkg)
589: throws WMWorkflowException {
590: // TODO: implement WMClient.createPackage
591: throw new WMUnsupportedOperationException("createPackage");
592: }
593:
594: public void updatePackage(XPDLPackage pkg)
595: throws WMWorkflowException {
596: // TODO: implement WMClient.updatePackage
597: throw new WMUnsupportedOperationException("updatePackage");
598: }
599:
600: public String createPackage(String content, String contentType)
601: throws WMWorkflowException {
602:
603: // TODO: implement WMClient.createPackage
604: throw new WMUnsupportedOperationException("createPackage");
605: }
606:
607: public XPDLPackage getPackage(String packageId)
608: throws WMWorkflowException {
609: // TODO: implement WMClient.getPackage
610: throw new WMUnsupportedOperationException("getPackage");
611: }
612:
613: public String getPackageContent(String packageId, String contentType)
614: throws WMWorkflowException {
615:
616: // TODO: implement WMClient.getPackageContent
617: throw new WMUnsupportedOperationException("getPackageContent");
618: }
619:
620: public void setPackageContent(String packageId, String content,
621: String contentType) throws WMWorkflowException {
622:
623: // TODO: implement WMClient.setPackageContent
624: throw new WMUnsupportedOperationException("setPackageContent");
625: }
626:
627: public void deletePackage(String processDefinitionId)
628: throws WMWorkflowException {
629:
630: // TODO: implement WMClient.deletePackage
631: throw new WMUnsupportedOperationException("deletePackage");
632: }
633:
634: public void changeProcessInstancesState(String processDefinitionId,
635: WMFilter filter, WMProcessInstanceState newState)
636: throws WMWorkflowException {
637:
638: // TODO: implement WAPI.changeProcessInstancesState
639: throw new WMUnsupportedOperationException(
640: "changeProcessInstancesState");
641: }
642:
643: public void deleteProcessInstance(String processInstanceId)
644: throws WMWorkflowException {
645:
646: // TODO: implement WMClient.deleteProcessInstance
647: throw new WMUnsupportedOperationException(
648: "deleteProcessInstance");
649: }
650:
651: public void deleteProcessInstances(String processDefinitionId,
652: WMFilter filter) throws WMWorkflowException {
653:
654: // TODO: implement WMClient.deleteProcessInstances
655: throw new WMUnsupportedOperationException(
656: "deleteProcessInstances");
657: }
658:
659: public void changeActivityInstancesState(
660: String processDefinitionId, String activityDefinitionId,
661: WMFilter filter, WMActivityInstanceState newState)
662: throws WMWorkflowException {
663:
664: // TODO: implement WAPI.changeActivityInstancesState
665: throw new WMUnsupportedOperationException(
666: "changeActivityInstancesState");
667: }
668:
669: public void terminateProcessInstances(String processDefinitionId,
670: WMFilter filter) throws WMWorkflowException {
671:
672: // TODO: implement WAPI.terminateProcessInstances
673: throw new WMUnsupportedOperationException(
674: "terminateProcessInstances");
675: }
676:
677: public void assignProcessInstancesAttribute(
678: String processDefinitionId, WMFilter filter,
679: String attributeName, Object attributeValue)
680: throws WMWorkflowException {
681:
682: // TODO: implement WAPI.assignProcessInstancesAttribute
683: throw new WMUnsupportedOperationException(
684: "assignProcessInstancesAttribute");
685: }
686:
687: public void assignActivityInstancesAttribute(
688: String processDefinitionId, String activityDefinitionId,
689: WMFilter filter, String attributeName, Object attributeValue)
690: throws WMWorkflowException {
691:
692: // TODO: implement WAPI.assignActivityInstancesAttribute
693: throw new WMUnsupportedOperationException(
694: "assignActivityInstancesAttribute");
695: }
696:
697: public void abortProcessInstances(String processDefinitionId,
698: WMFilter filter) throws WMWorkflowException {
699:
700: // TODO: implement WAPI.abortProcessInstances
701: throw new WMUnsupportedOperationException(
702: "abortProcessInstances");
703: }
704:
705: public void abortProcessInstance(String processInstanceId)
706: throws WMWorkflowException {
707:
708: // TODO: implement WAPI.abortProcessInstance
709: throw new WMUnsupportedOperationException(
710: "abortProcessInstance");
711: }
712:
713: //
714: // The following WAPI2 methods have not yet been implemented.
715: //
716:
717: public void invokeApplication(int toolAgentHandle,
718: String applicationName, String procInstId,
719: String workItemId, Object[] parameters, int appMode)
720: throws WMWorkflowException {
721:
722: // TODO: implement WAPI.invokeApplication
723: throw new WMUnsupportedOperationException("invokeApplication");
724: }
725:
726: public WMAttribute[] requestAppStatus(int toolAgentHandle,
727: String procInstId, String workItemId, int[] status)
728: throws WMWorkflowException {
729:
730: // TODO: implement WAPI.requestAppStatus
731: throw new WMUnsupportedOperationException("requestAppStatus");
732: }
733:
734: public void terminateApp(int toolAgentHandle, String procInstId,
735: String workItemId) throws WMWorkflowException {
736:
737: // TODO: implement WAPI.terminateApp
738: throw new WMUnsupportedOperationException("terminateApp");
739: }
740:
741: public String createPackage() throws WMWorkflowException {
742: // TODO: implement WMClient.createPackage
743: throw new WMUnsupportedOperationException("createPackage");
744: }
745:
746: public WMEntity createEntity(WMEntity scopingEntity,
747: String entityClass, String entityName)
748: throws WMWorkflowException {
749:
750: // TODO: implement WAPI2.createEntity
751: throw new WMUnsupportedOperationException("createEntity");
752: }
753:
754: public WMEntityIterator listEntities(WMEntity scopingEntity,
755: WMFilter filter, boolean countFlag)
756: throws WMWorkflowException {
757:
758: // TODO: implement WAPI2.getEntities
759: throw new WMUnsupportedOperationException("getEntities");
760: }
761:
762: public void deleteEntity(WMEntity scopingEntity, String entityId)
763: throws WMWorkflowException {
764:
765: // TODO: implement WAPI2.deleteEntity
766: throw new WMUnsupportedOperationException("deleteEntity");
767: }
768:
769: public WMAttributeIterator listEntityAttributes(
770: WMEntity scopingEntity, String entityId, WMFilter filter,
771: boolean countFlag) throws WMWorkflowException {
772:
773: // TODO: implement WAPI2.getEntityAttributes
774: throw new WMUnsupportedOperationException("getEntityAttributes");
775: }
776:
777: // Spec. says param 3 is a WMEntity... does that really make sense?
778: public WMAttribute getEntityAttributeValue(WMEntity scopingEntity,
779: WMEntity entityHandle, String attributeName)
780: throws WMWorkflowException {
781:
782: // TODO: implement WAPI2.getEntityAttributeValue
783: throw new WMUnsupportedOperationException(
784: "getEntityAttributeValue");
785: }
786:
787: // These methods are for retrieving multi-valued entity attributes.
788: public WMAttributeIterator listEntityAttributeValues(
789: WMEntity scopingEntity, String entityHandle,
790: String attributeName) throws WMWorkflowException {
791:
792: // TODO: implement WAPI2.getEntityAttributeValues
793: throw new WMUnsupportedOperationException(
794: "getEntityAttributeValues");
795: }
796:
797: public void assignEntityAttributeValue(WMEntity entityHandle,
798: String attributeName, int attributeType,
799: String attributeValue) throws WMWorkflowException {
800:
801: // TODO: implement WAPI2.assignEntityAttributeValue
802: throw new WMUnsupportedOperationException(
803: "assignEntityAttributeValue");
804: }
805:
806: public void clearEntityAttributeList(WMEntity entityHandle,
807: String attributeName) throws WMWorkflowException {
808:
809: // TODO: implement WAPI2.clearEntityAttributeList
810: throw new WMUnsupportedOperationException(
811: "clearEntityAttributeList");
812: }
813:
814: public void addEntityAttributeValue(WMEntity entityHandle,
815: String attributeName, int attributeType,
816: String attributeValue) throws WMWorkflowException {
817:
818: // TODO: implement WAPI2.addEntityAttributeValue
819: throw new WMUnsupportedOperationException(
820: "addEntityAttributeValue");
821: }
822:
823: public WMEntity openWorkflowDefinition(String name, String scope)
824: throws WMWorkflowException {
825:
826: // TODO: implement WAPI2.openWorkflowDefinition
827: throw new WMUnsupportedOperationException(
828: "openWorkflowDefinition");
829: }
830:
831: public void closeWorkflowDefinition(
832: WMEntity workflowDefinitionHandle)
833: throws WMWorkflowException {
834:
835: // TODO: implement WAPI2.closeWorkflowDefinition
836: throw new WMUnsupportedOperationException(
837: "closeWorkflowDefinition");
838: }
839:
840: public void deleteProcessDefinition(String processDefinitionId)
841: throws WMWorkflowException {
842:
843: // TODO: implement WAPI2.deleteProcessDefinition
844: throw new WMUnsupportedOperationException(
845: "deleteProcessDefinition");
846: }
847:
848: // Spec. says param 2 is WMTPProcDefinition, but this isn't defined
849: // anywhere. In any case, for consistency it should be the procDefId.
850: public WMEntity openProcessDefinition(String procDefId)
851: throws WMWorkflowException {
852:
853: // TODO: implement WAPI2.openProcessDefinition
854: throw new WMUnsupportedOperationException(
855: "openProcessDefinition");
856: }
857:
858: public void closeProcessDefinition(WMEntity procModelHandle)
859: throws WMWorkflowException {
860:
861: // TODO: implement WAPI2.closeProcessDefinition
862: throw new WMUnsupportedOperationException(
863: "closeProcessDefinition");
864: }
865:
866: public WMEntity addTransition(String procModelId,
867: String sourceActDefId, String targetActDefId)
868: throws WMWorkflowException {
869:
870: // TODO: implement WAPI2.addTransition
871: throw new WMUnsupportedOperationException("addTransition");
872: }
873:
874: public void addProcessDataAttribute(String procModelId,
875: String procDataId, String attributeName, int attributeType,
876: int attributeLength, String attributeValue)
877: throws WMWorkflowException {
878:
879: // TODO: implement WAPI2.addProcessDataAttribute
880: throw new WMUnsupportedOperationException(
881: "addProcessDataAttribute");
882: }
883:
884: public void removeProcessDataAttribute(String procModelId,
885: String procDataId, String attributeName)
886: throws WMWorkflowException {
887:
888: // TODO: implement WAPI2.removeProcessDataAttribute
889: throw new WMUnsupportedOperationException(
890: "removeProcessDataAttribute");
891: }
892:
893: public WMAAuditEntryIterator listAuditEntries(WMFilter filter)
894: throws WMWorkflowException {
895:
896: // TODO: implement WMClient.listAuditEntries
897: throw new WMUnsupportedOperationException("listAuditEntries");
898: }
899:
900: public int deleteAuditEntries(WMFilter filter)
901: throws WMWorkflowException {
902: // TODO: implement WMClient.deleteAuditEntries
903: throw new WMUnsupportedOperationException("deleteAuditEntries");
904: }
905:
906: public ToolInvocation[] executeWorkItem(String procInstId,
907: String workItemId) throws WMWorkflowException {
908:
909: // TODO: implement WMClient.executeWorkItem
910: throw new WMUnsupportedOperationException("executeWorkItem");
911: }
912:
913: public void toolStarted(String procInstId, String workItemId)
914: throws WMWorkflowException {
915:
916: // TODO: implement WMClient.toolStarted
917: throw new WMUnsupportedOperationException("toolStarted");
918: }
919:
920: public void toolFinished(String procInstId, String workItemId,
921: int appStatus, Parameter[] parms)
922: throws WMWorkflowException {
923:
924: // TODO: implement WMClient.toolFinished
925: throw new WMUnsupportedOperationException("toolFinished");
926: }
927:
928: // end WMClient implementation
929:
930: protected int getNextQueryId() {
931: return _nextQueryId++;
932: }
933:
934: protected Hashtable filterToWire(WMFilter filter) {
935: Hashtable data = new Hashtable();
936: data.put("filterType", new Integer(filter.getFilterType()));
937: data.put("filterString", filter.getFilterString());
938: data.put("attributeName", filter.getAttributeName());
939: data.put("comparison", new Integer(filter.getComparison()));
940: return data;
941: }
942:
943: protected Hashtable invoke(String methodName, Vector params)
944: throws WMWorkflowException {
945:
946: try {
947: return (Hashtable) _client.execute(methodName, params);
948: } catch (XmlRpcException e) {
949: throw new WMWorkflowException(e);
950: } catch (IOException e) {
951: throw new WMIOException(e);
952: }
953: }
954:
955: protected Object[] openList(WMFilter filter, boolean countFlag,
956: String method) throws WMWorkflowException {
957:
958: Vector params = new Vector();
959: params.add(filterToWire(filter));
960: params.add(new Boolean(countFlag));
961:
962: Hashtable data = invoke(method, params);
963:
964: return (Object[]) data.get("results");
965: }
966: }
|