Information Technology Reference
In-Depth Information
public interface UserGroupCallback {
boolean existsUser(String userId);
boolean existsGroup(String groupId);
List<String> getGroupsForUser(String userId,
List<String> groupIds,
List<String> allExistingGroupIds);
}
For our test case, we will use a properties file, and an implementation called
JBossUserGroupCallbackImpl , which will allow us to define our users and
groups at runtime through a Properties object:
Properties userGroups = new Properties();
userGroups.setProperty("john", "developers");
userGroups.setProperty("mary", "testers");
JBossUserGroupCallbackImpl userGroupCallback =
new JBossUserGroupCallbackImpl(userGroups);
There are other implementations of this interface that are already available for use, such as
DBUserGroupCallbackImpl that allows you to configure a couple of queries to val-
idate users and groups, or LDAPGroupCallbackImpl that can be used to connect to
an LDAP/AD server to validate users and groups. You can even implement your own to
connect to any legacy system you might have to validate users within your organization.
Starting your task service
Finally, once we have our JPA persistence started and our identity data source configured,
we can start our task service. Doing so is very simple, and the Human task component
provides a factory class called HumanTaskServiceFactory to quickly create a task
service instance, as follows:
TaskService taskService = HumanTaskServiceFactory.
newTaskServiceConfigurator().
entityManagerFactory(entityManagerFactory).
userGroupCallback(userGroupCallback).getTaskService();
At this point, we can start using our task service that is backed up by JPA-based persisten-
ce, which is connected to our users and groups' data source. This task service will give us
Search WWH ::




Custom Search