| Author | Message | 
		
		  | Andy | 
			  
				|  Posted: Wed May 14, 2003 3:36 am    Post subject: [Solved]Suspending a Process |   |  | 
		
		  |  Centurion
 
 
 Joined: 14 May 2003Posts: 122
 
 
 | 
			  
				| Hi, 
 I am using Active X APIs for actvity implementation and want to suspend the curren process and it's parent process.
 
 In BuildTime, I map Parent _PROCESS value to one of the Subprocess container member say sParentProc, this will give me parent process name in the subprocess.
 
 I am inside the Subprocess now and the activity programming logic I follow is:
 
 1.Get the current process name from container member _PROCESS
 2.Get the Parent Process name from container member sParentProc
 3. Create a Process Instance List using filter NAME LIKE <_PROCESS> OR NAME LIKE sParentProc
 4. Loop through the list and use ProcessInstanceObject.Suspend method to suspend both process instances
 5.Delete the Process Instance List
 
 I need comments and suggetions on following:
 
 (a)There should be better method to suspend process through program, in which there is no overhead of creating and deleting Process Instance List.
 (b) Is there way to get the Work Item object from Activity Instance object?If yes then the curren process instance object can be set and suspend would be easier.(Activity Instance object dosnt have method to return current process)
 
 
  Thanks _________________
 
  Andy 
 Last edited by Andy on Sun May 18, 2003 9:00 pm; edited 1 time in total
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jmac | 
			  
				|  Posted: Wed May 14, 2003 5:33 am    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 27 Jun 2001Posts: 3081
 Location: EmeriCon, LLC
 
 | 
			  
				| Andy: 
 a) You dont need to store the parent name you can get this from the current instance there is a parentInstance() method.  You can issue Suspend DEEP i.e suspend(true) on the Parent and that will also suspend any clhildren
 
 b) you must have access to the workitem object already... Or else I don't understand your explanation... give me more details
 _________________
 John McDonald
 RETIRED
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Ratan | 
			  
				|  Posted: Wed May 14, 2003 9:18 am    Post subject: |   |  | 
		
		  |  Grand Master
 
 
 Joined: 18 Jul 2002Posts: 1245
 
 
 | 
			  
				| 
   
	| Quote: |  
	| a) You dont need to store the parent name you can get this from the current instance there is a parentInstance() method. You can issue Suspend DEEP i.e suspend(true) on the Parent and that will also suspend any clhildren
 
 |  
 John,
 
 Should the Control Autonomy not set for the child process to suspend if a Parent process in suspended? I think by default the child process ignore suspend request from a parent process.
 _________________
 -Ratan
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jmac | 
			  
				|  Posted: Wed May 14, 2003 9:41 am    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 27 Jun 2001Posts: 3081
 Location: EmeriCon, LLC
 
 | 
			  
				| Ratan: 
 By default if you Suspend Deep the Parent it will suspend the Child (assuming it is currently running).
 
 The whole issue of these autonomy checkboxes is rather confusing (at least to me,  the doc is)
 _________________
 John McDonald
 RETIRED
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Ratan | 
			  
				|  Posted: Wed May 14, 2003 9:47 am    Post subject: |   |  | 
		
		  |  Grand Master
 
 
 Joined: 18 Jul 2002Posts: 1245
 
 
 | 
			  
				| John, 
 I get it now. I was confused with Supend and Suspend Deep.
 _________________
 -Ratan
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Andy | 
			  
				|  Posted: Wed May 14, 2003 8:35 pm    Post subject: |   |  | 
		
		  |  Centurion
 
 
 Joined: 14 May 2003Posts: 122
 
 
 | 
			  
				| 
   
	| Quote: |  
	| b) you must have access to the workitem object already... Or else I don't understand your explanation... give me more details |  
 John,
 I dont have access to workitem object or I dont find a way to access it. But, I am able to get activity instance object using following Active X APIs:
 
 1.strAIOid=MQWorkflowCtrl1.PersistentOidOfActivityInstance
 (This returns me Oid string of current activity instance, but there is no API to get Oid of work item.)
 2.Set objActivityInstance=MQWorkflowCtrl1.NewActivityInstance
 (just setting new empty object)
 3.lRC = objActivityInstance.PersistentObject(objExecusionService, strAIOid)
 (It would return the actual activity instance object)
 
 According to what I found so far in Active X APIs(Might be I missed something):
 (a)Activity Instance object doesnt have any method which would return current workitem object or current process instance object.
 (b)Only workitem object has method  .ProcessInstance which returns current process instance
 
 Thanks for telling me Suspend Deep option, it will definately help in coding. But still, I need to get current process instance object without creating any list
  . 
 Thanks
 
  _________________
 
  Andy |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jmac | 
			  
				|  Posted: Thu May 15, 2003 7:29 am    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 27 Jun 2001Posts: 3081
 Location: EmeriCon, LLC
 
 | 
			  
				| OK... My problem... you are working at an Activity Instance so you only have access to input and output containers.  You would need to query (as you already know) to get what you need, _________________
 John McDonald
 RETIRED
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Andy | 
			  
				|  Posted: Thu May 15, 2003 8:56 pm    Post subject: |   |  | 
		
		  |  Centurion
 
 
 Joined: 14 May 2003Posts: 122
 
 
 | 
			  
				| 
   
	| Quote: |  
	| you are working at an Activity Instance |  
 I am confused now.
   I used to think that I am working at workitem which is created for users by MQWF. In other words, there is one Activity Instance and number of Work-Items objecs to be created depends on number of users who can access it. User first access the Work Item which in turn access Activity Instance.
 
 Could you please tell the exact difference between these two?
 
 Even if I am working on Activity Instance, should I have not access to the Process Intance. Why only work-Item should have method ProcessInstance()?
 
 I find many methods for Work Item and Activity instance are similiar.
 
 
  Thanks _________________
 
  Andy |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jmac | 
			  
				|  Posted: Fri May 16, 2003 7:36 am    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 27 Jun 2001Posts: 3081
 Location: EmeriCon, LLC
 
 | 
			  
				| Andy: 
 To be 100% accurate you are working at an Activity Implementation which is being run based on a Workitem which was created from the ActivityInstance.  When you are using the Fat client (or any time you are using the start() api) you will be working from an ActivityImplementation under a PEA.
 _________________
 John McDonald
 RETIRED
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |