Re: Activities and Groups

alper alper <[email protected]>
Newsgroups gmane.comp.java.enhydra.shark
Message-ID <[email protected]>
> I could use participants in XPDL that are linked to
> a specific role.
 yes, i am using this (or say similar) approach

> When I load the package and process into Shark, I
> would have to map
> those participant roles to something.  What do you
> map yours to?

you can map participants to user or group in my
application it does not matter. but i prefer to assign
groups to participants because of our implementation
requirements. 

then user fetches activities. After fetching
activities I loop over activities and get
participantName(not username or groupname) for each
activity.
then make categorization based on these
participantNames

here is a simpler version of my code with low error
handling :)) 

by the i will appreciate way any comments/suggestions
on code 

public static void retrieveAssignmentsByRole() {
  SharkInterface si = cClient.getWorkflowServer();  //
getting shark interface
  SharkConnection conn = si.getSharkConnection();
  try {
    conn.connect(username, password, engine, "");
    WfResource wfres = conn.getResourceObject();
    WfAssignment[] wfasss =
wfres.get_sequence_work_item(0);
      for (int i = 0; i < wfasss.length; i++) {
        WfActivity wfa = wfasss[i].activity();
        String[] idss = getIdsFromActivty(wfa);    //
gives packageId,processId,participantId...
        String role = fetchActivityRole(idss[0],
idss[1], idss[2]);
        String roleName = getParticipantName(idss[0],
idss[1],role);
        System.out.println("role = " + role);
        System.out.println("roleName = " + roleName);
      }
    } catch (BaseException e) {
      e.printStackTrace();
    } catch (ConnectFailed connectFailed) {
      connectFailed.printStackTrace();
    } catch (NotConnected notConnected) {
      notConnected.printStackTrace();
    }
  }
}

public static String fetchActivityRole(String pkgId,
String procId, String activityID) {
  Package p = xmlInterface.getPackageById(pkgId);  //
xmlInterface = JaWE.getXMLInterface()
  WorkflowProcess wp = p.getWorkflowProcess(procId);
  Activity a = wp.getActivity(activityID);
  String participant = a.getParticipantID();
  return participant;
}

public static String getParticipantName(String
pkgId,String procId,String partId){
  String pName = "";
  Package pkg = xmlInterface.getPackageById(pkgId);
  Participants participants =
(Participants)pkg.get("Participants");
  if(participants != null){
    Participant participant =
participants.getParticipant(partId);
    if(participant != null) pName =
participant.get("Name").toString();
  }else{
    WorkflowProcess wp =
pkg.getWorkflowProcess(procId);
    participants =
(Participants)wp.get("Participants");
    if(participants != null){
      Participant participant =
participants.getParticipant(partId);
      if(participant != null) pName =
participant.get("Name").toString();
    }
  }
  return pName;
}

--- "Dahl, Greg (BLM) - contr"
<[email protected]> wrote:

> Thanks for the response.  
> I was wondering if you could give me a few more
> details about how you're
> solving your problem.
> 
> After giving it more thought, this is what I thought
> of:
> 
> I could use participants in XPDL that are linked to
> a specific role.
> 
> When I load the package and process into Shark, I
> would have to map
> those participant roles to something.  What do you
> map yours to?  I
> could map them to a "generic" Shark user id that
> actually represents an
> entire group of people.
> 
> I would then have to map my "real" users to one(or
> many) "generic" Shark
> user ids.  Then, my application's code would take
> the "real" user id,
> look up which "generic" id to use (in our own
> database table) and then
> log into Shark with that "generic" id.
> 
> The two problems I see with that solution are:
> 
> 1. What if the user belongs to multiple groups - in
> order to get _all_
> of their work, I've got to loop through all the
> "generic" ids they are
> associated with and make multiple calls into Shark -
> one call for each
> "generic" id.
> 
> 2. It seems to defeat the purpose of having group
> and user/group mapping
> in Shark.  What's the point of having it there if
> you have to do it
> yourself?
> 
> The second question troubles me more.  I think I'm
> missing how something
> should be done, but don't see the obvious solution.
> 
> Using the administration tool, you can statically
> map a participant role
> to a shark group. So, why can't it be done
> dynamically?
> 
> Greg
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
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.