Package org.dom4j

Examples of org.dom4j.Element


  public static List<OperationElement> getOperations(Element actEl) {
    List<OperationElement> operationXmls = new LinkedList<OperationElement>();
    List list = actEl.selectNodes(StarFlowNames.ACT_OPERATION);
    Iterator iter=list.iterator();
        while(iter.hasNext()){
            Element el = (Element)iter.next();
            OperationElement opXml = new OperationElement();
            opXml.setId(el.attributeValue(StarFlowNames.ACT_OPERATION_ID));
            opXml.setName(el.attributeValue(StarFlowNames.ACT_OPERATION_NAME));
            opXml.setCode(el.attributeValue(StarFlowNames.ACT_OPERATION_CODE));
            opXml.setAction(el.attributeValue(StarFlowNames.ACT_OPERATION_ACTION));
            operationXmls.add(opXml);
        }
        return operationXmls;
  }
View Full Code Here


  public static List<EventElement> getTriggerEvents(Element actEl) {
    List<EventElement> events = new LinkedList<EventElement>();
    List list = actEl.selectNodes("TriggerEvents/event");
    Iterator iter=list.iterator();
        while(iter.hasNext()){
            Element el = (Element)iter.next();
            EventElement event = new EventElement();
            event.setEventType(el.attributeValue("eventType"));
            event.setAction(el.attributeValue("action"));
            event.setInvokePattern(el.attributeValue("invokePattern"));
            event.setTransactionType(el.attributeValue("transactionType"));
            event.setExceptionStrategy(el.attributeValue("exceptionStrategy"));
            events.add(event);
        }
        return events;
  }
View Full Code Here

  public static List<FreeActElement> getActFreeActs(Element actEl) {
    List<FreeActElement> events = new CopyOnWriteArrayList<FreeActElement>();
    List list = actEl.selectNodes(StarFlowNames.ACT_FREE_ACT);
    Iterator iter=list.iterator();
        while(iter.hasNext()){
            Element el = (Element)iter.next();
            FreeActElement e = new FreeActElement();
            e.setId(el.attributeValue(StarFlowNames.ACT_FREE_ACT_ID));
            e.setName(el.attributeValue(StarFlowNames.ACT_FREE_ACT_NAME));
            e.setType(el.attributeValue(StarFlowNames.ACT_FREE_ACT_TYPE));
            events.add(e);
        }
        return events;
  }
View Full Code Here

  public static List<Participant> getActParticipants(Element actEl) {
    List<Participant> participants = new LinkedList<Participant>();
    List list = actEl.selectNodes(StarFlowNames.ACT_CHILD_PARTICIPANT);
    Iterator iter=list.iterator();
        while(iter.hasNext()){
            Element el = (Element)iter.next();
            Participant p = new Participant();
            p.setParticipant(el.attributeValue(StarFlowNames.ACT_CHILD_PARTICIPANT_ID));
            p.setParticipant2(el.attributeValue(StarFlowNames.ACT_CHILD_PARTICIPANT_NAME));
            p.setParticType(el.attributeValue(StarFlowNames.ACT_CHILD_PARTICIPANT_TYPE));
            participants.add(p);
        }
        return participants;
  }
View Full Code Here

    Map<String, String> map = new HashMap<String, String>();
   
    List list = el.selectNodes(StarFlowNames.FLOW_EXT_PROPERTY);
    Iterator iter=list.iterator();
        while(iter.hasNext()){
            Element e = (Element)iter.next();
            map.put(e.attributeValue("key"), e.attributeValue("value"));
        }
        return map;
  }
View Full Code Here

  public static ProcessDefine parserProcessInfo(ProcessDefine processDefine) {
    SAXReader reader = new SAXReader();
    Document document = null;
    try {
      document = reader.read(new StringReader(processDefine.getProcessDefContent()));
      Element rootElement = document.getRootElement();
      String _name = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_NAME);
      String _chname = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_CHNAME);
      String _version = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_VERSION);
      String _xpath = "/ProcessDefine/ProcessProperty/".concat(StarFlowNames.FLOW_CHILD_DESC);
      String _description = rootElement.selectSingleNode(_xpath).getText();
     
      _xpath = "/ProcessDefine/ProcessProperty/".concat(StarFlowNames.FLOW_CHILD_LIMITTIME);
      String _limitTime = rootElement.selectSingleNode(_xpath).getText();
     
      processDefine.setProcessDefName(_name);
     
      if(_chname != null)
        processDefine.setProcessCHName(_chname);
View Full Code Here

   * @param activityDefId
   * @return
   */
  public static Element parserActivityInfo(Document document, String activityDefId) {
    String _xpath = "/ProcessDefine/Activitys/Activity[@id='" + activityDefId + "']";
    Element element = (Element)document.selectSingleNode(_xpath);
    return element;
  }
View Full Code Here

   * @return
   */
  public static Element parserActivityInfo(String processDefContent, String activityDefId) {
    SAXReader reader = new SAXReader();
    Document document = null;
    Element element = null;
    try {
      document = reader.read(new StringReader(processDefContent));
      element = parserActivityInfo(document, activityDefId);
    } catch (Exception e) {
      throw new StarFlowParserException("流程定义信息不正确", e);
View Full Code Here

    processXml.setActivitys(queryActivityXmlInfo(processXml, document));
    return processXml;
  }
 
  private static void queryProcessXmlInfo(ProcessElement processXml, Document document) {
    Element rootElement = document.getRootElement();
    String name = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_NAME);
    String chname = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_CHNAME);
    String version = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_VERSION);
    String xpath = "/ProcessDefine/ProcessProperty/".concat(StarFlowNames.FLOW_CHILD_DESC);
    String description = rootElement.selectSingleNode(xpath).getText();
   
    xpath = "/ProcessDefine/ProcessProperty/".concat(StarFlowNames.FLOW_CHILD_LIMITTIME);
    String limitTime = rootElement.selectSingleNode(xpath).getText();
   
    processXml.setName(name);
   
    if(chname != null)
      processXml.setChname(chname);
    else
      processXml.setChname(name);
     
    processXml.setVersion(version);
    processXml.setDescription(description);
    processXml.setLimitTime(Long.parseLong(limitTime));
   
    Element node = (Element)rootElement.selectSingleNode("/ProcessDefine/ProcessProperty");
    processXml.setEvents(NodeUtil.getTriggerEvents(node));
    processXml.setProperties(NodeUtil.getExtProperties(node));
  }
View Full Code Here

     * @throws Exception
     */
    public void writeXmlFile(PdfSelectionTableItem[] rows, File selectedFile) throws Exception {
        if (selectedFile != null && rows != null) {
            Document document = DocumentHelper.createDocument();
            Element root = document.addElement("filelist");
            for (int i = 0; i < rows.length; i++) {
                PdfSelectionTableItem row = rows[i];
                Element node = (Element) root.addElement("file");
                node.addAttribute("value", row.getInputFile().getAbsolutePath());
                String pwd = row.getPassword();
                if (pwd != null && pwd.length() > 0) {
                    node.addAttribute("password", pwd);
                }
            }
            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(selectedFile));
            OutputFormat format = OutputFormat.createPrettyPrint();
            format.setEncoding("UTF-8");
View Full Code Here

TOP

Related Classes of org.dom4j.Element

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.