Java Code Examples for org.camunda.bpm.engine.impl.interceptor.CommandContext#enableUserOperationLog()
The following examples show how to use
org.camunda.bpm.engine.impl.interceptor.CommandContext#enableUserOperationLog() .
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: SetJobRetriesJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); SetRetriesBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { commandContext.getProcessEngineConfiguration() .getManagementService() .setJobRetries(batchConfiguration.getIds(), batchConfiguration.getRetries()); } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
Example 2
Source File: UpdateProcessInstancesSuspendStateJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); UpdateProcessInstancesSuspendStateBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { if(batchConfiguration.getSuspended()) { commandContext.getProcessEngineConfiguration() .getRuntimeService() .updateProcessInstanceSuspensionState().byProcessInstanceIds(batchConfiguration.getIds()).suspend(); } else { commandContext.getProcessEngineConfiguration() .getRuntimeService() .updateProcessInstanceSuspensionState().byProcessInstanceIds(batchConfiguration.getIds()).activate(); } } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } }
Example 3
Source File: SetExternalTaskRetriesJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); SetRetriesBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { commandContext.getProcessEngineConfiguration() .getExternalTaskService() .setRetries(batchConfiguration.getIds(), batchConfiguration.getRetries()); } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
Example 4
Source File: DeleteProcessInstancesJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); DeleteProcessInstanceBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { RuntimeService runtimeService = commandContext.getProcessEngineConfiguration().getRuntimeService(); if(batchConfiguration.isFailIfNotExists()) { runtimeService.deleteProcessInstances(batchConfiguration.getIds(), batchConfiguration.deleteReason, batchConfiguration.isSkipCustomListeners(), true, batchConfiguration.isSkipSubprocesses()); } else { runtimeService.deleteProcessInstancesIfExists(batchConfiguration.getIds(), batchConfiguration.deleteReason, batchConfiguration.isSkipCustomListeners(), true, batchConfiguration.isSkipSubprocesses()); } } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
Example 5
Source File: DeleteHistoricProcessInstancesJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); if(batchConfiguration.isFailIfNotExists()) { historyService.deleteHistoricProcessInstances(batchConfiguration.getIds()); }else { historyService.deleteHistoricProcessInstancesIfExists(batchConfiguration.getIds()); } } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
Example 6
Source File: DeleteHistoricDecisionInstancesJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { commandContext.getProcessEngineConfiguration() .getHistoryService() .deleteHistoricDecisionInstancesBulk(batchConfiguration.getIds()); } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
Example 7
Source File: RestartProcessInstancesJobHandler.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); RestartProcessInstancesBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { RestartProcessInstanceBuilderImpl builder = (RestartProcessInstanceBuilderImpl) commandContext.getProcessEngineConfiguration() .getRuntimeService() .restartProcessInstances(batchConfiguration.getProcessDefinitionId()) .processInstanceIds(batchConfiguration.getIds()); builder.setInstructions(batchConfiguration.getInstructions()); if (batchConfiguration.isInitialVariables()) { builder.initialSetOfVariables(); } if (batchConfiguration.isSkipCustomListeners()) { builder.skipCustomListeners(); } if (batchConfiguration.isWithoutBusinessKey()) { builder.withoutBusinessKey(); } if (batchConfiguration.isSkipIoMappings()) { builder.skipIoMappings(); } builder.execute(false); } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
Example 8
Source File: DefaultDelegateInterceptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void handleInvocationInContext(final DelegateInvocation invocation) throws Exception { CommandContext commandContext = Context.getCommandContext(); boolean wasAuthorizationCheckEnabled = commandContext.isAuthorizationCheckEnabled(); boolean wasUserOperationLogEnabled = commandContext.isUserOperationLogEnabled(); BaseDelegateExecution contextExecution = invocation.getContextExecution(); ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration(); boolean popExecutionContext = false; try { if (!configuration.isAuthorizationEnabledForCustomCode()) { // the custom code should be executed without authorization commandContext.disableAuthorizationCheck(); } try { commandContext.disableUserOperationLog(); try { if (contextExecution != null && !isCurrentContextExecution(contextExecution)) { popExecutionContext = setExecutionContext(contextExecution); } invocation.proceed(); } finally { if (popExecutionContext) { Context.removeExecutionContext(); } } } finally { if (wasUserOperationLogEnabled) { commandContext.enableUserOperationLog(); } } } finally { if (wasAuthorizationCheckEnabled) { commandContext.enableAuthorizationCheck(); } } }