[jboss-user] [jBPM] - Re: IdentityService

Dámaris Suárez do-not-reply at jboss.com
Tue May 10 03:25:06 EDT 2011


Dámaris Suárez [http://community.jboss.org/people/dhamaris] created the discussion

"Re: IdentityService"

To view the discussion, visit: http://community.jboss.org/message/604371#604371

--------------------------------------------------------------
Hello, I just found a way:

ProcessEngine processEngine = new Configuration().buildProcessEngine();
IdentityService id = processEngine.getIdentityService();

Having this in my applicationContext-process:

<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />

And having implemented a class IdentityServiceImpl that basically calls to IdentityService methods:


public class IdentitySessionImpl implements IdentitySession{



          IdentitySession identitySession;


          IdentitySessionImpl()
          {
                    //Load users and groups from the DB
          }
          public IdentitySession getidentitySession()
          {
                    return identitySession;

          }

          public void createUser(String userId, String givenName, String familyName) {
                    identitySession.createUser(userId, givenName, familyName, familyName);
          }



          public User findUserById(String userId) {
                    return identitySession.findUserById(userId);
          }


          public List<User> findUsers() {
                    return identitySession.findUsers();
          }


          public void deleteUser(String userId) {
                    identitySession.deleteUser(userId); 
          }


          public String createGroup(String groupName) {
                    return identitySession.createGroup(groupName, groupName, groupName);
          }


          public String createGroup(String groupName, String groupType) {
                    return identitySession.createGroup(groupName, groupType, groupType);
          }


          public String createGroup(String groupName, String groupType,
                              String parentGroupId) {
                    return identitySession.createGroup(groupName, groupType, parentGroupId);
          }


          public Group findGroupById(String groupId) {
                    return identitySession.findGroupById(groupId);
          }


          public List<Group> findGroupsByUserAndGroupType(String userId,
                              String groupType) {
                    return identitySession.findGroupsByUserAndGroupType(userId, groupType);
          }


          public List<Group> findGroupsByUser(String userId) {
                    return identitySession.findGroupsByUser(userId);
          }




          public void deleteGroup(String groupId) {
                    identitySession.deleteGroup(groupId); 
          }



          public void createMembership(String userId, String groupId, String role) {
                    identitySession.createMembership(userId, groupId, role);
          }


          public void deleteMembership(String userId, String groupId, String role) {
                    identitySession.deleteMembership(userId, groupId, role); 
          }


          public List<User> findUsersByGroup(String groupId) {

                    return identitySession.findUsersByGroup(groupId);
                    // TODO Auto-generated method stub

          }
          public String createUser(String userId, String givenName,
                              String familyName, String businessEmail) {
                    return identitySession.createUser(userId, givenName, familyName, businessEmail);
                    // TODO Auto-generated method stub

          }
          public List<User> findUsersById(String userIds) {

                    return identitySession.findUsersById(userIds);
          }
          public List<User> findUsersById(String... userIds) {
                    // TODO Auto-generated method stub
                    return null;
          }


}


In my cfg.jpdl.xml I just have this:

<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
  <import resource="jbpm.default.cfg.xml" />
  <import resource="jbpm.tx.spring.cfg.xml" />
  <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.bpmn.cfg.xml" />
 <import resource="jbpm.identity.cfg.xml" />
    <import resource="jbpm.businesscalendar.cfg.xml" />
  <import resource="jbpm.console.cfg.xml" />
   <!-- Commented out for dev environment only. -->
  <import resource="jbpm.jobexecutor.cfg.xml" />
   <process-engine-context>
                    <repository-service />
                    <repository-cache />
                    <execution-service />
                    <history-service />
                    <management-service />
                    <identity-service />
                    <task-service />

   <command-service name="txRequiredCommandService">
      <skip-interceptor />
      <retry-interceptor />
      <environment-interceptor />
      <standard-transaction-interceptor />
    </command-service>


    <command-service name="newTxRequiredCommandService">
      <retry-interceptor />
      <environment-interceptor policy="requiresNew" />
      <standard-transaction-interceptor />
    </command-service>
    </process-engine-context>


    <transaction-context>
    <!--<object class="com.playence.platform.services.impl.IdentityServiceImpl" /> -->
    <hibernate-session current="true" />
  </transaction-context>


</jbpm-configuration>


I hope it helps

Dámaris.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/604371#604371]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110510/1d45a658/attachment-0001.html 


More information about the jboss-user mailing list