Package org.activiti.engine.impl.persistence.entity

Examples of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity


  public NeedsActiveProcessDefinitionCmd(String processDefinitionId) {
    this.processDefinitionId = processDefinitionId;
  }
 
  public T execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext
            .getProcessEngineConfiguration()
            .getDeploymentManager()
            .findDeployedProcessDefinitionById(processDefinitionId);

    if (processDefinition == null) {
      throw new ActivitiObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class);
    }
   
    if (processDefinition.isSuspended()) {
      throw new ActivitiException("Cannot execute operation because process definition '"
              + processDefinition.getName() + "' (id=" + processDefinition.getId() + ") is supended");
    }
   
    return execute(commandContext, processDefinition);
  }
View Full Code Here


      throw new ActivitiIllegalArgumentException("userId and groupId cannot both be null");
    }
  }
 
  public Void execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext
        .getProcessDefinitionEntityManager()
        .findProcessDefinitionById(processDefinitionId);
     
    if (processDefinition == null) {
      throw new ActivitiObjectNotFoundException("Cannot find process definition with id " + processDefinitionId, ProcessDefinition.class);
    }
   
    processDefinition.deleteIdentityLink(userId, groupId);
   
    return null
  }
View Full Code Here

      throw new ActivitiIllegalArgumentException("userId and groupId cannot both be null");
    }
  }
 
  public Void execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext
      .getProcessDefinitionEntityManager()
      .findProcessDefinitionById(processDefinitionId);
   
    if (processDefinition == null) {
      throw new ActivitiObjectNotFoundException("Cannot find process definition with id " + processDefinitionId, ProcessDefinition.class);
    }
   
    processDefinition.addIdentityLink(userId, groupId);
   
    return null
  }
View Full Code Here

    DeploymentManager deploymentCache = commandContext
      .getProcessEngineConfiguration()
      .getDeploymentManager();
   
    // Find the process definition
    ProcessDefinitionEntity processDefinition = null;
    if (processDefinitionId!=null) {
      processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
      if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class);
      }
    } else if (processDefinitionKey != null && (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId))){
      processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKey(processDefinitionKey);
      if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("No process definition found for key '" + processDefinitionKey +"'", ProcessDefinition.class);
      }
    } else if (processDefinitionKey != null && tenantId != null && !ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {
       processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);
       if (processDefinition == null) {
         throw new ActivitiObjectNotFoundException("No process definition found for key '" + processDefinitionKey +"' for tenant identifier " + tenantId, ProcessDefinition.class);
       }
    } else {
      throw new ActivitiIllegalArgumentException("processDefinitionKey and processDefinitionId are null");
    }
   
    // Do not start process a process instance if the process definition is suspended
    if (processDefinition.isSuspended()) {
      throw new ActivitiException("Cannot start process instance. Process definition "
              + processDefinition.getName() + " (id = " + processDefinition.getId() + ") is suspended");
    }

    // Start the process instance
    ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey);

    // now set the variables passed into the start command
    if (variables != null) {
      processInstance.setVariables(variables);
    }
View Full Code Here

    this.processDefinitionId = processDefinitionId;
    this.formEngineName = formEngineName;
  }

  public Object execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext
      .getProcessEngineConfiguration()
      .getDeploymentManager()
      .findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null) {
      throw new ActivitiObjectNotFoundException("Process Definition '" + processDefinitionId +"' not found", ProcessDefinition.class);
    }
    StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
    if (startFormHandler == null) {
      return null;
    }
   
    FormEngine formEngine = commandContext
View Full Code Here

       
    DeploymentManager deploymentCache = commandContext
            .getProcessEngineConfiguration()
            .getDeploymentManager();
         
    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class);
    }
 
    ActivityImpl startActivity = processDefinition.findActivity(messageEventSubscription.getActivityId());
    ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, startActivity);

    if (processVariables != null) {
      processInstance.setVariables(processVariables);
    }
   
