-
1. Re: IdentityService
tejjbpm Nov 25, 2009 8:47 AM (in response to tejjbpm)Sorry missed the get id in the code part while editing..
identityService.deleteMembership(identityService.findUserById("testuser")).getId(), identityService.findGroupById("testgroup").getId(),null); // userid,groupid,roleid
-
2. Re: IdentityService
kukeltje Nov 25, 2009 5:03 PM (in response to tejjbpm)do you have a *small* unittest?
-
3. Re: IdentityService
tejjbpm Nov 26, 2009 4:08 AM (in response to tejjbpm)has anybody used deletemembership at all? I tried passing the dbid or the groupname..neither seem to delete it..both gives the same error...
I have to stick with plain JDBC? -
4. Re: IdentityService
tejjbpm Nov 26, 2009 4:16 AM (in response to tejjbpm)@kukeltje - I will try to post a small testcase soon...
-
5. Re: IdentityService
jelies Aug 20, 2010 8:41 AM (in response to tejjbpm)Do you solved the problem? I'm getting the same error when I call deleteMembership(). How we have to use deleteMembership method?
Thanks!
PS: I'm currently using jbpm 4.4
-
6. Re: IdentityService
dhamaris May 3, 2011 8:08 AM (in response to jelies)How did you have configured your IdentityService? I cannot even initialize mine!
I'm currently using jbpm 4.4 and I put this in my configuration:
<?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.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<script-manager default-expression-language="juel"
default-script-language="juel"
read-contexts="execution, environment, process-engine, spring"
write-context="">
<script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>
<transaction-context>
<object class="identitySession" />
</transaction-context>
<hibernate-session current="true" />
</jbpm-configuration>
And in my applicationContext-process.xml I added a IdentityService bean to try to make sure it initialized:
<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
Nevertheless, everytime I debug my IdentityService object is null...
Any ideas?
Thanks!
-
7. Re: IdentityService
dhamaris May 10, 2011 3:29 AM (in response to dhamaris)Hello, I just found a way:
In my test class, I access IdentityService like this:
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 IdentityServiceImpl extends UserServiceImpl implements IdentityService{
public IdentityServiceImpl()
{
//Load users and groups from the DB
}
public void createUser(String userId, String givenName, String familyName) {
//throw new UnsupportedOperationException("Use method TODO name method");
createUser(userId,givenName,familyName);
}
public void createUser(String userId, String givenName, String familyName,
String businessEmail) {
throw new UnsupportedOperationException("Use method TODO name method");
}
public User findUserById(String userId) {
try{
GenericUser gU = loadUser(userId);
UserImpl user = new UserImpl(gU.getUsername(),gU.getFirstname(), gU.getLastname());
return user;
}
catch (ValidationErrors e) {
e.printStackTrace();
} catch (ServiceExecutionException e) {
e.printStackTrace();
}
return null;
}
public List<User> findUsers() {
try {
List<GenericUser> gUList = listUsers();
List<User> userList = new ArrayList<User>();
for(GenericUser gU : gUList)
{
userList.add(new UserImpl(gU.getUsername(),gU.getFirstname(), gU.getLastname()));
}
//If there are no users return null, otherwise return the users
if(userList.size() == 0)
return null;
else
return userList;
} catch (ServiceExecutionException e) {
e.printStackTrace();
}
return null;
}
public void deleteUser(String userId) {
throw new UnsupportedOperationException("Use method TODO name method");
}
public String createGroup(String groupName) {
return createGroup(groupName);
//TODO UserService
}
public String createGroup(String groupName, String groupType) {
return createGroup(groupName, groupType);
}
public String createGroup(String groupName, String groupType,
String parentGroupId) {
return createGroup(groupName, groupType, parentGroupId);
}
public Group findGroupById(String groupId) {
return findGroupById(groupId);
}
public List<Group> findGroupsByUserAndGroupType(String userId,
String groupType) {
return findGroupsByUserAndGroupType(userId, groupType);
}
public List<Group> findGroupsByUser(String userId) {
return findGroupsByUser(userId);
}
public List<String> findGroupIdsByUser(String userId) {
return findGroupIdsByUser(userId);
}
public void deleteGroup(String groupId) {
deleteGroup(groupId);
}
public void createMembership(String userId, String groupId) {
createMembership(userId, groupId);
}
public void createMembership(String userId, String groupId, String role) {
createMembership(userId, groupId, role);
}
public void deleteMembership(String userId, String groupId, String role) {
deleteMembership(userId, groupId, role);
}
}
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.