View Javadoc
1   package org.kuali.ole.ingest;
2   
3   import com.thoughtworks.xstream.XStream;
4   import org.kuali.ole.ingest.pojo.*;
5   
6   import java.io.IOException;
7   import java.net.URISyntaxException;
8   
9   /**
10   * ProfileObjectGeneratorFromXML used to build the Profile based on fileContent
11   */
12  public class ProfileObjectGeneratorFromXML {
13      /**
14       * This method return Profile Object.
15       * This method build the Profile based on fileContent.
16       * @param fileContent
17       * @return  Profile
18       * @throws java.net.URISyntaxException
19       * @throws java.io.IOException
20       */
21      public Profile buildProfileFromFileContent(String fileContent) throws URISyntaxException, IOException {
22          XStream xStream = new XStream();
23          xStream.alias("profile", Profile.class);
24          xStream.alias("attribute", ProfileAttributeBo.class);
25          xStream.alias("rule", OleRule.class);
26          xStream.alias("action", OleAction.class);
27          xStream.alias("routeTo", OleRoute.class);
28          xStream.alias("incomingField", MatchPoint.class);
29          xStream.alias("existingField", MatchPoint.class);
30          xStream.registerConverter(new ProfileAttributeConverter());
31          Object object = xStream.fromXML(fileContent);
32          return (Profile) object;
33      }
34  }