AnsweredAssumed Answered

ProcessDefinition identitylink roles aside from candidate

Question asked by nhmarsh on May 5, 2014
Latest reply on May 7, 2014 by nhmarsh
Hi all,

We're developing a workflow project with Activiti as our backbone, and one of the requirements we've received on the side of Process Definitions is to ensure we know which user deployed a process definition. Natively, activiti does not seem to support this, so it seemed reasonable to create an IdentityLink entry linking that processdefinition ID to the user, with the TYPE_ field equal to"owner". Once again, this does not seem to be supported natively in the API, so I wrote some simple test code:


      IdentityLinkEntity newEntity = new IdentityLinkEntity();
      
      newEntity.setProcessDefId(processDef.getId());
      newEntity.setType(OWNER);
      newEntity.setUserId(user.getUserId());
      newEntity.setId(UUID.randomUUID().toString());
      newEntity.insert();



Our process engine is set up using spring:

   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="processEngineName" value="processEngine"/>  
      <property name="dataSource" ref="dataSource1" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="databaseSchemaUpdate" value="false" />
      <property name="jobExecutorActivate" value="false" />
      <property name="databaseSchema" value="WORKFLOW_POC1" />
   </bean>

However, the call to newEntity.insert() yields a nullpointer exception for this line of code within IdentityLinkEntity.java:


    Context
      .getCommandContext()
      .getDbSqlSession()
      .insert(this);


Specifically, the first line, Context.getCommandContext(). Upon further investigation, Context is indeed null.

So my question is - is there specific setup I'll need to do to get this call to work? Or is there an alternative approach that anybody can suggest, either for this method of creating an audit trail that can be traced to users, or any other method?

Thanks!

Outcomes