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
11
12 public class KrmsObjectGeneratorFromXML {
13
14
15
16
17
18
19
20
21 public Krms buildKrmsFromFileContent(String fileContent) throws URISyntaxException, IOException {
22 XStream xStream = new XStream();
23 xStream.alias("krms", Krms.class);
24 xStream.alias("agenda", OleAgenda.class);
25 xStream.alias("attribute", ProfileAttributeBo.class);
26 xStream.alias("rule", KrmsRule.class);
27 xStream.alias("proposition",KrmsProposition.class);
28 xStream.alias("compoundProposition",OleProposition.class);
29 xStream.alias("action", KrmsAction.class);
30 xStream.addImplicitCollection(Krms.class,"oleAgendaList");
31 xStream.addImplicitCollection(OleProposition.class,"propositions",KrmsProposition.class);
32 xStream.addImplicitCollection(OleProposition.class,"olePropositions",OleProposition.class);
33 xStream.registerConverter(new ProfileAttributeConverter());
34 Object object = xStream.fromXML(fileContent);
35 return (Krms) object;
36 }
37 }