-
1. jbpm 3.x to 5 migration path
salaboy21 Mar 17, 2011 11:10 AM (in response to sasir)Hi Sasi,
Yes Eric was working on that.. I think that we will be able to answer your question better.
As far as I know you can plug in jBPM5 you identity module, obviously not using the same classes that were used in jBPM3 but using the new ones you should be able to do the same work. If you already have your process defined you should use expressions to resolve your users assignments.
Can you share with us what kind of logic do you have implemented? so we can create an example about how to do it in jBPM5.
Greetings.
-
2. jbpm 3.x to 5 migration path
sasir Mar 17, 2011 12:06 PM (in response to salaboy21)Thanks Salatino for replying. We have a web application and in the startup we are laoding the users and groups mappings from external source and are using that information while getting the groups related to users, and the specific roles, etc
I see that we have classes under org.jbpm.userprofile package but they look into the underlying task server DB as per my understanding.
How can the case be implemented where in we create the user mappings from external source data
*****************Sampel code***************************
JbpmConfiguration jbpmConfiguration = null;
JbpmContext jbpmContext = null;
try{
jbpmConfiguration = JbpmConfiguration.parseResource("jbpm.cfg.xml");
jbpmContext = jbpmConfiguration.createJbpmContext();
/*
Creating groups and users
*/
IdentitySession identitySession = new IdentitySession(jbpmContext.getSession());
java.util.List userList = new java.util.ArrayList();
java.util.List userListIs = identitySession.getUsers();
for (int i=0;i<userListIs.size(); i++) {
User user = (User)userListIs.get(i);
userList.add(user.getName());
}
jbpmContext.getSession().flush();
//Transaction transaction = jbpmContext.getSession().beginTransaction();
System.out.println("################## Loading Test users and Groups #################");
Group CA_ANALYST = identitySession.getGroupByName("CA_ANALYST");
if(CA_ANALYST == null){
identitySession.saveEntity(new Group("CA_ANALYST"));transactionCommit = true;
}if(!userList.contains("analyst1")){
User analystUser = new User("analyst");
adminUser.setEmail("user.admin@company.com");
adminUser.setPassword("analyst");
identitySession.saveEntity(analystUser);
identitySession.saveEntity(Membership.create(identitySession.getUserByName("analyst"),identitySession.getGroupByName("CA_ANALYST")));
transactionCommit = true;
}System.
out.println("################## Done Loading Test users and Groups! #################");
catch}
(Exception e) {
while (t.getCause() != nulle.printStackTrace();
Throwable t = e;
) {
finallyt = t.getCause();
}
}
{
jbpmContext.close();
}
public static List getRolesUserBelongingTo(String userName,JbpmContext jbpmContext){
List rolesList = new ArrayList();
try{
IdentitySession identitySession = new IdentitySession(jbpmContext.getSession());
User user = identitySession.getUserByName(userName);
Set roleSet = user.getMemberships();
if(roleSet != null){
Iterator iter = roleSet.iterator();
while (iter.hasNext()) {
Membership membership = (Membership) iter.next();
String role = membership.getRole();
if(role != null){
rolesList.add(role);
}
}
}
//identitySession.close();
}catch(Exception ex){
ex.printStackTrace();
}
return rolesList;
}
-
3. jbpm 3.x to 5 migration path
salaboy21 Mar 17, 2011 12:39 PM (in response to sasir)Did you check : https://github.com/krisv/jbpm/blob/master/jbpm-human-task/src/test/java/org/jbpm/userprofile/UserProfileManagerTest.java ?
Are you looking for something like that right?
Greetings
-
4. jbpm 3.x to 5 migration path
sasir Mar 17, 2011 12:46 PM (in response to salaboy21)Thanks for the link. I am looking for something similar which can be used with external data sources. Are you suggesting to use these or do we have any other usage examples
-
5. jbpm 3.x to 5 migration path
salaboy21 Mar 17, 2011 12:53 PM (in response to sasir)That's right. Depending on where do you have your user/identity information is how you can implement a similar mechanism to the one showed in the test case.
Greetings
-
6. jbpm 3.x to 5 migration path
sasir Mar 17, 2011 2:42 PM (in response to salaboy21)Definitely it will help in implementation but it is file based and dont want to go taht route. If i want to use in a j2ee application and want to load the data only in startup, whats the suggested way if i dont want to rely on DB/file
?
-
7. jbpm 3.x to 5 migration path
salaboy21 Mar 17, 2011 9:27 PM (in response to sasir)The implementation in the test is a simple implementation to show how to do the work, but you must implement it using the mechanisms that you trust, just implementing the interfaces there.
If you want to code a J2EE solution you can do it if you know how to configure users and identity components in those environments. That topic is not related with jBPM and it's mostly about the technology that you want to use to manage identities. After that you can integrate the solution that you choose with jbpm very quickly.
Greetings.
-
8. jbpm 3.x to 5 migration path
sasir Mar 21, 2011 1:25 PM (in response to salaboy21)one quick question..I see that we are stroing details of entities in ORGANIZATIONALENTITY table whether its a user or group. Where do we store additioanl details of the user/group like email details and other id's. Are we expected to manage them using our own tables or Does JBPM schema supports it?
-
9. jbpm 3.x to 5 migration path
salaboy21 Mar 21, 2011 1:34 PM (in response to sasir)jBPM should handle just and ID. In theory you already have all the user information in a different storage: LDAP, Service Directory, your own database. Unless you start a project from the scratch and the company don't have a user identity storage you can create your own tables and handle them there. jBPM will just persist an ID in order to delegate the identity management.
Greetings.
-
10. jbpm 3.x to 5 migration path
sasir Mar 21, 2011 1:52 PM (in response to salaboy21)But how does jBPM engine gets all the info of users/groups/roles while delegating tasks? Does it cache the information while start up? Can you please point me to the right location in the code on where it is happening
-
11. jbpm 3.x to 5 migration path
salaboy21 Mar 21, 2011 2:08 PM (in response to sasir)take a look at this implementation. You can follow that ideas: