The BPM Directory is an information repository. It stores configuration information about a BPM Environment. This repository is a fundamental component of the BPM Environment; a BPM Environment cannot exist without a BPM Directory. All the users information and organizational unit information maintains on BPM directory. Oracle BPM also provides API named FDI to CRUD operations on these information. For more additional information see here. In this current post, i will provide sample java code which will help to quick start with FDI.
Fdi Api is not public api to use, for these reason only a few reference found on the web. Oracle BPM Standard Components Reference provides most of the information to working with FDI. For example purpose, i will use Bpm Standalone Enterprise server directory.xml. To run standalone client we have to need following libraries on class path:
Here is my maven pom.xml file
Here is my directory.xml, which must be on classpath.
Next, it's time for java coding
On the above code permission 255 is a binary mask, from the api reference
Fuego.Fdi.DirHumanParticipant.getPermissionValue would be as follows:
"X" Execute 1
"R" Route 2
"S" Suspend 4
"A" Abort 8
"D" Delegate 16
"G" Grab (re-assign) 32
"E" Escalate 64
"P" Peer assign 128
For example, if you have XEP, then the integer value would be 1 + 64 + 128 = 193, and then all values are XRSADGEP = 255
Additional links:
1) Creating Oracle BPM PAPI Clients
2) Oracle forum thread
Fdi Api is not public api to use, for these reason only a few reference found on the web. Oracle BPM Standard Components Reference provides most of the information to working with FDI. For example purpose, i will use Bpm Standalone Enterprise server directory.xml. To run standalone client we have to need following libraries on class path:
- fuegopapi-client.jar
- b1oracle.jar
- b1base.jar
- b1util.jar
- b1resource.jar
Here is my maven pom.xml file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ru.fors.nsi.bpm.proxy</groupId> <artifactId>bpmproxy</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>bpmproxy</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>fuego</groupId> <artifactId>fuegopapi-client</artifactId> <version>6.5.0</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupId>javax.ejb</groupId> <artifactId>ejb</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>albpm.jdbc.oracle</groupId> <artifactId>b1oracle</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>albpm.jdbc.base</groupId> <artifactId>b1base</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>albpm.util</groupId> <artifactId>b1util</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> <version>1.1</version> </dependency> <!--<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency>--> <dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> <version>1.6.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>true</testFailureIgnore> <skip>true</skip> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project>
Here is my directory.xml, which must be on classpath.
<?xml version="1.0" encoding="UTF-8"?> <?fuego version="6.5.1" build="94375"?> <DirectoryConfiguration> <id>default</id> <description>Default Directory Configuration</description> <admin>admin</admin> <adminPass><encrypted>uPgrjqI482A=</adminPass> <presets> <preset name="engine"> <property name="participant" value="admin"/> <property name="participant_password" value="<encrypted>uPgrjqI482A="/> </preset> <preset name="xobjects"> <property name="participant" value="admin"/> <property name="participant_password" value="<encrypted>uPgrjqI482A="/> </preset> <preset name="portal-anonymous"> <property name="participant" value="admin"/> <property name="participant_password" value="<encrypted>uPgrjqI482A="/> </preset> <preset name="datawarehouse"> <property name="participant" value="admin"/> <property name="participant_password" value="<encrypted>uPgrjqI482A="/> </preset> <preset name="papiws-anonymous"> <property name="participant" value="admin"/> <property name="participant_password" value="<encrypted>uPgrjqI482A="/> </preset> </presets> <set> <configuration name="fuego" type="SQL" subtype="DDORACLE"> <property name="jdbc.pool.idle_timeout" value="5"/> <property name="jdbc.pool.entry.max" value="10"/> <property name="oracle.dateEqualsTimestamp" value="false"/> <property name="jdbc.host" value="xyz"/> <property name="user" value="OBPMDirLocal"/> <property name="jdbc.port" value="1521"/> <property name="jdbc.pool.min" value="0"/> <property name="jdbc.pool.maxopencursors" value="100"/> <property name="oracle.sid" value="ftsdb"/> <property name="password" value="<encrypted>ko8PrHu2UJLLicio"/> <property name="jdbc.xa" value="false"/> <property name="jdbc.pool.max" value="10"/> </configuration> </set> </DirectoryConfiguration>
Next, it's time for java coding
package ru.fors.bpm.client; import fuego.directory.*; import fuego.directory.exception.ProtocolNotSupportedException; import java.util.Properties; public class FdiClient { public FdiClient(){} private static DirectorySession directorySession; static{ Properties configuration = new Properties(); /*Configuration for Standalone*/ configuration.setProperty( "fuego.custom.replication.config.directoryId", "default"); configuration.setProperty("fuego.custom.replication.config.directoryFile", "directory.xml"); configuration.setProperty("fuego.custom.replication.config.preset", "engine"); try { DirectoryConfigurationManager.getRuntime("default").setPropertiesFileName(configuration.getProperty("fuego.custom.replication.config.directoryFile").trim()); DirectoryPassport directoryPassport = DirectoryPassport.createWithIDAndPreset(configuration.getProperty("fuego.custom.replication.config.directoryId").trim(), configuration.getProperty("fuego.custom.replication.config.preset").trim()); directoryPassport.fillPassport(); directorySession = Directory.startAdminSession(directoryPassport); }catch (ProtocolNotSupportedException e) { e.printStackTrace(); }catch (AuthenticationException e) { e.printStackTrace(); }catch(DirectoryException e){ e.printStackTrace(); } } private void disconnect () throws DirectoryException{ if(directorySession.isConnected()){ directorySession.disconnect(); } } private void createParticipant (final String participantName, final String participantDisplayName, final String password) throws Exception{ if(!directorySession.isConnected()){ throw new Exception ("session already closed.."); } // fetch Role DirOrganizationalRole nsiRoles = DirOrganizationalRole.fetch(directorySession, "Controller"); fuego.directory.DirHumanParticipant.RoleAssignment role = new DirHumanParticipant.RoleAssignment(nsiRoles.getId(), 255, nsiRoles.getIn()); DirHumanParticipant participant = DirHumanParticipant.create(directorySession, participantName, participantDisplayName, participantName, participantDisplayName, "fts@mydomain.com", "", "", password, DirOrganizationalUnit.fetchRoot(directorySession) , new DirHumanParticipant.RoleAssignment[]{ role } ); System.out.println("Participant create:"+ participant.getStatus()); } private void changedPassword(final String oldPassWord, final String newPassword) throws Exception{ if(!directorySession.isConnected()){ throw new Exception ("session already closed.."); } DirHumanParticipant part = DirHumanParticipant.fetch(directorySession, "test23"); part.changePassword(oldPassWord, newPassword); System.out.println("Status:"+part.getStatus()); } private DirHumanParticipant getParticipant(final String name) { if(!directorySession.isConnected()){ throw new Exception ("session already closed.."); } return DirHumanParticipant.fetch(directorySession, name); } public static void main(String[] args) throws Exception{ System.out.println("FDI - connect to Oracle BPM directory Service..."); FdiClient client = new FdiClient(); //client.createParticipant("test23", "test23","123456"); //client.changedPassword("123456","654321"); DirHumanParticipant part = client.getParticipant("part2"); System.out.println("Status:"+ part.getPermissions()); client.disconnect(); } }
On the above code permission 255 is a binary mask, from the api reference
Fuego.Fdi.DirHumanParticipant.getPermissionValue would be as follows:
"X" Execute 1
"R" Route 2
"S" Suspend 4
"A" Abort 8
"D" Delegate 16
"G" Grab (re-assign) 32
"E" Escalate 64
"P" Peer assign 128
For example, if you have XEP, then the integer value would be 1 + 64 + 128 = 193, and then all values are XRSADGEP = 255
Additional links:
1) Creating Oracle BPM PAPI Clients
2) Oracle forum thread
Comments