View Javadoc
1   /**
2    * Copyright 2012 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   * Created by bobhurt on 8/14/12
16   */
17  package org.kuali.student.common.kitchensink;
18  
19  import org.kuali.student.r2.common.util.date.DateFormatters;
20  
21  import java.util.ArrayList;
22  import java.util.Date;
23  import java.util.List;
24  
25  /**
26   * This class just holds fields for the collection properties in KitchenSinkForm
27   *
28   * @author Kuali Student Team
29   */
30  public class KitchenSinkFormCollection1 {
31  
32      private Boolean selected;
33      private Integer id;
34      private String name;
35      private String description;
36      private Date date;
37      private List<KitchenSinkFormCollection2> list1;
38      private List<KitchenSinkFormCollection2> list3;
39  
40      public KitchenSinkFormCollection1() {
41      }
42  
43      public KitchenSinkFormCollection1(KitchenSinkFormCollection1 collection) {
44          this.selected = collection.getSelected();
45          this.id = collection.getId();
46          this.name = collection.getName();
47          this.description = collection.getDescription();
48          this.date = collection.getDate();
49      }
50  
51      public KitchenSinkFormCollection1(String name, String description, String dateString) {
52          this.id = ++count;
53          this.name = name;
54          this.description = description;
55          try {
56              this.date = DateFormatters.DEFAULT_DATE_FORMATTER.parse(dateString);
57          } catch (IllegalArgumentException ex) {
58              this.date = new Date();
59          }
60      }
61  
62      public Boolean getSelected() {
63          return selected;
64      }
65  
66      public void setSelected(Boolean selected) {
67          this.selected = selected;
68      }
69  
70      public Integer getId() {
71          return id;
72      }
73  
74      public void setId(Integer id) {
75          this.id = id;
76      }
77  
78      public String getName() {
79          return name;
80      }
81  
82      public void setName(String name) {
83          this.name = name;
84      }
85  
86      public String getDescription() {
87          return description;
88      }
89  
90      public void setDescription(String description) {
91          this.description = description;
92      }
93  
94      public Date getDate() {
95          return date;
96      }
97  
98      public void setDate(Date date) {
99          this.date = date;
100     }
101 
102     public List<KitchenSinkFormCollection2> getList1() {
103         return list1;
104     }
105 
106     public void setList1(List<KitchenSinkFormCollection2> list1) {
107         this.list1 = list1;
108     }
109 
110     public List<KitchenSinkFormCollection2> getList3() {
111         return list3;
112     }
113 
114     public void setList3(List<KitchenSinkFormCollection2> list3) {
115         this.list3 = list3;
116     }
117 
118     // --- STATIC METHODS ---
119 
120     private static Integer count = 0;
121 
122     public static Integer assignId() {
123         return ++count;
124     }
125 
126     public static List<KitchenSinkFormCollection1> clone(List<KitchenSinkFormCollection1> collection1List) {
127         List<KitchenSinkFormCollection1> clonedList = new ArrayList<KitchenSinkFormCollection1>(collection1List.size());
128         for (KitchenSinkFormCollection1 collection : collection1List) {
129             clonedList.add(new KitchenSinkFormCollection1(collection));
130         }
131         return clonedList;
132     }
133 }