View Javadoc

1   package org.kuali.ole.ingest;
2   
3   import com.thoughtworks.xstream.converters.Converter;
4   import com.thoughtworks.xstream.converters.MarshallingContext;
5   import com.thoughtworks.xstream.converters.UnmarshallingContext;
6   import com.thoughtworks.xstream.io.HierarchicalStreamReader;
7   import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
8   import org.kuali.ole.ingest.pojo.ProfileAttributeBo;
9   
10  /**
11   * ProfileAttributeConverter converts the data into profileAttributeBo Object
12   */
13  public class ProfileAttributeConverter implements Converter {
14      @Override
15      public void marshal(Object o, HierarchicalStreamWriter hierarchicalStreamWriter, MarshallingContext marshallingContext) {
16  
17      }
18  
19      /**
20       *   This method converts the data into profileAttributeBo Object.
21       * @param hierarchicalStreamReader
22       * @param unmarshallingContext
23       * @return  profileAttributeBo
24       */
25      @Override
26      public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader, UnmarshallingContext unmarshallingContext) {
27          ProfileAttributeBo profileAttributeBo = new ProfileAttributeBo();
28          profileAttributeBo.setAttributeName(hierarchicalStreamReader.getAttribute("name"));
29          profileAttributeBo.setSystemValue(hierarchicalStreamReader.getAttribute("system"));
30          profileAttributeBo.setAttributeValue(hierarchicalStreamReader.getValue());
31          return profileAttributeBo;
32      }
33  
34      /**
35       *  This method returns True/False.
36       *  This method checks whether the class is ProfileAttributeBo class or not.
37       * @param aClass
38       * @return  boolean
39       */
40      @Override
41      public boolean canConvert(Class aClass) {
42          return aClass.equals(ProfileAttributeBo.class);
43      }
44  }