How to use Parametric Roles and Extended User Properties with Oracle BPM 11g

In this entry, I would like to show how to use Parametric Roles, why we need Extended User Properties, some limitations and how to solve them.

Parametric Roles are user to customize one role depending on some conditions. e.g.: I want to assign one task depending on user’s specializations, if one task requires check a quote related with heavy machines, this should be assigned to the supervisor specialized on heavy machines, if the quote is about light machines, should be assigned to the supervisor of light machines, and so on.

Parametric Roles use the users information founded in LDAP. This specific information could be stored on a LDAP system, but normally LDAP are only used to store basic information like e-mail accounts, names and password.

To extend the user properties, Oracle BPM offer a feature called Extended User Properties. This let us define information like location, specializations, etc.

Using this properties we can define Parametric Roles and avoid creating a “USER” table or Business Rules to define the user or users to assign a task.

Extended User Properties

Creating Extended User Properties

To create and assign user properties we can use Oracle BPM Workspace application:

Extended User Properties

But this feature has one limitation (or bug): Oracle Documentation says you can define four types of properties: STRING, NUMBER, DATE, and FREEFORM. And from Workspace you only can define 2: STRING and NUMBER. What if I want to define a property to store some description or address and this cannot be defined as an option list?

Well, after some tests, I have implemented a JDeveloper project to access User Properties and create NUMBER, DATE or FREEFORM properties:

    public void createUserExtendedProperty(String propertyName,
                                           PropertyType propertyType) {
        try {
            beginConnection();

            IBPMServiceClient bpmServiceClient =
                clientFactory.getBPMServiceClient();

            IBPMOrganizationService bpmOrganizationService =
                bpmServiceClient.getBPMOrganizationService();

            ParticipantProperty participantProperty =
                new ParticipantProperty();

            participantProperty.setName(propertyName);
            participantProperty.setPropertyType(propertyType.name());

            bpmOrganizationService.createParticipantProperty(bpmContext,
                                                             participantProperty);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            closeConnection();
        }
    }

Also, is implemented how to get user assigned properties from BPM Workspace:

    public List getParticipantsProperties(List participantsNames) {

        List participantsProperties =
            new ArrayList();

        try {
            beginConnection();

            IBPMServiceClient bpmServiceClient =
                clientFactory.getBPMServiceClient();

            IBPMOrganizationService bpmOrganizationService =
                bpmServiceClient.getBPMOrganizationService();

            List participantes = new ArrayList();

            for (String participantName : participantsNames) {
                PrincipleRefType principleRef = new MemberType();
                principleRef.setName(participantName);
                principleRef.setRealm("jazn.com");
                principleRef.setType(ParticipantTypeEnum.USER);

                Participant participante = new Participant(principleRef);

                participantes.add(participante);
            }

            participantsProperties =
                    bpmOrganizationService.getPropertiesOfParticipants(bpmContext,
                                                                       participantes);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            closeConnection();
        }

        return participantsProperties;
    }

This is the link to the Git repository:

GitHub: JDeveloper Project

Check the BPMClient library on the project, should have these links:

Parametric Roles

This artifacts are ideals when you have custom conditions to assign a task related with extended user properties (like specializations). In the previous example about heavy and light machines, the parametric role would have this definition: Group: Supervisor, and Extended Property: Machine Specialization.

Here you can see how to create a parametric role and test it:

  1. Create a new parametric role from Oracle BPM Workspace:

Parametric Roles

In this case we are using some group called “approvers” and a random property called “ABC”.

  1. Then, we must define what Parametric Role use in the Human Task definition:

Human Task Definition

Participant Type

  1. Then we can deploy and test the process from Enterprise Manager:

Parametric Role - 1

Parametric Role - 2

Parametric Role - 3

Parametric Role - 4

Source code: https://github.com/jeqo/bpm_org_poc/tree/master/part2