public Void execute(CommandContext commandContext) { commandContext.getDbSqlSession().dbSchemaDrop(); return null; } });
public Object execute(CommandContext commandContext) { commandContext .getSession(PersistenceSession.class) .dbSchemaDrop(); return null; } });
@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() .deleteHistoricProcessInstances(batchConfiguration.getIds()); } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
public Map<String,Long> execute(CommandContext commandContext) { commandContext.getAuthorizationManager().checkCamundaAdmin(); return commandContext .getTableDataManager() .getTableCount(); } }
@Override public void onCommandContextClose(CommandContext commandContext) { if(commandContext.getDbEntityManager().isDirty(this)) { commandContext.getHistoricTaskInstanceManager().updateHistoricTaskInstance(this); } }
@Override public Object execute(CommandContext commandContext) { commandContext.getAuthorizationManager().checkCamundaAdmin(); commandContext.getWritableIdentityProvider().unlockUser(userId); return null; }
public void deleteHistoricProcessInstanceByIds(List<String> processInstanceIds) { CommandContext commandContext = Context.getCommandContext(); commandContext.getHistoricDetailManager().deleteHistoricDetailsByProcessInstanceIds(processInstanceIds); commandContext.getHistoricVariableInstanceManager().deleteHistoricVariableInstanceByProcessInstanceIds(processInstanceIds); commandContext.getCommentManager().deleteCommentsByProcessInstanceIds(processInstanceIds); commandContext.getAttachmentManager().deleteAttachmentsByProcessInstanceIds(processInstanceIds); commandContext.getHistoricTaskInstanceManager().deleteHistoricTaskInstancesByProcessInstanceIds(processInstanceIds, false); commandContext.getHistoricActivityInstanceManager().deleteHistoricActivityInstancesByProcessInstanceIds(processInstanceIds); commandContext.getHistoricIncidentManager().deleteHistoricIncidentsByProcessInstanceIds(processInstanceIds); commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByProcessInstanceIds(processInstanceIds); commandContext.getHistoricExternalTaskLogManager().deleteHistoricExternalTaskLogsByProcessInstanceIds(processInstanceIds); commandContext.getDbEntityManager().deletePreserveOrder(HistoricProcessInstanceEntity.class, "deleteHistoricProcessInstances", processInstanceIds); }
@Before public void setup() { mockedCmdContext = mock(CommandContext.class); mockedConfiguration = mock(ProcessEngineConfigurationImpl.class); authorizationManager = spy(new AuthorizationManager()); mockedEntityManager = mock(DbEntityManager.class); when(mockedCmdContext.getSession(eq(DbEntityManager.class))).thenReturn(mockedEntityManager); when(authorizationManager.filterAuthenticatedGroupIds(eq(AUTHENTICATED_GROUPS))).thenReturn(AUTHENTICATED_GROUPS); when(mockedCmdContext.getAuthentication()).thenReturn(new Authentication(AUTHENTICATED_USER_ID, AUTHENTICATED_GROUPS)); when(mockedCmdContext.isAuthorizationCheckEnabled()).thenReturn(true); when(mockedConfiguration.isAuthorizationEnabled()).thenReturn(true); Context.setCommandContext(mockedCmdContext); Context.setProcessEngineConfiguration(mockedConfiguration); }
public void fireExternalTaskAvailableEvent() { Context.getCommandContext() .getTransactionContext() .addTransactionListener(TransactionState.COMMITTED, new TransactionListener() { @Override public void execute(CommandContext commandContext) { ProcessEngineImpl.EXT_TASK_CONDITIONS.signalAll(); } }); } }
public Void execute(CommandContext commandContext) { List<Job> jobs = commandContext.getDbEntityManager().createJobQuery().list(); for (Job job : jobs) { commandContext.getJobManager().deleteJob((JobEntity) job, false); } for (HistoricJobLog jobLog : commandContext.getDbEntityManager().createHistoricJobLogQuery().list()) { commandContext.getHistoricJobLogManager().deleteHistoricJobLogById(jobLog.getId()); } return null; }
public Object execute(CommandContext commandContext) { DbEntityManager dbEntityManager = commandContext.getDbEntityManager(); PropertyEntity historyLevelProperty = dbEntityManager.selectById(PropertyEntity.class, "historyLevel"); if (historyLevelProperty != null) { dbEntityManager.delete(historyLevelProperty); } return null; } });
public Void execute(CommandContext commandContext) { List<Job> jobs = engineRule.getManagementService().createJobQuery().list(); if (jobs.size() > 0) { assertEquals(1, jobs.size()); String jobId = jobs.get(0).getId(); commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0)); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId); } commandContext.getMeterLogManager().deleteAll(); return null; } });
protected <T extends Session> T spyOnSession(CommandContext commandContext, Class<T> sessionClass) { T manager = commandContext.getSession(sessionClass); T spy = spy(manager); commandContext.getSessions().put(sessionClass, spy); return spy; }
public String execute(CommandContext commandContext) { ensureNotNull("jobId", jobId); JobEntity job = commandContext .getJobManager() .findJobById(jobId); ensureNotNull("No job found with id " + jobId, "job", job); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadJob(job); } return job.getExceptionStacktrace(); }
protected void scheduleTimer(TimerEntity timer) { Context .getCommandContext() .getJobManager() .schedule(timer); }
public static String currentUser() { CommandContext commandContext = Context.getCommandContext(); if (commandContext != null) { return commandContext.getAuthenticatedUserId(); } else { return null; } }
public List<Attachment> execute(CommandContext commandContext) { return commandContext .getAttachmentManager() .findAttachmentsByProcessInstanceId(processInstanceId); } }
protected void deleteFromExecutionAndRuntimeTable() { getExecution().removeExternalTask(this); CommandContext commandContext = Context.getCommandContext(); commandContext .getExternalTaskManager() .delete(this); // Also delete the external tasks's error details byte array if (errorDetailsByteArrayId != null) { commandContext.getByteArrayManager().deleteByteArrayById(errorDetailsByteArrayId); } }
public Void execute(CommandContext commandContext) { ensureNotNull("UserId", userId); IdentityInfoEntity infoEntity = commandContext.getIdentityInfoManager() .findUserInfoByUserIdAndKey(userId, "picture"); if(infoEntity != null) { String byteArrayId = infoEntity.getValue(); if(byteArrayId != null) { commandContext.getByteArrayManager() .deleteByteArrayById(byteArrayId); } commandContext.getIdentityInfoManager() .delete(infoEntity); } return null; }
public Void execute(CommandContext commandContext) { List<Job> jobs = engineRule.getManagementService().createJobQuery().list(); if (jobs.size() > 0) { assertEquals(1, jobs.size()); String jobId = jobs.get(0).getId(); commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0)); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId); } return null; } });