[jboss-user] [jBPM] - adding a custom service to jbpm.cfg.xml
kelum_sv N
do-not-reply at jboss.com
Wed Aug 25 20:51:19 EDT 2010
kelum_sv N [http://community.jboss.org/people/kelum] replied to the discussion
"adding a custom service to jbpm.cfg.xml"
To view the discussion, visit: http://community.jboss.org/message/559050#559050
--------------------------------------------------------------
HI
*Using jbpm 4.4. WITH jboss-5.1.0.GA*
1 :I am also having this kind of issue at the moment . What i have done was extended IdentitySessionImpl and created my own MyIdentitySession .and i have over right few methods createUser,createGroup what was already there in IdentitySessionImpl.
public String createUser(String userName, String givenName, String familyName, String businessEmail)
{
User user = null;
try
{
user = findUserById(userName);
}
catch (Exception ex)
{
}
if (user == null)
{
user = new UserImpl(userName, givenName, familyName);
long dbid = EnvironmentImpl.getFromCurrent(DbidGenerator.class).getNextId();
((UserImpl) user).setDbid(dbid);
}
UserImpl userimpl = (UserImpl) user;
userimpl.setBusinessEmail(businessEmail);
userimpl.setFamilyName(familyName);
userimpl.setGivenName(givenName);
userimpl.setId(userName);
session.save(user);
return user.getId();
}
2: Then i created new MyIdentitySessionBinding by extending WireDescriptorBinding
public class MyIdentitySessionBinding extends WireDescriptorBinding
{
public IWirkfloIdentitySessionBinding()
{
super("identity-session");
}
public Object parse(Element element, Parse parse, Parser parser)
{
ObjectDescriptor objectDescriptor = new ObjectDescriptor(MyIdentitySession.class);
objectDescriptor.addTypedInjection("session", Session.class);
return objectDescriptor;
}
}
3: Then this MyIdentitySessionBinding was registered using jbpm.user.wire.bindings.xml
<wire-bindings>
<!-- sessions -->
<binding class ="dd.ss.ss.MyIdentitySessionBinding" />
</wire-bindings>
4: Added this file inside that jbpm-service.sar which inside JBoss deploy directory .
5 : Customised jbpm.cfg.xml as bellow
<jbpm-configuration jndi-name="java:/ProcessEngine">
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.jta.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<transaction-context>
<object class ="aa.bb.cc.MyIdentitySession" />
</transaction-context>
</jbpm-configuration>
Whwn i try to use createUser,createGroup methods inside MyIdentitySession, it gives me NullPointer exception when accessing session[Hybranate ].
Hope there should be a configuration issue. Please assist me on this regards
Thank you
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559050#559050]
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/20100825/51973422/attachment-0001.html
More information about the jboss-user
mailing list