1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.events.util;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.commons.collections.CollectionUtils;
22 import org.apache.commons.collections.Transformer;
23 import org.kuali.mobility.events.entity.Category;
24 import org.kuali.mobility.events.entity.CategoryImpl;
25 import org.kuali.mobility.events.entity.DayImpl;
26
27
28
29
30
31 public class CategoryTransform implements Transformer {
32
33 @Override
34 public CategoryImpl transform( Object obj ) {
35 CategoryImpl proxy = null;
36
37 if( obj instanceof Category ) {
38 proxy = new CategoryImpl();
39 proxy.setCategoryId(((Category)obj).getCategoryId());
40 proxy.setCampus(((Category)obj).getCampus());
41 proxy.setOrder(((Category)obj).getOrder());
42 proxy.setReturnPage(((Category)obj).getReturnPage());
43 proxy.setTitle(((Category)obj).getTitle());
44 proxy.setUrlString(((Category)obj).getUrlString());
45
46 List<DayImpl> days = new ArrayList<DayImpl>();
47 CollectionUtils.collect(((Category)obj).getDays(), new DayTransform(), days );
48 proxy.setDays(days);
49 }
50
51 return proxy;
52 }
53
54 }