All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xlrit.gears.base.execution.AbstractBehavior Maven / Gradle / Ivy

There is a newer version: 1.17.5
Show newest version
package com.xlrit.gears.base.execution;

import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class AbstractBehavior implements org.flowable.engine.delegate.JavaDelegate {

	@Autowired
	private ExecutionFactory executionFactory;

	public void execute(org.flowable.engine.delegate.DelegateExecution delegate) {
		ExecutionEntity executionEntity = (ExecutionEntity) delegate;
		String loggerName = "process." + executionEntity.getProcessDefinitionKey() + "." + getClass().getSimpleName();
		Execution execution = executionFactory.wrap(delegate, loggerName);

		long startTime = System.currentTimeMillis();
		execute(execution);
		execution.flush();
		long elapsed = System.currentTimeMillis() - startTime;

		execution.getLogger().debug("Executed in {} seconds", String.format("%.2f", elapsed / 1000f));
	}

	protected abstract void execute(Execution execution);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy