001package org.kuali.ole.deliver.controller; 002 003import com.thoughtworks.xstream.XStream; 004import org.kuali.ole.deliver.bo.OleConfigDocument; 005import org.kuali.ole.deliver.bo.OlePatronConfig; 006 007import java.io.IOException; 008import java.net.URISyntaxException; 009 010/** 011 * Created with IntelliJ IDEA. 012 * User: vivekb 013 * Date: 8/22/12 014 * Time: 3:04 PM 015 * To change this template use File | Settings | File Templates. 016 */ 017public class OlePatronConfigObjectGeneratorFromXML { 018 /** 019 * This method returns PatronConfig object from fileContent. 020 * The xStream will convert the fileContent into PatronConfig Object. 021 * 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}