ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | shark List | January 2005 Index

<--  Date Index  --> <--  Thread Index  -->

Please Help -> User Mapping from API Update


Hi Sasa,

Thanks for your help the last time, i sent you my code, i do three things

1. Create two user and put them in a group using the UserGroupAdmin
2. I map these two users to two roles from an xpdl file
3. I then create a process (the process that contains these two roles mapped 
in 2.) and start 
   the process.
    
How do you map that group of two users to that process, i assume there is 
some way before you start the process ?

I attached the .xpdl file, here you will see if i map 
Test_Package_13_Wor1_Par1 -> john 
Test_Package_13_Wor1_Par2 -> paul

then when john logs in and completes the first step "Dori cooks dinner", then 
when paul logs in he should see the
step "Zsolt cooks" 


      
//****************************** 1.  Creating two new users and putting in 
the same group ******************************************

UserGroupAdministration ugAdmin = 
Shark.getInstance().getAdminInterface().getUserGroupAdministration();
ugAdmin.createGroup(groupName,groupDesc);
ugAdmin.createUser("TestGroup", "john", "poshnosh", "Joe Bloggs", 
"Joe.Bloggs@someemailaddress");
ugAdmin.createUser(""TestGroup", "paul", "poshnosh", "Joe Bloggs", 
"Joe.Bloggs@someemailaddress");

//****************************** 2. Mapping of users to roles(from xpdl file) 
*****************************************

MappingAdministration mapAdmin = 
Shark.getInstance().getAdminInterface().getMappingAdministration();
ParticipantMap[] map = mapAdmin.getAllParticipants();
   
   // Now loop through, find the roles you want to map the shark users 
created in 1. above . This gets done twice for john and paul

 for (int i = 0; i < map.length; i++) {
      ParticipantMap indMap = map[i];
      if (indMap.getParticipantId().equalsIgnoreCase(role)) {
         indMap.setUsername("john");
          indMap.setIsGroupUser(true);
                try {
                    mapAdmin.addParticipantMapping(indMap);
                    } catch (Exception e) {
                    // i promise i'll do something :)
          }

}

//************************** 3. Make a connection, create a process and start 
the process **************************

             // Create Connection
SharkConnection conn = Shark.getInstance().getSharkConnection();
conn.connect(userName, "poshnosh" , props.getProperty("enginename"), null); 
SharkConnection conn = wf.getConnection("john" , "poshnosh");

            // Create process and start process
String pkgID = wf.loadPackage("Test_Package_16.xpdl");
String procDefID = "Test_Package_16_Wor2";
WfProcess proc = conn.createProcess(pkgID,procDefID);
proc.start();



// 
*********************************************************************************************************************************

Thanks a million again for all your help with this.

> Gavin O'Driscoll
> 
> pa
123 Buckingham Palace Road, SW1W 9SR
Direct dial: +44 207 881 3724
Mobile: +44 7766 173 990
 <<Test_Package_16.xpdl>> 

Attachment: Test_Package_16.xpdl
Description: Test_Package_16.xpdl



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.