Java Code Examples for org.camunda.bpm.engine.impl.interceptor.CommandContext#getProcessEngineConfiguration()
The following examples show how to use
org.camunda.bpm.engine.impl.interceptor.CommandContext#getProcessEngineConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedeploymentRegistrationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected static TestProvider processDefinitionTestProvider() { return new TestProvider() { @Override public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) { return new Command<ProcessApplicationReference>() { public ProcessApplicationReference execute(CommandContext commandContext) { ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration(); DeploymentCache deploymentCache = configuration.getDeploymentCache(); ProcessDefinitionEntity definition = deploymentCache.findDeployedProcessDefinitionById(definitionId); return ProcessApplicationContextUtil.getTargetProcessApplication(definition); } }; } @Override public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) { return repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult().getId(); } }; }
Example 2
Source File: RedeploymentRegistrationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected static TestProvider caseDefinitionTestProvider() { return new TestProvider() { @Override public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) { return new Command<ProcessApplicationReference>() { public ProcessApplicationReference execute(CommandContext commandContext) { ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration(); DeploymentCache deploymentCache = configuration.getDeploymentCache(); CaseDefinitionEntity definition = deploymentCache.findDeployedCaseDefinitionById(definitionId); return ProcessApplicationContextUtil.getTargetProcessApplication(definition); } }; } @Override public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) { return repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).latestVersion().singleResult().getId(); } }; }
Example 3
Source File: RedeploymentRegistrationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected static TestProvider decisionDefinitionTestProvider() { return new TestProvider() { @Override public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) { return new Command<ProcessApplicationReference>() { public ProcessApplicationReference execute(CommandContext commandContext) { ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration(); DeploymentCache deploymentCache = configuration.getDeploymentCache(); DecisionDefinitionEntity definition = deploymentCache.findDeployedDecisionDefinitionById(definitionId); return ProcessApplicationContextUtil.getTargetProcessApplication(definition); } }; } @Override public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) { return repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(key).latestVersion().singleResult().getId(); } }; }
Example 4
Source File: RedeploymentRegistrationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected static TestProvider decisionRequirementsDefinitionTestProvider() { return new TestProvider() { @Override public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) { return new Command<ProcessApplicationReference>() { public ProcessApplicationReference execute(CommandContext commandContext) { ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration(); DeploymentCache deploymentCache = configuration.getDeploymentCache(); DecisionRequirementsDefinitionEntity definition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(definitionId); return ProcessApplicationContextUtil.getTargetProcessApplication(definition); } }; } @Override public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) { return repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(key).latestVersion().singleResult().getId(); } }; }
Example 5
Source File: HistoryCleanupSchedulerCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void reportMetrics(CommandContext commandContext) { ProcessEngineConfigurationImpl engineConfiguration = commandContext.getProcessEngineConfiguration(); if (engineConfiguration.isHistoryCleanupMetricsEnabled()) { for (Map.Entry<String, Long> report : reports.entrySet()){ engineConfiguration.getDbMetricsReporter().reportValueAtOnce(report.getKey(), report.getValue()); } } }
Example 6
Source File: HistoryCleanupCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public Job execute(CommandContext commandContext) { if (!isHistoryCleanupEnabled(commandContext)) { throw new BadUserRequestException("History cleanup is disabled for this engine"); } AuthorizationManager authorizationManager = commandContext.getAuthorizationManager(); ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration(); authorizationManager.checkCamundaAdmin(); //validate if (!willBeScheduled()) { LOG.debugHistoryCleanupWrongConfiguration(); } //find job instance List<Job> historyCleanupJobs = getHistoryCleanupJobs(); int degreeOfParallelism = processEngineConfiguration.getHistoryCleanupDegreeOfParallelism(); int[][] minuteChunks = HistoryCleanupHelper.listMinuteChunks(degreeOfParallelism); if (shouldCreateJobs(historyCleanupJobs)) { historyCleanupJobs = createJobs(degreeOfParallelism, minuteChunks); } else if (shouldReconfigureJobs(historyCleanupJobs)) { historyCleanupJobs = reconfigureJobs(historyCleanupJobs, degreeOfParallelism, minuteChunks); } else if (shouldSuspendJobs(historyCleanupJobs)) { suspendJobs(historyCleanupJobs); } writeUserOperationLog(commandContext); return historyCleanupJobs.size() > 0 ? historyCleanupJobs.get(0) : null; }
Example 7
Source File: CreateMigrationPlanCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected List<MigrationInstruction> generateInstructions(CommandContext commandContext, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, boolean updateEventTriggers) { ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration(); // generate instructions MigrationInstructionGenerator migrationInstructionGenerator = processEngineConfiguration.getMigrationInstructionGenerator(); ValidatingMigrationInstructions generatedInstructions = migrationInstructionGenerator.generate(sourceProcessDefinition, targetProcessDefinition, updateEventTriggers); // filter only valid instructions generatedInstructions.filterWith(processEngineConfiguration.getMigrationInstructionValidators()); return generatedInstructions.asMigrationInstructions(); }
Example 8
Source File: GetPasswordPolicyCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public PasswordPolicy execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration(); if (processEngineConfiguration.isEnablePasswordPolicy()) { return processEngineConfiguration.getPasswordPolicy(); } else { return null; } }
Example 9
Source File: HistoryCleanupHelper.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * Creates next batch object for history cleanup. First searches for historic process instances ready for cleanup. If there is still some place left in batch (configured batch * size was not reached), searches for historic decision instances and also adds them to the batch. Then if there is still some place left in batch, searches for historic case * instances and historic batches - and adds them to the batch. * * @param commandContext * @return */ public static void prepareNextBatch(HistoryCleanupBatch historyCleanupBatch, CommandContext commandContext) { final HistoryCleanupJobHandlerConfiguration configuration = historyCleanupBatch.getConfiguration(); final Integer batchSize = getHistoryCleanupBatchSize(commandContext); ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration(); //add process instance ids final List<String> historicProcessInstanceIds = commandContext.getHistoricProcessInstanceManager() .findHistoricProcessInstanceIdsForCleanup(batchSize, configuration.getMinuteFrom(), configuration.getMinuteTo()); if (historicProcessInstanceIds.size() > 0) { historyCleanupBatch.setHistoricProcessInstanceIds(historicProcessInstanceIds); } //if batch is not full, add decision instance ids if (historyCleanupBatch.size() < batchSize && processEngineConfiguration.isDmnEnabled()) { final List<String> historicDecisionInstanceIds = commandContext.getHistoricDecisionInstanceManager() .findHistoricDecisionInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.getMinuteFrom(), configuration.getMinuteTo()); if (historicDecisionInstanceIds.size() > 0) { historyCleanupBatch.setHistoricDecisionInstanceIds(historicDecisionInstanceIds); } } //if batch is not full, add case instance ids if (historyCleanupBatch.size() < batchSize && processEngineConfiguration.isCmmnEnabled()) { final List<String> historicCaseInstanceIds = commandContext.getHistoricCaseInstanceManager() .findHistoricCaseInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.getMinuteFrom(), configuration.getMinuteTo()); if (historicCaseInstanceIds.size() > 0) { historyCleanupBatch.setHistoricCaseInstanceIds(historicCaseInstanceIds); } } //if batch is not full, add batch ids Map<String, Integer> batchOperationsForHistoryCleanup = processEngineConfiguration.getParsedBatchOperationsForHistoryCleanup(); if (historyCleanupBatch.size() < batchSize && batchOperationsForHistoryCleanup != null && !batchOperationsForHistoryCleanup.isEmpty()) { List<String> historicBatchIds = commandContext .getHistoricBatchManager() .findHistoricBatchIdsForCleanup(batchSize - historyCleanupBatch.size(), batchOperationsForHistoryCleanup, configuration.getMinuteFrom(), configuration.getMinuteTo()); if (historicBatchIds.size() > 0) { historyCleanupBatch.setHistoricBatchIds(historicBatchIds); } } }