View Javadoc

1   package org.kuali.ole.patron.merge.controller;
2   
3   import com.thoughtworks.xstream.XStream;
4   import org.kuali.ole.patron.merge.bo.OleConfigDocument;
5   import org.kuali.ole.patron.merge.bo.OlePatronConfig;
6   
7   import java.io.IOException;
8   import java.net.URISyntaxException;
9   import java.util.HashMap;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: vivekb
14   * Date: 8/22/12
15   * Time: 3:04 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class OlePatronConfigObjectGeneratorFromXML {
19      /**
20       *  This method returns PatronConfig object from fileContent.
21       *  The xStream will convert the fileContent into PatronConfig Object.
22       * @param fileContent
23       * @return PatronConfig object
24       * @throws java.net.URISyntaxException
25       * @throws java.io.IOException
26       */
27  
28      public OlePatronConfig buildKrmsFromFileContent(String fileContent) throws URISyntaxException, IOException {
29          XStream xStream = new XStream();
30          xStream.alias("patronConfig", OlePatronConfig.class);
31          xStream.alias("document", OleConfigDocument.class);
32          Object object = xStream.fromXML(fileContent);
33          return (OlePatronConfig) object;
34      }
35  }