Search in sources :

Example 86 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class HistoryCleanupRestServiceImpl method getHistoryCleanupConfiguration.

public HistoryCleanupConfigurationDto getHistoryCleanupConfiguration() {
    HistoryCleanupConfigurationDto configurationDto = new HistoryCleanupConfigurationDto();
    Date startTime = ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration()).getHistoryCleanupBatchWindowStartTimeAsDate();
    Date endTime = ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration()).getHistoryCleanupBatchWindowEndTimeAsDate();
    if (startTime == null || endTime == null) {
        return configurationDto;
    }
    Date now = ClockUtil.getCurrentTime();
    Date startDate = HistoryCleanupHelper.getCurrentOrNextBatchWindowStartTime(now, startTime, endTime);
    Date endDate = HistoryCleanupHelper.getNextBatchWindowEndTime(now, endTime);
    configurationDto.setBatchWindowStartTime(startDate);
    configurationDto.setBatchWindowEndTime(endDate);
    return configurationDto;
}
Also used : HistoryCleanupConfigurationDto(org.camunda.bpm.engine.rest.dto.history.HistoryCleanupConfigurationDto) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Date(java.util.Date)

Example 87 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class RegisterProcessApplicationCmd method execute.

public ProcessApplicationRegistration execute(CommandContext commandContext) {
    commandContext.getAuthorizationManager().checkCamundaAdmin();
    final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    final ProcessApplicationManager processApplicationManager = processEngineConfiguration.getProcessApplicationManager();
    return processApplicationManager.registerProcessApplicationForDeployments(deploymentsToRegister, reference);
}
Also used : ProcessApplicationManager(org.camunda.bpm.engine.impl.application.ProcessApplicationManager) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 88 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class ReportDbMetricsCmd method execute.

public Void execute(CommandContext commandContext) {
    ProcessEngineConfigurationImpl engineConfiguration = Context.getProcessEngineConfiguration();
    if (!engineConfiguration.isMetricsEnabled()) {
        throw new ProcessEngineException("Metrics reporting is disabled");
    }
    if (!engineConfiguration.isDbMetricsReporterActivate()) {
        throw new ProcessEngineException("Metrics reporting to database is disabled");
    }
    DbMetricsReporter dbMetricsReporter = engineConfiguration.getDbMetricsReporter();
    dbMetricsReporter.reportNow();
    return null;
}
Also used : ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) DbMetricsReporter(org.camunda.bpm.engine.impl.metrics.reporter.DbMetricsReporter)

Example 89 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class GetDeployedStartFormCmd method checkAuthorization.

@Override
protected void checkAuthorization(CommandContext commandContext) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadProcessDefinition(processDefinition);
    }
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 90 with ProcessEngineConfigurationImpl

use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.

the class GetRenderedStartFormCmd method execute.

public Object execute(CommandContext commandContext) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    ensureNotNull("Process Definition '" + processDefinitionId + "' not found", "processDefinition", processDefinition);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadProcessDefinition(processDefinition);
    }
    StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
    if (startFormHandler == null) {
        return null;
    }
    FormEngine formEngine = Context.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
    ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine);
    StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
    Object renderedStartForm = null;
    try {
        renderedStartForm = formEngine.renderStartForm(startForm);
    } catch (ScriptEvaluationException e) {
        LOG.exceptionWhenStartFormScriptEvaluation(processDefinitionId, e);
    }
    return renderedStartForm;
}
Also used : StartFormHandler(org.camunda.bpm.engine.impl.form.handler.StartFormHandler) ScriptEvaluationException(org.camunda.bpm.engine.ScriptEvaluationException) StartFormData(org.camunda.bpm.engine.form.StartFormData) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) FormEngine(org.camunda.bpm.engine.impl.form.engine.FormEngine)

Aggregations

ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)161 Test (org.junit.Test)35 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)22 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)18 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)17 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)17 HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)13 HistoryEventProcessor (org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor)12 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)12 Before (org.junit.Before)11 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)8 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)8 After (org.junit.After)8 Date (java.util.Date)7 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)7 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)7 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)7 IdentityService (org.camunda.bpm.engine.IdentityService)7 ProcessEngineImpl (org.camunda.bpm.engine.impl.ProcessEngineImpl)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)6