RE: User to participant mapping

"Neville van Deventer" <[email protected]>
Newsgroups gmane.comp.java.enhydra.shark
Message-ID <[email protected]>
Hi Greg, 

I'm not sure how you want to get your mappings, but this is how I'm doing it
..

	/**
	 * Internal gets a list of All Participants, or unmapped
Participants.
	 * 
	 * @param All True - Return ALL Participants, False - Return
UnMapped Participants.  
	 * @return Vector containing SharkParticipant Entities.
	 */
	private static Vector sharkParticipants( boolean All ) {
		Vector retVector = new Vector();
		try {
			ParticipantMap[] allParticipants =
sharkAdmin.getParticipantMappingAdministration().getAllParticipants();
			for(int i=0;i<allParticipants.length;i++){
				try {
					ParticipantMap[] pc =
sharkAdmin.getParticipantMappingAdministration().getParticipantMappings(
allParticipants[i].getPackageId(),
allParticipants[i].getProcessDefinitionId(),
allParticipants[i].getParticipantId() );
					if(pc.length == 0 || (pc.length > 0
&& All))
						retVector.add(
sharkParticipantInfoFromXPDL( new SharkParticipant(
allParticipants[i].getPackageId(),
allParticipants[i].getProcessDefinitionId(),
allParticipants[i].getParticipantId() ) ) );
				} catch (BaseException e1) {
				}
			}
		} catch (BaseException e) {
		}
		return retVector;
	}

I Hope this Helps, Some Variables in this function are global,
	sharkAdmin = sharkInstance.getAdminInterface();
And
	sharkParticipantInfoFromXPDL is another function which just get the
participants from the Loaded XDPL.


As for Assignments, once you have the assignment, (It's probably a manual
start), the assignment needs to be accepted, and then completed for the
Workflow to continue..
Something like this

	WfAssignment[] ass =
sConn.getResourceObject().get_sequence_work_item( 0 );
	for(int i=0;i<ass.length;i++) {
		if( ass[i].activity().key().equals( activity_key_to_accept )
) {
			if( !ass[i].get_accepted_status() )
				ass[i].set_accepted_status( true );
		}
	}
Or something like this
	
Shark.getInstance().getAdminInterface().getExecutionAdministration().getAssi
gnment( package_id, process_id, assignment_id ).set_accepted_status( true );


Then you need to do whatever needs to be done (Change Variables, calculate
something, etc...), and complete the assignment for the Workflow to continue
..

Something Like

	WfAssignment[] ass =
sConn.getResourceObject().get_sequence_work_item( 0 );
	for(int i=0;i<ass.length;i++) { // Lets find the Assignment
		if( ass[i].activity().key().equals( activity_key_to_complete
)) {
		    Map messageData = null;
			try {  // Update Variables if Needed
				messageData =
ass[i].activity().process_context();
				if( messageData.containsKey( "SomeVariable"
) ){
				    messageData.put("SomeVariable", "I've
Calculated this for you now Continue" );
				}
				// Set the new Context
			    ass[i].activity().set_process_context(
messageData );
			} catch (Exception e) {}

			// Complete the Activity so the workflow Continues
			ass[i].activity().complete();
			// Get The Result
			messageData = ass[i].activity().process_context();
		}
	}

There are probably a few other methods, but this is how I do it ...


Hope this helps a bit


Neville van Deventer


-----Original Message-----
From: Dahl, Greg (BLM) - contr [mailto:[email protected]] 
Sent: 25 July 2005 10:09 PM
To: [email protected]
Subject: [shark] User to participant mapping

I'm mapping my participants to a Shark Group.  Given an instantiated
workflow activity, is there anyway to see what group it is mapped to?

Given an assignment for the user, I can get the Activity and the process,
but I can't figure out where to go from there.

Any hints?

Thanks
Greg
******* Confidentiality Notice *******
This email, its electronic document attachments, and the contents of its
website linkages may contain confidential health information.  This
information is intended solely for use by the individual or entity to whom
it is addressed.  If you have received this information in error, please
notify the sender immediately and arrange for the prompt destruction of the
material and any accompanying attachments.
message-footer.txt (text/plain, 271 B)
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.