001 package org.kuali.ole.ingest;
002
003 import com.thoughtworks.xstream.XStream;
004 import org.kuali.ole.ingest.pojo.*;
005
006 import java.io.IOException;
007 import java.net.URISyntaxException;
008
009 /**
010 * ProfileObjectGeneratorFromXML used to build the Profile based on fileContent
011 */
012 public class ProfileObjectGeneratorFromXML {
013 /**
014 * This method return Profile Object.
015 * This method build the Profile based on fileContent.
016 * @param fileContent
017 * @return Profile
018 * @throws URISyntaxException
019 * @throws IOException
020 */
021 public Profile buildProfileFromFileContent(String fileContent) throws URISyntaxException, IOException {
022 XStream xStream = new XStream();
023 xStream.alias("profile", Profile.class);
024 xStream.alias("attribute", ProfileAttributeBo.class);
025 xStream.alias("rule", OleRule.class);
026 xStream.alias("action", OleAction.class);
027 xStream.alias("routeTo", OleRoute.class);
028 xStream.alias("incomingField", MatchPoint.class);
029 xStream.alias("existingField", MatchPoint.class);
030 xStream.registerConverter(new ProfileAttributeConverter());
031 Object object = xStream.fromXML(fileContent);
032 return (Profile) object;
033 }
034 }