Package org.activiti.engine

Examples of org.activiti.engine.ManagementService


public class ManagementServiceTest {
  @Rule public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void testTableCount() {
    ManagementService managementService = activitiRule.getManagementService();
    Map<String, Long> tableCount = managementService.getTableCount();

    assertEquals(new Long(4), tableCount.get("ACT_GE_PROPERTY"));
    assertEquals(new Long(0), tableCount.get("ACT_GE_BYTEARRAY"));
    assertEquals(new Long(0), tableCount.get("ACT_RE_DEPLOYMENT"));
    assertEquals(new Long(0), tableCount.get("ACT_RU_EXECUTION"));
View Full Code Here


    assertEquals(new Long(0), tableCount.get("ACT_RU_IDENTITYLINK"));
  }

  @Test
  public void testGetTableMetaData() {
    ManagementService managementService = activitiRule.getManagementService();
    TableMetaData tableMetaData = managementService.getTableMetaData("ACT_RU_TASK");
    assertEquals(tableMetaData.getColumnNames().size(), tableMetaData.getColumnTypes().size());
    assertEquals(15, tableMetaData.getColumnNames().size());

    int assigneeIndex = tableMetaData.getColumnNames().indexOf("ASSIGNEE_");
    int createTimeIndex = tableMetaData.getColumnNames().indexOf("CREATE_TIME_");
View Full Code Here

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    RepositoryService repositoryService = processEngine.getRepositoryService();

    TaskService taskService = processEngine.getTaskService();
    ManagementService managementService = processEngine.getManagementService();
    IdentityService identityService = processEngine.getIdentityService();
    HistoryService historyService = processEngine.getHistoryService();
    FormService formService = processEngine.getFormService();

    Map<String, Object> variableMap = new HashMap<String, Object>();
View Full Code Here

    /**
     * 作业.
     */
    public Page findJobs(Page page) {
        ManagementService managementService = processEngine
                .getManagementService();

        long count = managementService.createJobQuery().count();
        List<Job> jobs = managementService.createJobQuery().listPage(
                (int) page.getStart(), page.getPageSize());
        page.setResult(jobs);
        page.setTotalCount(count);

        return page;
View Full Code Here

  public void testProcessInstanceStartEvents() throws Exception {
    ProcessEngineImpl processEngine = initProcessEngine();

    TaskService taskService = processEngine.getTaskService();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    ManagementService managementService = processEngine.getManagementService();
    HistoryService historyService = processEngine.getHistoryService();

    // record events
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put(TEST_VARIABLE, TEST_VALUE);
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(USERTASK_PROCESS, BUSINESS_KEY, variables);

    Task task = taskService.createTaskQuery().taskDefinitionKey("userTask").singleResult();
    TimeUnit.MILLISECONDS.sleep(50);
    variables = new HashMap<String, Object>();
    variables.put(TASK_TEST_VARIABLE, TASK_TEST_VALUE);
    taskService.complete(task.getId(), variables);

    // transform log events
    List<EventLogEntry> eventLogEntries = managementService.getEventLogEntries(null, null);

    EventLogTransformer transformer = new EventLogTransformer(getTransformers());

    List<SimulationEvent> simulationEvents = transformer.transform(eventLogEntries);
View Full Code Here

            System.out.println("拦截事件:" + ToStringBuilder.reflectionToString(event));
        }
    }

    private void skipTask(TaskEntity taskEntity, ActivitiEvent event) {
        ManagementService managementService = event.getEngineServices().getManagementService();
        TaskService taskService = event.getEngineServices().getTaskService();
        String taskDefinitionKey = taskEntity.getTaskDefinitionKey();
        if (skipedTasks.contains(taskDefinitionKey)) {
            return;
        }
        // 设置变量
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("skip", true);
        CompleteTaskCmd command = new CompleteTaskCmd(taskEntity.getId(), variables, true);

        taskService.addComment(taskEntity.getId(), taskEntity.getProcessInstanceId(), "自动跳过");

        // 执行命令,直接完成当前任务
//        System.out.println("准备跳过任务:" + taskEntity.getName() + "-->" + taskDefinitionKey);
        managementService.executeCommand(command);
        System.out.println("已跳过任务:" + taskEntity.getName() + "-->" + taskDefinitionKey);

        skipedTasks.add(taskDefinitionKey);
    }
View Full Code Here

    assertEquals(taskService.createTaskQuery().taskCandidateUser("user1").count(), 0);
    assertEquals(taskService.createTaskQuery().taskCandidateUser("user2").count(), 0);
    assertEquals(taskService.createTaskQuery().taskCandidateUser("user3").count(), 0);

    ManagementService managementService = activitiRule.getManagementService();
    TablePage listPage = managementService.createTablePageQuery().tableName(managementService.getTableName(IdentityLinkEntity.class)).listPage(0, 100);
    List<Map<String, Object>> rows = listPage.getRows();
    for (Map<String, Object> map : rows) {
      Set<Entry<String, Object>> entrySet = map.entrySet();
      for (Entry<String, Object> entry : entrySet) {
        // System.out.println("key=" + entry.getKey() + ", value=" +
View Full Code Here

public class UpgradeTaskOneTest extends UpgradeTestCase {
 
  public void testSimplestTask() {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    TaskService taskService = processEngine.getTaskService();
    ManagementService managementService = processEngine.getManagementService();
    HistoryService historyService = processEngine.getHistoryService();

    Task task = taskService
      .createTaskQuery()
      .taskName("simpleTask2")
      .singleResult();
   
    String processInstanceId = task.getProcessInstanceId();
   
    long expectedHistoryTaskInstances = -1;
    String schemaHistory = managementService.getProperties().get("schema.history");
    if (schemaHistory.startsWith("create(5.0)")) {
      expectedHistoryTaskInstances = 0;
    } else {
      expectedHistoryTaskInstances = 2;
    }
View Full Code Here

TOP

Related Classes of org.activiti.engine.ManagementService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.