Skip to content

Instantly share code, notes, and snippets.

View estebanroblesluna's full-sized avatar

Esteban Robles Luna estebanroblesluna

View GitHub Profile
public class NeedsApprovalDelegate implements org.activiti.engine.delegate.JavaDelegate
{
private static Set<String> imagesWithCopyright = new HashSet<String>();
static {
imagesWithCopyright.add("mule1.jpg");
imagesWithCopyright.add("mule2.jpg");
}
public class ChargeDelegate implements org.activiti.engine.delegate.JavaDelegate
{
private Expression wsdl;
private Expression operation;
private Expression parameters;
private Expression returnValue;
public void execute(DelegateExecution execution) throws Exception
{
String wsdlString = (String) wsdl.getValue(execution);
<h1>Picture Approval</h1>
<p>
The user: <b>${user}</b> wants the high definition version of the image <b>${imageName}</b>.
</p>
<p>
Do you approve this?
<select name="approvalConfirmed">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
<ajax:endpoint name="ajax-endpoint" channel="/requestCharged"/>
<flow name="chargeAccount">
<inbound-endpoint address="http://localhost:8291/chargeService" />
<cxf:jaxws-service serviceClass="com.picturerequest.ChargeServiceImpl" />
<component class="com.picturerequest.ChargeServiceImpl" />
<outbound-endpoint ref="ajax-endpoint" exchange-pattern="one-way"/>
</flow>
@WebService(endpointInterface = "com.picturerequest.ChargeService", serviceName = "ChargeService")
public class ChargeServiceImpl implements ChargeService
{
public String chargeAccount(String username, String imageName)
{
//do some stuff to charge the username
return imageName;
}
}
<target name="evaluateActivitiModule" depends="activiti.stopCleanAndStart, activiti.deployMultiplier">
<exec executable="sleep" failifexecutionfails="false" failonerror="false">
<arg value="30" />
</exec>
<exec dir="${activiti.module.home}" executable="mvn" failifexecutionfails="false" failonerror="false">
<arg value="clean" />
<arg value="install" />
<arg value="-Dactiviti.version=${activiti.version}" />
</exec>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>${activiti.version}</version>
</dependency>
<spring:bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<spring:property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<spring:property name="jdbcDriver" value="org.h2.Driver" />
<spring:property name="jdbcUsername" value="sa" />
<spring:property name="jdbcPassword" value="" />
<spring:property name="databaseSchemaUpdate" value="true" />
<spring:property name="jobExecutorActivate" value="false" />
</spring:bean>
<spring:bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<jms:activemq-connector name="jmsConnector" />
<activiti:connector name="activitiServer" version="5.5"
repositoryService-ref="repositoryService"
runtimeService-ref="runtimeService"
taskService-ref="taskService"
historyService-ref="historyService" />