JBoss Community

Re: Jbpm 5.3 JPA2 Jboss 7.1.1 table "dbo.OrganizationalEntity", column 'id'.

created by Ted Pan in jBPM - View the full discussion

you need to add the user to takservice by using the following code




Properties userGroups = new Properties();



userGroups.setProperty("john", "user");



UserGroupCallbackManager manager = UserGroupCallbackManager.getInstance();



manager.setCallback(new DefaultUserGroupCallbackImpl(userGroups));

 

or implement a an UserGroupCallback. Then

 

 

        UserGroupCallbackManager manager = UserGroupCallbackManager

                .getInstance();

        if (!manager.existsCallback()) {

            UserGroupCallback userGroupCallback = new JBPMUserGroupCallback();

            manager.setCallback(userGroupCallback);

        }

 

 

this is the callback implementation:

 

public class JBPMUserGroupCallback implements UserGroupCallback {

 

    @Override

    public boolean existsGroup(String groupId) {

        return true;

    }

 

    @Override

    public boolean existsUser(String userId) {

        return true;

    }

 

    @Override

    public List<String> getGroupsForUser(String userId, List<String> groupIds,

            List<String> allExistingGroupIds) {

         if(groupIds != null) {

 

                List<String> retList = new ArrayList<String>(groupIds);

 

                // merge all groups

 

                if(allExistingGroupIds != null) {

 

                    for(String grp : allExistingGroupIds) {

 

                        if(!retList.contains(grp)) {

 

                            retList.add(grp);

 

                        }

 

                    }

 

                }

 

                return retList;

 

            } else {

                    //

                // return empty list by default

                    //please note: there are different return value for different version of jPBM

                 //List<String> retList = new ArrayList<String>();

                

                 //retList.add("user");

                 //return retList;

                //return new ArrayList<String>();   //for jBPM5.3.0.Final

                return null;      //for jBPM5.4.0.CR1

 

            }

 

    }

 

}

Reply to this message by going to Community

Start a new discussion in jBPM at Community