View Javadoc

1   /*
2    * Copyright 2010 Fraunhofer Gesellschaft, Munich, Germany,
3    * for its Fraunhofer Institute for Computer Architecture and Software
4    * Technology (FIRST), Berlin, Germany. All rights reserved.
5    * http://www.first.fraunhofer.de/
6    */
7   
8   package net.kwfgrid.gworkflowdl.structure;
9   
10  import org.jdom.Element;
11  
12  import java.util.Iterator;
13  import java.util.List;
14  
15  /***
16   * User: hans
17   * Date: 28.03.2006
18   * Time: 13:40:34
19   */
20  public class OwlsJdom {
21      public static void java2element(Owls ho, Element e) {
22          String[] os = ho.getOwls();
23  
24          for (String o : os) {
25              final Element oe = new Element("owl", JdomString.wfSpace);
26              //final Element oe = new Element("owl");
27              oe.setText(o);
28              e.addContent(oe);
29          }
30      }
31  
32      public static void element2java(Element e, Owls ho) {
33  
34          List list = e.getChildren("owl", JdomString.wfSpace);
35          //List list = e.getChildren("owl");
36  
37          for (Object aList : list) {
38              final Element oe = (Element) aList;
39              ho.addOwl(oe.getText());
40          }
41      }
42  
43      //  ----------- oc-namespace
44  
45      public static void java2ocElement(Owls ho, Element e) {
46          String[] os = ho.getOwls();
47  
48          for (String o : os) {
49              final Element oe = new Element("owl", JdomString.ocSpace);
50              //final Element oe = new Element("owl");
51              oe.setText(o);
52              e.addContent(oe);
53          }
54      }
55  
56      public static void ocElement2java(Element e, Owls ho) {
57  
58          List list = e.getChildren("owl", JdomString.ocSpace);
59          //List list = e.getChildren("owl");
60  
61          for (Object aList : list) {
62              final Element oe = (Element) aList;
63              ho.addOwl(oe.getText());
64          }
65      }
66  }