Package org.activiti.engine.impl.bpmn.parser

Examples of org.activiti.engine.impl.bpmn.parser.BpmnParse


      if (isBpmnResource(resourceName)) {
        ResourceEntity resource = resources.get(resourceName);
        byte[] bytes = resource.getBytes();
        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
       
        BpmnParse bpmnParse = bpmnParser
          .createParse()
          .sourceInputStream(inputStream)
          .deployment(deployment)
          .name(resourceName);
       
        if (deploymentSettings != null) {
         
          // Schema validation if needed
          if (deploymentSettings.containsKey(DeploymentSettings.IS_BPMN20_XSD_VALIDATION_ENABLED)) {
            bpmnParse.setValidateSchema((Boolean) deploymentSettings.get(DeploymentSettings.IS_BPMN20_XSD_VALIDATION_ENABLED));
          }
         
          // Process validation if needed
          if (deploymentSettings.containsKey(DeploymentSettings.IS_PROCESS_VALIDATION_ENABLED)) {
            bpmnParse.setValidateProcess((Boolean) deploymentSettings.get(DeploymentSettings.IS_PROCESS_VALIDATION_ENABLED));
          }
         
        } else {
          // On redeploy, we assume it is validated at the first deploy
          bpmnParse.setValidateSchema(false);
          bpmnParse.setValidateProcess(false);
        }
       
        bpmnParse.execute();
       
        for (ProcessDefinitionEntity processDefinition: bpmnParse.getProcessDefinitions()) {
          processDefinition.setResourceName(resourceName);
         
          if (deployment.getTenantId() != null) {
            processDefinition.setTenantId(deployment.getTenantId()); // process definition inherits the tenant id
          }
         
          String diagramResourceName = getDiagramResourceForProcess(resourceName, processDefinition.getKey(), resources);
                  
          // Only generate the resource when deployment is new to prevent modification of deployment resources
          // after the process-definition is actually deployed. Also to prevent resource-generation failure every
          // time the process definition is added to the deployment-cache when diagram-generation has failed the first time.
          if(deployment.isNew()) {
            if (processEngineConfiguration.isCreateDiagramOnDeploy() &&
                  diagramResourceName==null && processDefinition.isGraphicalNotationDefined()) {
              try {
                  byte[] diagramBytes = IoUtil.readInputStream(processEngineConfiguration.
                    getProcessDiagramGenerator().generateDiagram(bpmnParse.getBpmnModel(), "png", processEngineConfiguration.getActivityFontName(),
                        processEngineConfiguration.getLabelFontName(), processEngineConfiguration.getClassLoader()), null);
                  diagramResourceName = getProcessImageResourceName(resourceName, processDefinition.getKey(), "png");
                  createResource(diagramResourceName, diagramBytes, deployment);
              } catch (Throwable t) { // if anything goes wrong, we don't store the image (the process will still be executable).
                LOG.warn("Error while generating process diagram, image will not be stored in repository", t);
View Full Code Here


public class MessageEventDefinitionWithExtensionElementsTest {

  @Test
  public void testParseMessagedDefinitionWithExtension() {
    BpmnParse bpmnParseMock = Mockito.mock(BpmnParse.class);
    MessageEventDefinition messageEventDefinitionMock = Mockito.mock(MessageEventDefinition.class);
    BpmnModel bpmnModelMock = Mockito.mock(BpmnModel.class);
    Message messageMock = Mockito.mock(Message.class);
    @SuppressWarnings("unchecked")
    Map<String,List<ExtensionElement>> extensionElementMap = Mockito.mock(Map.class);
   
    Mockito.when(bpmnParseMock.getBpmnModel()).thenReturn(bpmnModelMock);
    Mockito.when(messageEventDefinitionMock.getMessageRef()).thenReturn("messageId");
    Mockito.when(bpmnModelMock.containsMessageId("messageId")).thenReturn(true);
    Mockito.when(bpmnModelMock.getMessage("messageId")).thenReturn(messageMock);
    Mockito.when(messageMock.getName()).thenReturn("MessageWithExtensionElements");
    Mockito.when(messageMock.getExtensionElements()).thenReturn(extensionElementMap);
View Full Code Here

* @author Nico Rehwaldt
*/
public class DefaultBpmnParseFactory implements BpmnParseFactory {

  public BpmnParse createBpmnParse(BpmnParser bpmnParser) {
    return new BpmnParse(bpmnParser);
  }
View Full Code Here

      if (isBpmnResource(resourceName)) {
        ResourceEntity resource = resources.get(resourceName);
        byte[] bytes = resource.getBytes();
        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
       
        BpmnParse bpmnParse = bpmnParser
          .createParse()
          .sourceInputStream(inputStream)
          .deployment(deployment)
          .name(resourceName);
       
        if (!deployment.isValidatingSchema()) {
          bpmnParse.setSchemaResource(null);
        }
       
        bpmnParse.execute();
       
        for (ProcessDefinitionEntity processDefinition: bpmnParse.getProcessDefinitions()) {
          processDefinition.setResourceName(resourceName);
         
          String diagramResourceName = getDiagramResourceForProcess(resourceName, processDefinition.getKey(), resources);
                  
          // Only generate the resource when deployment is new to prevent modification of deployment resources
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.bpmn.parser.BpmnParse

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.