Package org.activiti.bpmn.exceptions

Examples of org.activiti.bpmn.exceptions.XMLException


    if (schema == null) {
      schema = factory.newSchema(BpmnXMLConverter.class.getClassLoader().getResource(BPMN_XSD));
    }
   
    if (schema == null) {
      throw new XMLException("BPMN XSD could not be found");
    }
    return schema;
  }
View Full Code Here


      while (xtr.hasNext()) {
        try {
          xtr.next();
        } catch(Exception e) {
          LOGGER.debug("Error reading XML document", e);
          throw new XMLException("Error reading XML", e);
        }

        if (xtr.isEndElement()  && ELEMENT_SUBPROCESS.equals(xtr.getLocalName())) {
          activeSubProcessList.remove(activeSubProcessList.size() - 1);
        }
       
        if (xtr.isEndElement()  && ELEMENT_TRANSACTION.equals(xtr.getLocalName())) {
          activeSubProcessList.remove(activeSubProcessList.size() - 1);
        }

        if (xtr.isStartElement() == false)
          continue;

        if (ELEMENT_DEFINITIONS.equals(xtr.getLocalName())) {
          definitionsParser.parse(xtr, model);
       
        } else if (ELEMENT_SIGNAL.equals(xtr.getLocalName())) {
          signalParser.parse(xtr, model);
         
        } else if (ELEMENT_MESSAGE.equals(xtr.getLocalName())) {
          messageParser.parse(xtr, model);
         
        } else if (ELEMENT_ERROR.equals(xtr.getLocalName())) {
         
          if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) {
            model.addError(xtr.getAttributeValue(null, ATTRIBUTE_ID),
                xtr.getAttributeValue(null, ATTRIBUTE_ERROR_CODE));
          }
         
        } else if (ELEMENT_IMPORT.equals(xtr.getLocalName())) {
          importParser.parse(xtr, model);
         
        } else if (ELEMENT_ITEM_DEFINITION.equals(xtr.getLocalName())) {
          itemDefinitionParser.parse(xtr, model);
         
        } else if (ELEMENT_DATA_STORE.equals(xtr.getLocalName())) {
          dataStoreParser.parse(xtr, model);
         
        } else if (ELEMENT_INTERFACE.equals(xtr.getLocalName())) {
          interfaceParser.parse(xtr, model);
         
        } else if (ELEMENT_IOSPECIFICATION.equals(xtr.getLocalName())) {
          ioSpecificationParser.parseChildElement(xtr, activeProcess, model);
         
        } else if (ELEMENT_PARTICIPANT.equals(xtr.getLocalName())) {
          participantParser.parse(xtr, model);
         
        } else if (ELEMENT_MESSAGE_FLOW.equals(xtr.getLocalName())) {
          messageFlowParser.parse(xtr, model);

        } else if (ELEMENT_PROCESS.equals(xtr.getLocalName())) {
         
          Process process = processParser.parse(xtr, model);
          if (process != null) {
            activeProcess = process; 
          }
       
        } else if (ELEMENT_POTENTIAL_STARTER.equals(xtr.getLocalName())) {
          potentialStarterParser.parse(xtr, activeProcess);
         
        } else if (ELEMENT_LANE.equals(xtr.getLocalName())) {
          laneParser.parse(xtr, activeProcess, model);
         
        } else if (ELEMENT_DOCUMENTATION.equals(xtr.getLocalName())) {
         
          BaseElement parentElement = null;
          if (!activeSubProcessList.isEmpty()) {
            parentElement = activeSubProcessList.get(activeSubProcessList.size() - 1);
          } else if (activeProcess != null) {
            parentElement = activeProcess;
          }
          documentationParser.parseChildElement(xtr, parentElement, model);
       
        } else if (activeProcess == null && ELEMENT_TEXT_ANNOTATION.equals(xtr.getLocalName())) {
          String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
          TextAnnotation textAnnotation = (TextAnnotation) new TextAnnotationXMLConverter().convertXMLToElement(xtr, model);
          textAnnotation.setId(elementId);
          model.getGlobalArtifacts().add(textAnnotation);
         
        } else if (activeProcess == null && ELEMENT_ASSOCIATION.equals(xtr.getLocalName())) {
          String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
          Association association = (Association) new AssociationXMLConverter().convertXMLToElement(xtr, model);
          association.setId(elementId);
          model.getGlobalArtifacts().add(association);
       
        } else if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
          extensionElementsParser.parse(xtr, activeSubProcessList, activeProcess, model);
       
        } else if (ELEMENT_SUBPROCESS.equals(xtr.getLocalName())) {
          subProcessParser.parse(xtr, activeSubProcessList, activeProcess);
         
        } else if (ELEMENT_TRANSACTION.equals(xtr.getLocalName())) {
          subProcessParser.parse(xtr, activeSubProcessList, activeProcess);
         
        } else if (ELEMENT_DI_SHAPE.equals(xtr.getLocalName())) {
          bpmnShapeParser.parse(xtr, model);
       
        } else if (ELEMENT_DI_EDGE.equals(xtr.getLocalName())) {
          bpmnEdgeParser.parse(xtr, model);

        } else {

          if (!activeSubProcessList.isEmpty() && ELEMENT_MULTIINSTANCE.equalsIgnoreCase(xtr.getLocalName())) {
           
            multiInstanceParser.parseChildElement(xtr, activeSubProcessList.get(activeSubProcessList.size() - 1), model);
           
          } else if (convertersToBpmnMap.containsKey(xtr.getLocalName())) {
            if (activeProcess != null) {
              BaseBpmnXMLConverter converter = convertersToBpmnMap.get(xtr.getLocalName());
              converter.convertToBpmnModel(xtr, model, activeProcess, activeSubProcessList);
            }
          }
        }
      }

      for (Process process : model.getProcesses()) {
        for (Pool pool : model.getPools()) {
          if (process.getId().equals(pool.getProcessRef())) {
            pool.setExecutable(process.isExecutable());
          }
        }
        processFlowElements(process.getFlowElements(), process);
      }
   
    } catch (XMLException e) {
      throw e;
     
    } catch (Exception e) {
      LOGGER.error("Error processing BPMN document", e);
      throw new XMLException("Error processing BPMN document", e);
    }
    return model;
  }
