| |
Q: | When my process is finished, how can I remove the copy of the package xpdl from internal repository? |
A: | Shark won't remove the packages for which there are process instances in DB (and by standard configuration, finished processes are not removed from DB), or if there are dependences on the package from some other package (External packages XPDL concept). If you want to be able to unload packages, you can do it in two ways:
|
Q: | Does Shark offer any mechanism to store files as part of updating process variables? We also have a requirement to attach files (binary) in a certain activity. |
A: | Shark can't actually use files and move it around file system, but shark can use complex variables (Java classes). I.e., you can define any Java object to be a workflow variable (through the use of XPDL ExternalReference data type), and then use it in shark (of course, this class has to be on shark's classpath). This is how you can store a file but I'm not sure if this makes sence in your use case. |
Q: | Does Shark offer any mechanism to trigger alarms? Say for example when a task does not get completed in a certain time frame. |
A: | There are API methods in ExecutionAdministration interface to check which running processes/activities riched the limits defined in their XPDL definition. By obtaining those process/activity instances, you can implement your client application logic to do what ever you like. |
Q: | Can one activity definition instantiate several instances? |
A: | Yes, several instances can be instantiated based on the same
activity definition, and this can also be in the same process
instance if you have loop defined. However, there can't be two
activity instances (for the same definition) that both have
|
Q: | How to use WfActivity.complete() method? I must call a method offerd by shark to instantiate a process. Shark will instantiate the first activity and complete it if it is automatic model. Then, shark will create the next activity and wait for the client application to perform some actions. When the workitem is finished, should we call the complete method to complete the activity or shark itself will complete the activity and create the next activity instance for us? |
A: | Shark will complete activity automatically only if it is Automatic activity (in XPDL definition these are: Route, SubFlow, Block and Tool activity with Automatic start and finish mode), and if it is manual activity (in XPDL definition this is No implementation activity) or partially manual activity (Tool activity with Manual start and Automatic finish mode), the client has to call WfActivity.complete() method to finish it, and after that shark will create the next activity instance, and so on... |
Q: | I notice that the WfRequester is also used in these APIs. Can you show me an example to understand the WfRequester? |
A: | To understand WfRequester concept, please read OMG specification, and search our mail archive - there are several discussions on WfRequester. |
Q: | What should happen in case all conditions for an XOR-split will evaluate to false? Currently it seems the execution stops there without further notice, causing the process to hang around in the db. Would it be possible to throw an exception in such case, i.e. if the end of condition list is reached? |
A: | You can see in documentation (doc\shark\shark.html) or in default Shark.conf file comments about the entry called: SharkKernel.UnsatisfiedSplitConditionsHandling Using this configuration parameter, you can configure shark kernel how to act in such cases. The possibilities are to ignore it (to stay hanging here), to finish process if possible (if there are no other branches with active activities), and to rollback. The last option is the one you need, so you just have to set this parameter to value ROLLBACK. |
Q: | When the process is instantiated, what will happen? Which activities will be instantiated? Manual or automatic? |
A: | When the process is instantiated, the first activity will be created. If it is the manual activity, shark will stop here, and wait for client application interaction. If the first activity is automatic, it will be executed and the next activity will be created. Generally, when the process starts, or when the client application signals that manual activity is finished, shark will start all activities that come next, and execute the automatic ones until it comes to the next manual activity. |
Q: | How can I get the process instance id and the activity instance id by assignment id? How can I get a worklist of user? |
A: | The assignment Id does not exist in OMG spec. To get a worklist, you just have to call the method getResourceObject() of SharkConnection, and then call method get_sequence_work_item(0) on the WfResource object you get. This method will give you the array of WfAssignment objects. If you want to get the activity of an assignment, you can call method WfAssignment.activity(), and if you want to get the process of assignment's activity, you can do WfAssignment.activity().container(). The activity/process Ids are retrieved by calling key() method on WfActivity/WfProcess. Please look at our ManualTest.java example (in modules\SharkTests\src). |
Q: | WfProcess.get_sequence_work_item(int) doesn't have an offset. If you specify maximum number that is greater then zero, the method will return maximal that number of appropriate objects (i.e.if there are 15 objects, and you specified 10 as max. num., you'll get an array of 10 objects), otherwise, you'll get all possible objects. Doesn't it make sense to have an offset (int max, int offset) as well? . So one can build "result-sets". I can't really imagine a useful example for maximum only. |
A: | Well, these methods are specified by OMG spec, and we have implemented it. An example for getting the maximum value could be getting first 10 assignments, and then when they are executed, another 10, ... but I don't know how much could it be useful. However, if you are using shark's XXXFilterBuilder interface to produce expressions to be used with WfXXXIterator interfaces, there is a possibility to specify an offset as well as the limit. The following code will give you 5 assignments beginning from the 5th one (assignments 5-10) for user "admin": /* SharkConnection sc; AssignmentFilterBuilder fb; */ WMSessionHandle shandle=sc.getSessionHandle(); WfAssignmentIterator ait = sc.get_iterator_assignment(); String selectedUser = "admin"; WMFilter filter = fb.addUsernameEquals(shandle, selectedUser); filter = fb.setStartPosition(shandle, filter, 5); filter = fb.setLimit(shandle, filter, 5); String exp = fb.toIteratorExpression(shandle, filter); ait.set_query_expression(exp); WfAssignment[] ass=ait.get_next_n_sequence(0); |
Q: | How do I find out which activity is accepted, when (date and time) and who accepted it? |
A: | You can find who accepted an activity by AdminMisc.getActivityResourceUsername(shandle,procId,actId). If null is returned, it means that the activity is not accepted. The time when activity has been accepted can be retrieved by calling AdminMisc.getActivityStartedTime(shandle,procId,actId) . |
Q: | Are there diferences between set_result and set_process_context methods from WfActivity? Method set_process_context is working fine in WfProcess. |
A: | Out of the CVS-040416, there have been changes to this methods. WfActivity.set_process_context() is used to update activity variables, but only variables set by WfActivity.set_result() will be updated back to the process (this is how OMG spec. proposes). |
Q: | TERMINATE vs ABORT Working with a WfProcess and reading WfMC documentation, I really cannot understand this: For a process instance, what is the differrence between terminate() and abort() ? For an activity instance, what is the differrence between terminate() and abort() ? |
A: | In OMG docs, it says that it is up to engine how will it implement this operations.In shark, terminating and aborting process is the same.On the other hand, when you terminate activity, process tries to follow to the next activity(s), and if you abort it it doesn't. |
Q: | How to obtain list of processes in a given package provided pkgID? |
A: | You can easily do it by using ProcessFilterBuilder interface along with WfProcessIterator: /* SharkConnection sc; ProcessFilterBuilder fb; */ WMSessionHandle shandle=sc.getSessionHandle(); WfProcessIterator pit = sc.get_iterator_process(); String pkgId="test_js"; WMFilter filter = fb.addPackageIdEquals(shandle, pkgId); String exp = fb.toIteratorExpression(shandle, filter); pit.set_query_expression(exp); WfProcess[] ps=pit.get_next_n_sequence(0); |
Q: | Can each process set a time-out option? If it failed to do in a range of time, then it would fall into some other process? Is that possible to do so in the existing system? |
A: | Yes. You can set a limit (both on process and activity), and
you'll be informed if it expires. Additionally XPDL specification
defines deadlines, which are implementedtoo.See (for limit
example): |
Q: | Does there exist a mechanism for email notification on outstanding workitems? For example, as soon as there is a new workitem for me or a group I belong to, an email is sent to me. How could I implement this feature, if it is not already available? |
A: | Make an implementation of
|
Q: | Subprocess calling We are wondering to apply Enhydra Shark in some applications here. We need to start various asynchronous subprocesses instances from a main source process instance called by a "subflow activity". The question is, how can we find information about which subprocesses were started from the main process? Though they are asynchronous, we should wait for all the subprocesses to complete before we complete the main process.We would like Shark to manage that information automatically, so that we would not have to code it in Java. Does Shark keep information about main processes and their subprocesses? |
A: | Here is explanation how can you find out which asynchronous sub-processes are started from the main process:
Regarding second part of the question, I'm afraid that you have to find a way to model your XPDL in a right way and to make your client application to set some variable in the main process when asynchronous sub-processes are finished, and use that variable in transition condition to allow finishing of the main process. This is something that can't be automatically handled by shark, because shark immediatelly finishes subflow activities after instantiating their asynchronous process, and proceeds to the next XPDL activity. |
Q: | I want to assign one or more Activities to a specific real Shark User and I already know that I can do this with the ParticipantMappingAdministration. But this is not useful in our case, because this mapping is static for defined Process, which means for all Clients, which has started that Process, this specific Assignment will occur. But I want to switch to some Users depending on the Client who has started the Process. Everything clear up to now? If yes ;-) , how can I code this? What's necessary inside XPDL-Declaration? |
A: | You can do it in several ways:
|
Q: | Is there such a state as being assigned and not accepted? My client app will "assign" an activity to a user, but needs to have the user "click" on it to be accepted. Is this scenario possible or is an activity accepted the moment I assign a WfResource to it? |
A: | If you start the shark admin (look at quick start documentation), and try to execute some tasks from the worklist, you can see that you need to accept activity first, and than to complete it, and this is exactly what you need. When activity is created, several assignments to a different users can be created. Each of them can accept activity, and when (s)he does, the other user's assignments become invalid, and they can't accept it or complete an activity. If after some time the user that accepted activity rejects it,the previous user assignments again become valid, and any of them can accept it. |
Q: | I would like of get the value of a variable in each running instance of a process definition. As I know, with
|
A: | You need to call "process_context" method on WfProcess instance to get the whole process context Map. The map keys are variable Ids, and map values are variable values. So, if you i.e. need to get the value of variable "status" which type is String, you can do following: Map m=proc.process_context(); String status=(String)m.get("status"); |
Q: | How can I know which activity is active in a process instance? |
A: | To find out which activity(s) are active, you have a method
on WfActivityIterator ai=proc.get_activities_in_state("open.running"); WfActivity[] acts=ai.get_next_n_sequence(0); gives you all the manual activities that are "accepted" and all the subflow activities that are running (and in the case you defined automatic activity to have manual end it also gives you all the Tool activities that are still running). If you use "open.not_running.not_started", you will get all Manual activities that are still not "accepted". |
Q: | How to get activities of a workflow process? Is there a possibilty to obtain a list of all activities in a workflow or all activities assigned to a specific user? I tried resource.get_sequence_work_item(0) but this only gives the activities/assignments currently assigned to the user after the workflow started. In my application I need to present in an UI all available workflows in an XPDL file. After the user starts a workflow I need to present all activities in this workflow and to mark the activity currently assigned to the user. I would like to avoid parsing the XPDL file. |
A: | Through the usage of shark interface, you can get all activity instances that have ever been created, and that belong to some process instance, or the activity instances that are assigned to a certain user. To get all the activity definitions having the process instance Id, you should do following: 1. Get WMEntity object representing process definition for given processId using AdminMisc.getProcessDefinitionInfo(WMSessionHandle shandle, String procId) 2. Get all WMEntity objects representing activity definitions within given process definition using WMEntityUtilities.getOverallActivities(WMSessionHandle shandle, XPDLBrowser xpdlb, WMEntity wp) where wp is WMEntity retrieved in the first step You can also do it like our Admin application(s) does. It uses shark PackageAdministration interface to get byte[] representions of each XPDL uploaded to shark and uses JaWE to load this definitions, and finally it marks the definitions of currently active activities in the selected process instance definition. |
Q: | You claim to not use an additionnal thread. However, we need some workflow to do processes in the following pattern:
How can i make a process that send a mail at 10 o'clock if there is no thread to do it? Am i supposed to have a scheduler somewhere which will behave like a user and simply will do a given activity on a given workflow at a given moment, or is something already existing in shark for this? |
A: | You can model your activity to have a deadline set to 30
minutes after work is assigned to a user. When you model deadline,
you have to model an exception transition that will lead to the
next activity, which is in your case automatic activity that will
send a mail to the user after deadline happens. If this is
asynchronous deadline, the user's activity won't be terminated,
and if it is synchronous one, it will be terminated. You can read
howto
and look at |
Q: | Accessing process variables via activity tools I created an XPDL that spawns subworkflows asynchronously for many users (the list of users is passed in). The last activity (after the sub-flows in the main-flow) waits until a deadline is reached (this actually works fine), however, I want to be able to alter a variable that the waiting activity uses to evaluate the deadline. Here is what the deadline expression says: d=new java.util.Date(); sdf=new java.text.SimpleDateFormat("MM/dd/yyyy h:mm a"); d=sdf.parse(expireDate_global); if (allCompleted.booleanValue()) d=new java.util.Date(System.currentTimeMillis()); d; I also had d=new java.util.Date(); sdf=new java.text.SimpleDateFormat("MM/dd/yyyy h:mm a"); d=sdf.parse(expireDate_global); if (allCompleted) d=new java.util.Date(System.currentTimeMillis()); d; "allCompleted" is a WRD. I understand that this activity has its own context/copy of the variables and that it is already started. I don't want to do callbacks to Shark from the XPDL script/tool to force this last activity to complete.Are there any new developments that address this issue? Is there a better way of accomplishing this? Currently, can an activity "re-evaluate" the variables? On a side note, if I use a circular transition and the process transitions back to the activity, will the variables be"refreshed"? If so, will the circular transition create a new activity or will it just update the original one? |
A: | You should specify shark's configuration parameter Deadlines.useProcessContext to true. When set to true, this parameter tells kernel to use process context while re-evaluating deadlines. |
Q: | Extended attribute and activity start mode. I noticed that the "specrelease" example process uses the "VariablToProcess_UPDATE" name. What is this used for? What is the difference between "VariableToProcess_VIEW" and "VariablToProcess_UPDATE". |
A: | The extended attributes "VariableToProcess_X" are used to indicate which workflow data should be changed in all examples. From these values within an activity, the gui knows which workflow data should be updated (VariableToProcess_UPDATE) or presented to the user for review (VariableToProcess_VIEW). This is not standard shark behaviour, it's just the way the guys from shark implemented it in their examples and in the gui. If i don't use these "Variable...." (by the way you can name it whatever you want in your app), then i need to know what to change by programming (hard-wiring) it in my code that uses and changes these activities. Using these extended attributes one can define within the activity definition what should be changed or presented, and the code just reads these extended attributes and prompts the user for review and/or new values. |