View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.lum.lu.ui.krms.dto;
17  
18  import org.kuali.student.r2.lum.clu.dto.CluSetInfo;
19  
20  import java.io.Serializable;
21  import java.util.ArrayList;
22  import java.util.HashMap;
23  import java.util.List;
24  import java.util.Map;
25  
26  /**
27   * @author Kuali Student Team
28   */
29  public class ProgramCluSetInformation implements Serializable {
30  
31      private static final long serialVersionUID = 1123124L;
32      private CluSetInfo cluSetInfo;
33      private List<CluInformation> clus;
34      private List<CluSetInfo> cluSets;
35      private Map<String, ProgramCluSetInformation> subCluSetInformations;
36      private ProgramCluSetInformation parent;
37  
38      private List<CluSetRangeInformation> cluSetRange;
39  
40      public CluSetInfo getCluSetInfo() {
41          return cluSetInfo;
42      }
43  
44      public void setCluSetInfo(CluSetInfo cluSetInfo) {
45          this.cluSetInfo = cluSetInfo;
46      }
47  
48      public List<CluInformation> getClus() {
49          if (clus == null) {
50              this.clus = new ArrayList<CluInformation>();
51          }
52          return this.clus;
53      }
54  
55      public void setClus(List<CluInformation> clus) {
56          this.clus = clus;
57      }
58  
59      public List<CluSetInfo> getCluSets() {
60          if (this.cluSets == null) {
61              this.cluSets = new ArrayList<CluSetInfo>();
62          }
63          return this.cluSets;
64      }
65  
66      public void setCluSets(List<CluSetInfo> cluSets) {
67          this.cluSets = cluSets;
68      }
69  
70  
71      public List<CluSetRangeInformation> getCluSetRange() {
72          if (this.cluSetRange == null) {
73              this.cluSetRange = new ArrayList<CluSetRangeInformation>();
74          }
75          return cluSetRange;
76      }
77  
78      public void setCluSetRange(List<CluSetRangeInformation> cluSetRange) {
79          this.cluSetRange.set(0, cluSetRange.get(cluSetRange.size() - 1));
80      }
81  
82      public Map<String, ProgramCluSetInformation> getSubCluSetInformations() {
83          if (subCluSetInformations == null) {
84              subCluSetInformations = new HashMap<String, ProgramCluSetInformation>();
85          }
86          return subCluSetInformations;
87      }
88  
89      public void setSubCluSetInformations(Map<String, ProgramCluSetInformation> subCluSetInformations) {
90          this.subCluSetInformations = subCluSetInformations;
91      }
92  
93      public ProgramCluSetInformation getParent() {
94          return parent;
95      }
96  
97      public void setParent(ProgramCluSetInformation parent) {
98          this.parent = parent;
99      }
100 
101     public int getProgCluListSize(){
102         if (this.getClus() != null) {
103             return this.getClus().size();
104         } else {
105             return 0;
106         }
107     }
108 
109     public int getProgCluSetListSize(){
110         if (this.getCluSets() != null) {
111             return this.getCluSets().size();
112         } else {
113             return 0;
114         }
115     }
116 
117     public String getCluDelimitedString() {
118 
119         StringBuilder sb = new StringBuilder();
120         for (CluInformation clu : this.getClus()) {
121             if (sb.length() > 0) {
122                 sb.append(",");
123             }
124             sb.append(clu.getVerIndependentId());
125         }
126 
127         return sb.toString();
128     }
129 
130     public String getCluSetDelimitedString() {
131 
132         StringBuilder sb = new StringBuilder();
133         for (CluSetInfo cluSet : this.getCluSets()) {
134             if (sb.length() > 0) {
135                 sb.append(",");
136             }
137             sb.append(cluSet.getId());
138         }
139 
140         return sb.toString();
141     }
142 
143     public boolean hasClus() {
144         if ((this.getClus() != null) && (!this.getClus().isEmpty())) {
145             return true;
146         }
147         return false;
148     }
149 
150 
151     public List<String> getCluIds(){
152         List<String> cluIds = new ArrayList<String>();
153         for(CluInformation clu : this.getClus()){
154             cluIds.add(clu.getVerIndependentId());
155         }
156         return cluIds;
157     }
158 
159 }