use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class JuelFormEngine method executeScript.
protected Object executeScript(String scriptSrc, VariableScope scope) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
ScriptFactory scriptFactory = processEngineConfiguration.getScriptFactory();
ExecutableScript script = scriptFactory.createScriptFromSource(ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, scriptSrc);
ScriptInvocation invocation = new ScriptInvocation(script, scope);
try {
processEngineConfiguration.getDelegateInterceptor().handleInvocation(invocation);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new ProcessEngineException(e);
}
return invocation.getInvocationResult();
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class JobEntity method createFailedJobIncident.
protected void createFailedJobIncident() {
final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
if (processEngineConfiguration.isCreateIncidentOnFailedJobEnabled()) {
String incidentHandlerType = Incident.FAILED_JOB_HANDLER_TYPE;
// make sure job has an ID set:
if (id == null) {
id = processEngineConfiguration.getIdGenerator().getNextId();
} else {
// check whether there exists already an incident
// for this job
List<Incident> failedJobIncidents = Context.getCommandContext().getIncidentManager().findIncidentByConfigurationAndIncidentType(id, incidentHandlerType);
if (!failedJobIncidents.isEmpty()) {
return;
}
}
IncidentContext incidentContext = createIncidentContext();
incidentContext.setActivityId(getActivityId());
processEngineConfiguration.getIncidentHandler(incidentHandlerType).handleIncident(incidentContext, exceptionMessage);
}
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class TimerEntity method preExecute.
@Override
protected void preExecute(CommandContext commandContext) {
if (getJobHandler() instanceof TimerEventJobHandler) {
TimerJobConfiguration configuration = (TimerJobConfiguration) getJobHandlerConfiguration();
if (repeat != null && !configuration.isFollowUpJobCreated()) {
// this timer is a repeating timer and
// a follow up timer job has not been scheduled yet
Date newDueDate = calculateRepeat();
if (newDueDate != null) {
// the listener is added to the transaction as SYNC on ROLLABCK,
// when it is necessary to schedule a new timer job invocation.
// If the transaction does not rollback, it is ignored.
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
RepeatingFailedJobListener listener = createRepeatingFailedJobListener(commandExecutor);
commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, listener);
// create a new timer job
createNewTimerJob(newDueDate);
}
}
}
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceManager method updateHistoricTaskInstance.
public void updateHistoricTaskInstance(final TaskEntity taskEntity) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
HistoryLevel historyLevel = configuration.getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_UPDATE, taskEntity)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return producer.createTaskInstanceUpdateEvt(taskEntity);
}
});
}
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class IncidentEntity method fireHistoricIncidentEvent.
protected void fireHistoricIncidentEvent(final HistoryEventType eventType) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
HistoryLevel historyLevel = processEngineConfiguration.getHistoryLevel();
if (historyLevel.isHistoryEventProduced(eventType, this)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
HistoryEvent event = null;
if (HistoryEvent.INCIDENT_CREATE.equals(eventType.getEventName())) {
event = producer.createHistoricIncidentCreateEvt(IncidentEntity.this);
} else if (HistoryEvent.INCIDENT_RESOLVE.equals(eventType.getEventName())) {
event = producer.createHistoricIncidentResolveEvt(IncidentEntity.this);
} else if (HistoryEvent.INCIDENT_DELETE.equals(eventType.getEventName())) {
event = producer.createHistoricIncidentDeleteEvt(IncidentEntity.this);
}
return event;
}
});
}
}
Aggregations