View Javadoc

1   /*
2    * @(#)$Id: JdomBatchAlgorithm.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author		:	Ueli Kurmann, igesture@uelikurmann.ch
5    *                  
6    *
7    * Purpose		: 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date				Who			Reason
14   *
15   * 15.10.2008		ukurmann	Initial Release
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  
27  package org.ximtec.igesture.batch.core.jdom;
28  
29  import java.util.List;
30  
31  import org.jdom.Element;
32  import org.ximtec.igesture.batch.core.BatchAlgorithm;
33  
34  
35  
36  /**
37   * Comment
38   * @version 1.0 15.10.2008
39   * @author Ueli Kurmann
40   */
41  public class JdomBatchAlgorithm {
42     
43     public static String ROOT_TAG = "algorithm";
44  
45     public static String ATTRIBUTE_NAME = "name";
46     
47     
48     @SuppressWarnings("unchecked")
49     public static BatchAlgorithm unmarshal(Element algorithm) {
50        final BatchAlgorithm batchAlgorithm = new BatchAlgorithm();
51        batchAlgorithm.setName(algorithm
52              .getAttributeValue(ATTRIBUTE_NAME));
53  
54        final List<Element> parameterElements = algorithm
55              .getChildren(JdomBatchParameter.ROOT_TAG);
56  
57        for (final Element elem : parameterElements) {
58           batchAlgorithm.addParameter(JdomBatchParameter.unmarshal(elem));
59        }
60  
61        return batchAlgorithm;
62     } // unmarshal
63  
64  }