| 1 |  |  package org.kuali.student.lum.common.client.lo; | 
  | 2 |  |   | 
  | 3 |  |  import org.kuali.student.core.assembly.data.Data; | 
  | 4 |  |  import org.kuali.student.core.assembly.data.Data.StringKey; | 
  | 5 |  |  import org.kuali.student.core.dto.MetaInfo; | 
  | 6 |  |  import org.kuali.student.core.dto.RichTextInfo; | 
  | 7 |  |  import org.kuali.student.lum.lo.dto.LoCategoryInfo; | 
  | 8 |  |   | 
  | 9 |  |  import java.util.Date; | 
  | 10 |  |   | 
  | 11 | 0 |  public class CategoryDataUtil { | 
  | 12 |  |       | 
  | 13 |  |      public static Data toData(LoCategoryInfo loCategoryInfo) { | 
  | 14 | 0 |          LoCategoryInfoHelper catHelper = new LoCategoryInfoHelper(); | 
  | 15 | 0 |          catHelper.setId(loCategoryInfo.getId()); | 
  | 16 | 0 |          catHelper.setName(loCategoryInfo.getName()); | 
  | 17 | 0 |          RichTextInfoHelper catRTHelper = RichTextInfoHelper.wrap(new Data()); | 
  | 18 | 0 |          RichTextInfo catRT = loCategoryInfo.getDesc(); | 
  | 19 | 0 |          if (null != catRT) { | 
  | 20 | 0 |              catRTHelper.setFormatted(loCategoryInfo.getDesc().getFormatted()); | 
  | 21 | 0 |              catRTHelper.setPlain(loCategoryInfo.getDesc().getPlain()); | 
  | 22 |  |          } | 
  | 23 | 0 |          catHelper.setDesc(catRTHelper.getData()); | 
  | 24 | 0 |          catHelper.setLoRepository(loCategoryInfo.getLoRepository()); | 
  | 25 | 0 |          catHelper.setEffectiveDate(loCategoryInfo.getEffectiveDate()); | 
  | 26 | 0 |          catHelper.setExpirationDate(loCategoryInfo.getExpirationDate()); | 
  | 27 |  |           | 
  | 28 |  |   | 
  | 29 |  |   | 
  | 30 |  |   | 
  | 31 | 0 |          catHelper.setState(loCategoryInfo.getState()); | 
  | 32 | 0 |          catHelper.setType(loCategoryInfo.getType()); | 
  | 33 |  |   | 
  | 34 | 0 |          MetaInfo mInfo = loCategoryInfo.getMetaInfo(); | 
  | 35 | 0 |          if (mInfo != null) { | 
  | 36 | 0 |              MetaInfoHelper metaHelper = MetaInfoHelper.wrap(new Data()); | 
  | 37 | 0 |              metaHelper.setCreateId(mInfo.getCreateId()); | 
  | 38 | 0 |              metaHelper.setCreateTime(mInfo.getCreateTime()); | 
  | 39 | 0 |              metaHelper.setUpdateId(mInfo.getUpdateId()); | 
  | 40 | 0 |              metaHelper.setUpdateTime(mInfo.getUpdateTime()); | 
  | 41 | 0 |              metaHelper.setVersionInd(mInfo.getVersionInd()); | 
  | 42 | 0 |              catHelper.setMetaInfo(metaHelper.getData()); | 
  | 43 |  |        } | 
  | 44 |  |          | 
  | 45 |  |    | 
  | 46 |  |           | 
  | 47 |  |           | 
  | 48 |  |           | 
  | 49 | 0 |          return catHelper.getData(); | 
  | 50 |  |      } | 
  | 51 |  |       | 
  | 52 |  |      public static LoCategoryInfo toLoCategoryInfo(Data categoryData) { | 
  | 53 | 0 |          LoCategoryInfo catInfo = null; | 
  | 54 | 0 |          if (categoryData != null) { | 
  | 55 | 0 |              LoCategoryInfoHelper catHelper = new LoCategoryInfoHelper(categoryData); | 
  | 56 | 0 |              catInfo = new LoCategoryInfo(); | 
  | 57 | 0 |              catInfo.setId(catHelper.getId()); | 
  | 58 | 0 |              RichTextHelper rtHelper = new RichTextHelper(catHelper.getDesc()); | 
  | 59 |  |               | 
  | 60 | 0 |              if (null != catHelper) { | 
  | 61 | 0 |                  RichTextInfo descInfo = new RichTextInfo(); | 
  | 62 | 0 |                  descInfo.setFormatted(rtHelper.getFormatted()); | 
  | 63 | 0 |                  descInfo.setPlain(rtHelper.getPlain()); | 
  | 64 | 0 |                  catInfo.setDesc(descInfo); | 
  | 65 |  |              } | 
  | 66 | 0 |              catInfo.setEffectiveDate(catHelper.getEffectiveDate()); | 
  | 67 | 0 |              catInfo.setExpirationDate(catHelper.getExpirationDate()); | 
  | 68 | 0 |              catInfo.setLoRepository(catHelper.getLoRepository()); | 
  | 69 |  |               | 
  | 70 |  |               | 
  | 71 |  |               | 
  | 72 | 0 |              catInfo.setName(catHelper.getName()); | 
  | 73 | 0 |              catInfo.setState(catHelper.getState()); | 
  | 74 | 0 |              catInfo.setType(catHelper.getType()); | 
  | 75 |  |               | 
  | 76 |  |               | 
  | 77 |  |               | 
  | 78 |  |   | 
  | 79 | 0 |              MetaInfo metaInfo = new MetaInfo(); | 
  | 80 | 0 |              MetaInfoHelper metaHelper = MetaInfoHelper.wrap(catHelper.getMetaInfo()); | 
  | 81 |  |   | 
  | 82 | 0 |              if (metaHelper != null) { | 
  | 83 | 0 |                      metaInfo.setCreateId(metaHelper.getCreateId()); | 
  | 84 | 0 |                      metaInfo.setCreateTime(metaHelper.getCreateTime()); | 
  | 85 | 0 |                      metaInfo.setUpdateId(metaHelper.getUpdateId()); | 
  | 86 | 0 |                      metaInfo.setUpdateTime(metaHelper.getUpdateTime()); | 
  | 87 | 0 |                      metaInfo.setVersionInd(metaHelper.getVersionInd()); | 
  | 88 | 0 |                      catInfo.setMetaInfo(metaInfo); | 
  | 89 |  |              } | 
  | 90 |  |          } | 
  | 91 | 0 |          return catInfo; | 
  | 92 |  |      } | 
  | 93 |  |       | 
  | 94 |  |  } |