001    package org.kuali.ole.patron.merge.controller;
002    
003    import com.thoughtworks.xstream.XStream;
004    import org.kuali.ole.patron.merge.bo.OleConfigDocument;
005    import org.kuali.ole.patron.merge.bo.OlePatronConfig;
006    
007    import java.io.IOException;
008    import java.net.URISyntaxException;
009    import java.util.HashMap;
010    
011    /**
012     * Created with IntelliJ IDEA.
013     * User: vivekb
014     * Date: 8/22/12
015     * Time: 3:04 PM
016     * To change this template use File | Settings | File Templates.
017     */
018    public class OlePatronConfigObjectGeneratorFromXML {
019        /**
020         *  This method returns PatronConfig object from fileContent.
021         *  The xStream will convert the fileContent into PatronConfig Object.
022         * @param fileContent
023         * @return PatronConfig object
024         * @throws java.net.URISyntaxException
025         * @throws java.io.IOException
026         */
027    
028        public OlePatronConfig buildKrmsFromFileContent(String fileContent) throws URISyntaxException, IOException {
029            XStream xStream = new XStream();
030            xStream.alias("patronConfig", OlePatronConfig.class);
031            xStream.alias("document", OleConfigDocument.class);
032            Object object = xStream.fromXML(fileContent);
033            return (OlePatronConfig) object;
034        }
035    }