View Javadoc

1   /*
2    * Copyright 2011-2013 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  package org.kuali.mobility.academics.util;
16  
17  import org.apache.commons.collections.Transformer;
18  import org.kuali.mobility.academics.entity.Section;
19  import org.kuali.mobility.academics.entity.SectionImpl;
20  
21  /**
22   *
23   * @author Joe Swanson <joseswan@umich.edu>
24   */
25  public class SectionTransform implements Transformer {
26  
27      @Override
28      public SectionImpl transform( Object obj ) {
29          SectionImpl proxy = null;
30  
31          if( obj instanceof SectionImpl ) {
32              proxy = (SectionImpl)obj;
33  			proxy.setSectionUID(null);
34          } else if( obj instanceof Section ) {
35              proxy = new SectionImpl();
36              proxy.setAvailableSeats( ((Section)obj).getAvailableSeats() );
37              proxy.setClassTopic( ((Section)obj).getClassTopic() );
38              proxy.setCourseDescription(((Section)obj).getCourseDescription());
39              proxy.setAdditionalInfo(((Section)obj).getAdditionalInfo());
40              proxy.setCombinedSectionId( ((Section)obj).getCombinedSectionId() );
41              proxy.setCreditHours( ((Section)obj).getCreditHours() );
42              proxy.setEnrollmentCapacity( ((Section)obj).getEnrollmentCapacity() );
43              proxy.setEnrollmentStatus( ((Section)obj).getEnrollmentStatus() );
44              proxy.setEnrollmentTotal( ((Section)obj).getEnrollmentTotal() );
45              proxy.setNumber( ((Section)obj).getNumber() );
46              proxy.setSessionDescription( ((Section)obj).getSessionDescription() );
47              proxy.setType( ((Section)obj).getType() );
48              proxy.setTypeDescription( ((Section)obj).getTypeDescription() );
49              proxy.setWaitCapacity( ((Section)obj).getWaitCapacity() );
50              proxy.setWaitTotal( ((Section)obj).getWaitTotal() );
51              proxy.setTermId( ((Section)obj).getTermId() );
52              proxy.setCatalogNumber( ((Section)obj).getCatalogNumber() );
53              proxy.setSubjectId( ((Section)obj).getSubjectId() );
54              proxy.setMeetings( ((Section)obj).getMeetings() );
55  
56  			proxy.setSectionUID(null);
57          }
58          return proxy;
59      }
60  }