View Full Code Here

     
      return outputStream.toByteArray();
     
    } catch (Exception e) {
      LOGGER.error("Error writing BPMN XML", e);
      throw new XMLException("Error writing BPMN XML", e);
    }
  }
View Full Code Here

    } else {
   
      BaseBpmnXMLConverter converter = convertersToXMLMap.get(flowElement.getClass());
     
      if (converter == null) {
        throw new XMLException("No converter for " + flowElement.getClass() + " found");
      }
     
      converter.convertToXML(xtw, flowElement, model);
    }
  }
View Full Code Here

  private void createXML(Artifact artifact, BpmnModel model, XMLStreamWriter xtw) throws Exception {
   
    BaseBpmnXMLConverter converter = convertersToXMLMap.get(artifact.getClass());
     
    if (converter == null) {
      throw new XMLException("No converter for " + artifact.getClass() + " found");
    }
     
    converter.convertToXML(xtw, artifact, model);
  }
View Full Code Here

     
      return outputStream.toByteArray();
     
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, "Error writing BPMN XML", e);
      throw new XMLException("Error writing BPMN XML", e);
    }
  }
View Full Code Here

    } else {
   
      Class<? extends BaseBpmnXMLConverter> converter = convertersToXMLMap.get(flowElement.getClass());
     
      if (converter == null) {
        throw new XMLException("No converter for " + flowElement.getClass() + " found");
      }
     
      converter.newInstance().convertToXML(xtw, flowElement);
    }
  }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.exceptions.XMLException

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.