001 /** 002 * Copyright 2010 The Kuali Foundation Licensed under the 003 * Educational Community License, Version 2.0 (the "License"); you may 004 * not use this file except in compliance with the License. You may 005 * obtain a copy of the License at 006 * 007 * http://www.osedu.org/licenses/ECL-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, 010 * software distributed under the License is distributed on an "AS IS" 011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing 013 * permissions and limitations under the License. 014 */ 015 016 package org.kuali.student.lum.common.client.widgets; 017 018 import java.util.Date; 019 020 import org.kuali.student.common.assembly.data.Data; 021 import org.kuali.student.common.assembly.helper.PropertyEnum; 022 import org.kuali.student.lum.common.client.lo.MetaInfoHelper; 023 024 public class CluSetHelper { 025 026 private static final long serialVersionUID = 1; 027 028 public enum Properties implements PropertyEnum 029 { 030 ID ("id"), 031 ORGANIZATION ("organization"), 032 DESCRIPTION ("description"), 033 EFFECTIVE_DATE ("effectiveDate"), 034 EXPIRATION_DATE ("expirationDate"), 035 APPROVED_CLUS ("approvedClus"), 036 PROPOSED_CLUS ("proposedClus"), 037 // This is the union of APPROVED_CLUS, and PROPOSED_CLUS 038 ALL_CLUS ("allClus"), 039 CLUSETS ("clusets"), 040 CLU_SET_RANGE ("clusetRange"), 041 CLU_SET_RANGE_VIEW_DETAILS ("cluSetRangeViewDetails"), 042 META_INFO ("metaInfo"), 043 NAME ("name"), 044 STATE ("state"), 045 TYPE ("type"), 046 REUSABLE ("reusable"), 047 REFERENCEABLE ("referenceable"); 048 049 private final String key; 050 051 private Properties (final String key) { 052 this.key = key; 053 } 054 055 @Override 056 public String getKey() { 057 return this.key; 058 } 059 } 060 private Data data; 061 062 public CluSetHelper(Data data) { 063 this.data = data; 064 } 065 066 public static CluSetHelper wrap(Data data) { 067 if (data == null) { 068 return null; 069 } 070 return new CluSetHelper(data); 071 } 072 073 public Data getData() { 074 return this.data; 075 } 076 077 public void setId(String value) { 078 data.set(Properties.ID.getKey(), value); 079 } 080 081 public String getId() { 082 return (String) data.get(Properties.ID.getKey()); 083 } 084 085 public void setOrganization(String value) { 086 data.set(Properties.ORGANIZATION.getKey(), value); 087 } 088 public String getOrganization() { 089 return (String) data.get(Properties.ORGANIZATION.getKey()); 090 } 091 092 public void setDescription(String value) { 093 data.set(Properties.DESCRIPTION.getKey(), value); 094 } 095 public String getDescription() { 096 return (String) data.get (Properties.DESCRIPTION.getKey ()); 097 } 098 099 public void setEffectiveDate(Date value) { 100 data.set(Properties.EFFECTIVE_DATE.getKey(), value); 101 } 102 public Date getEffectiveDate() { 103 return (Date) data.get(Properties.EFFECTIVE_DATE.getKey()); 104 } 105 106 public void setExpirationDate(Date value) { 107 data.set(Properties.EXPIRATION_DATE.getKey(), value); 108 } 109 public Date getExpirationDate() { 110 return (Date) data.get(Properties.EXPIRATION_DATE.getKey()); 111 } 112 113 public void setMetaInfo (MetaInfoHelper value) { 114 data.set (Properties.META_INFO.getKey (), (value == null) ? null : value.getData ()); 115 } 116 public MetaInfoHelper getMetaInfo () { 117 return MetaInfoHelper.wrap ((Data) data.get (Properties.META_INFO.getKey ())); 118 } 119 120 public void setName(String name) { 121 data.set(Properties.NAME.getKey(), name); 122 } 123 public String getName() { 124 return (String) data.get(Properties.NAME.getKey()); 125 } 126 127 public void setState(String state) { 128 data.set(Properties.STATE.getKey(), state); 129 } 130 public String getState() { 131 return (String) data.get(Properties.STATE.getKey()); 132 } 133 134 public void setType(String type) { 135 data.set(Properties.TYPE.getKey(), type); 136 } 137 public String getType() { 138 return (String) data.get(Properties.TYPE.getKey()); 139 } 140 141 public void setReusable(Boolean reusable) { 142 Boolean newValue = reusable; 143 if (reusable == null) { 144 newValue = new Boolean(false); 145 } 146 data.set(Properties.REUSABLE.getKey(), newValue); 147 } 148 public Boolean getReusable() { 149 Boolean reUsable = (Boolean) data.get(Properties.REUSABLE.getKey()); 150 if (reUsable == null) { 151 reUsable = new Boolean(false); 152 } 153 return reUsable; 154 } 155 156 public void setReferenceable(Boolean referenceable) { 157 Boolean newValue = referenceable; 158 if (referenceable == null) { 159 newValue = new Boolean(false); 160 } 161 data.set(Properties.REFERENCEABLE.getKey(), newValue); 162 } 163 public Boolean getReferenceable() { 164 Boolean referenceable = (Boolean) data.get(Properties.REFERENCEABLE.getKey()); 165 if (referenceable == null) { 166 referenceable = new Boolean(false); 167 } 168 return referenceable; 169 } 170 171 public void setApprovedClus(Data value) { 172 data.set(Properties.APPROVED_CLUS.getKey(), value); 173 } 174 public Data getApprovedClus() { 175 Data approvedClusData = data.get(Properties.APPROVED_CLUS.getKey()); 176 if (approvedClusData == null) { 177 approvedClusData = new Data(); 178 setApprovedClus(approvedClusData); 179 } 180 return approvedClusData; 181 } 182 public void setProposedClus(Data value) { 183 data.set(Properties.PROPOSED_CLUS.getKey(), value); 184 } 185 public Data getProposedClus() { 186 Data proposedClusData = data.get(Properties.PROPOSED_CLUS.getKey()); 187 if (proposedClusData == null) { 188 proposedClusData = new Data(); 189 setProposedClus(proposedClusData); 190 } 191 return proposedClusData; 192 } 193 public void setAllClus(Data value) { 194 data.set(Properties.ALL_CLUS.getKey(), value); 195 } 196 public Data getAllClus() { 197 Data allClusData = data.get(Properties.ALL_CLUS.getKey()); 198 if (allClusData == null) { 199 allClusData = new Data(); 200 setAllClus(allClusData); 201 } 202 return allClusData; 203 } 204 public void setCluSets(Data value) { 205 data.set(Properties.CLUSETS.getKey(), value); 206 } 207 public Data getCluSets() { 208 Data cluSetData = data.get(Properties.CLUSETS.getKey()); 209 if (cluSetData == null) { 210 cluSetData = new Data(); 211 setCluSets(cluSetData); 212 } 213 return cluSetData; 214 } 215 public void setCluRangeParams(Data value) { 216 data.set(Properties.CLU_SET_RANGE.getKey(), value); 217 } 218 public CluSetRangeHelper getCluRangeParams() { 219 Data cluRangeParamsData = data.get(Properties.CLU_SET_RANGE.getKey()); 220 if (cluRangeParamsData == null) { 221 cluRangeParamsData = new Data(); 222 setCluRangeParams(cluRangeParamsData); 223 } 224 return new CluSetRangeHelper(cluRangeParamsData); 225 } 226 public void setCluRangeViewDetails(Data value) { 227 data.set(Properties.CLU_SET_RANGE_VIEW_DETAILS.getKey(), value); 228 } 229 public Data getCluRangeViewDetails() { 230 Data cluSetRangeViewDetailsData = data.get(Properties.CLU_SET_RANGE_VIEW_DETAILS.getKey()); 231 if (cluSetRangeViewDetailsData == null) { 232 cluSetRangeViewDetailsData = new Data(); 233 setCluRangeViewDetails(cluSetRangeViewDetailsData); 234 } 235 return cluSetRangeViewDetailsData; 236 } 237 238 }