View Full Code Here

  protected void addProcessImage(ProcessDefinition processDefinition, HistoricProcessInstance processInstance) {
    if(currentEmbedded != null) {
      mainPanel.removeComponent(currentEmbedded);
    }
   
    ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
      .getDeployedProcessDefinition(processDefinition.getId());

    // Only show when graphical notation is defined
    if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) {
     
      if(imageHeader == null) {
        imageHeader = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
        imageHeader.addStyleName(ExplorerLayout.STYLE_H3);
        imageHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
View Full Code Here

   
    panelLayout.addComponent(header);
  }
 
  protected void addProcessImage() {
    ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
      .getDeployedProcessDefinition(processDefinition.getId());

    // Only show when graphical notation is defined
    if (processDefinitionEntity != null) {
     
      boolean didDrawImage = false;
     
      if (ExplorerApp.get().isUseJavascriptDiagram()) {
        try {
         
          final InputStream definitionStream = repositoryService.getResourceAsStream(
              processDefinition.getDeploymentId(), processDefinition.getResourceName());
          XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory();
          XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream);
          BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
         
          if (!bpmnModel.getFlowLocationMap().isEmpty()) {
           
            int maxX = 0;
            int maxY = 0;
            for (String key : bpmnModel.getLocationMap().keySet()) {
              GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key);
              double elementX = graphicInfo.getX() + graphicInfo.getWidth();
              if (maxX < elementX) {
                maxX = (int) elementX;
              }
              double elementY = graphicInfo.getY() + graphicInfo.getHeight();
              if (maxY < elementY) {
                maxY = (int) elementY;
              }
            }
           
            Panel imagePanel = new Panel(); // using panel for scrollbars
            imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
            imagePanel.setWidth(100, UNITS_PERCENTAGE);
            imagePanel.setHeight(100, UNITS_PERCENTAGE);
            URL explorerURL = ExplorerApp.get().getURL();
            URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") +
                "diagram-viewer/index.html?processDefinitionId=" + processDefinition.getId() + "&processInstanceId=" + processInstance.getId());
            Embedded browserPanel = new Embedded("", new ExternalResource(url));
            browserPanel.setType(Embedded.TYPE_BROWSER);
            browserPanel.setWidth(maxX + 350 + "px");
            browserPanel.setHeight(maxY + 220 + "px");
           
            HorizontalLayout panelLayoutT = new HorizontalLayout();
            panelLayoutT.setSizeUndefined();
            imagePanel.setContent(panelLayoutT);
            imagePanel.addComponent(browserPanel);
           
            panelLayout.addComponent(imagePanel);
           
            didDrawImage = true;
          }
         
        } catch (Exception e) {
          LOGGER.error("Error loading process diagram component", e);
        }
      }
     
      if(!didDrawImage && processDefinitionEntity.isGraphicalNotationDefined()) {
        ProcessEngineConfiguration processEngineConfiguration = ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration();
        ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
        StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
          .buildStreamResource(processInstance, repositoryService, runtimeService, diagramGenerator, processEngineConfiguration);
 
View Full Code Here

  @Deployment
  public void testParseDiagramInterchangeElements() {

    // Graphical information is not yet exposed publicly, so we need to do some plumbing
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
      public ProcessDefinitionEntity execute(CommandContext commandContext) {
        return Context
          .getProcessEngineConfiguration()
          .getDeploymentManager()
          .findDeployedLatestProcessDefinitionByKey("myProcess");
      }
    });
   
    assertNotNull(processDefinitionEntity);
    assertEquals(7, processDefinitionEntity.getActivities().size());
   
    // Check if diagram has been created based on Diagram Interchange when it's not a headless instance
    List<String> resourceNames = repositoryService.getDeploymentResourceNames(processDefinitionEntity.getDeploymentId());
    assertEquals(2, resourceNames.size());
   
    for (ActivityImpl activity : processDefinitionEntity.getActivities()) {
     
      if (activity.getId().equals("theStart")) {
        assertActivityBounds(activity, 70, 255, 30, 30);
      } else if (activity.getId().equals("task1")) {
        assertActivityBounds(activity, 176, 230, 100, 80);
View Full Code Here

  }
 
  @Deployment
  public void testParseNamespaceInConditionExpressionType() {
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
      public ProcessDefinitionEntity execute(CommandContext commandContext) {
        return Context
          .getProcessEngineConfiguration()
          .getDeploymentManager()
          .findDeployedLatestProcessDefinitionByKey("resolvableNamespacesProcess");
      }
    });
   
    // Test that the process definition has been deployed
    assertNotNull(processDefinitionEntity);
    ActivityImpl activity = processDefinitionEntity.findActivity("ExclusiveGateway_1");
    assertNotNull(activity);
   
    // Test that the conditions has been resolved
    for (PvmTransition transition : activity.getOutgoingTransitions()) {
      if (transition.getDestination().getId().equals("Task_2")) {
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity

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.