001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.kuali.kfs.sys.businessobject; 018 019 import java.util.LinkedHashMap; 020 021 import org.kuali.kfs.sys.context.SpringContext; 022 import org.kuali.rice.kns.bo.Campus; 023 import org.kuali.rice.kns.bo.Country; 024 import org.kuali.rice.kns.bo.Inactivateable; 025 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; 026 import org.kuali.rice.kns.bo.PostalCode; 027 import org.kuali.rice.kns.bo.State; 028 import org.kuali.rice.kns.service.CountryService; 029 import org.kuali.rice.kns.service.KualiModuleService; 030 import org.kuali.rice.kns.service.PostalCodeService; 031 import org.kuali.rice.kns.service.StateService; 032 033 /** 034 * 035 */ 036 public class Building extends PersistableBusinessObjectBase implements Inactivateable { 037 038 private String campusCode; 039 private String buildingCode; 040 private String buildingName; 041 private String buildingStreetAddress; 042 private String buildingAddressCityName; 043 private String buildingAddressStateCode; 044 private String buildingAddressZipCode; 045 private String alternateBuildingCode; 046 private boolean active; 047 private String buildingAddressCountryCode; 048 049 private Campus campus; 050 private State buildingAddressState; 051 private PostalCode buildingAddressZip; 052 private Country buildingAddressCountry; 053 054 /** 055 * Default constructor. 056 */ 057 public Building() { 058 059 } 060 061 /** 062 * Gets the campusCode attribute. 063 * 064 * @return Returns the campusCode 065 */ 066 public String getCampusCode() { 067 return campusCode; 068 } 069 070 /** 071 * Sets the campusCode attribute. 072 * 073 * @param campusCode The campusCode to set. 074 */ 075 public void setCampusCode(String campusCode) { 076 this.campusCode = campusCode; 077 } 078 079 080 /** 081 * Gets the buildingCode attribute. 082 * 083 * @return Returns the buildingCode 084 */ 085 public String getBuildingCode() { 086 return buildingCode; 087 } 088 089 /** 090 * Sets the buildingCode attribute. 091 * 092 * @param buildingCode The buildingCode to set. 093 */ 094 public void setBuildingCode(String buildingCode) { 095 this.buildingCode = buildingCode; 096 } 097 098 099 /** 100 * Gets the buildingName attribute. 101 * 102 * @return Returns the buildingName 103 */ 104 public String getBuildingName() { 105 return buildingName; 106 } 107 108 /** 109 * Sets the buildingName attribute. 110 * 111 * @param buildingName The buildingName to set. 112 */ 113 public void setBuildingName(String buildingName) { 114 this.buildingName = buildingName; 115 } 116 117 /** 118 * Gets the campus attribute. 119 * 120 * @return Returns the campus. 121 */ 122 public Campus getCampus() { 123 return campus = (Campus) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Campus.class).retrieveExternalizableBusinessObjectIfNecessary(this, campus, "campus"); 124 } 125 126 /** 127 * Sets the campus attribute value. 128 * 129 * @param campus The campus to set. 130 */ 131 public void setCampus(Campus campus) { 132 this.campus = campus; 133 } 134 135 /** 136 * Gets the alternateBuildingCode attribute. 137 * 138 * @return Returns the alternateBuildingCode. 139 */ 140 public String getAlternateBuildingCode() { 141 return alternateBuildingCode; 142 } 143 144 /** 145 * Sets the alternateBuildingCode attribute value. 146 * 147 * @param alternateBuildingCode The alternateBuildingCode to set. 148 */ 149 public void setAlternateBuildingCode(String alternateBuildingCode) { 150 this.alternateBuildingCode = alternateBuildingCode; 151 } 152 153 /** 154 * Gets the buildingAddressCityName attribute. 155 * 156 * @return Returns the buildingAddressCityName. 157 */ 158 public String getBuildingAddressCityName() { 159 return buildingAddressCityName; 160 } 161 162 /** 163 * Sets the buildingAddressCityName attribute value. 164 * 165 * @param buildingAddressCityName The buildingAddressCityName to set. 166 */ 167 public void setBuildingAddressCityName(String buildingAddressCityName) { 168 this.buildingAddressCityName = buildingAddressCityName; 169 } 170 171 /** 172 * Gets the buildingAddressStateCode attribute. 173 * 174 * @return Returns the buildingAddressStateCode. 175 */ 176 public String getBuildingAddressStateCode() { 177 return buildingAddressStateCode; 178 } 179 180 /** 181 * Sets the buildingAddressStateCode attribute value. 182 * 183 * @param buildingAddressStateCode The buildingAddressStateCode to set. 184 */ 185 public void setBuildingAddressStateCode(String buildingAddressStateCode) { 186 this.buildingAddressStateCode = buildingAddressStateCode; 187 } 188 189 /** 190 * Gets the buildingAddressZipCode attribute. 191 * 192 * @return Returns the buildingAddressZipCode. 193 */ 194 public String getBuildingAddressZipCode() { 195 return buildingAddressZipCode; 196 } 197 198 /** 199 * Sets the buildingAddressZipCode attribute value. 200 * 201 * @param buildingAddressZipCode The buildingAddressZipCode to set. 202 */ 203 public void setBuildingAddressZipCode(String buildingAddressZipCode) { 204 this.buildingAddressZipCode = buildingAddressZipCode; 205 } 206 207 /** 208 * Gets the buildingStreetAddress attribute. 209 * 210 * @return Returns the buildingStreetAddress. 211 */ 212 public String getBuildingStreetAddress() { 213 return buildingStreetAddress; 214 } 215 216 /** 217 * Sets the buildingStreetAddress attribute value. 218 * 219 * @param buildingStreetAddress The buildingStreetAddress to set. 220 */ 221 public void setBuildingStreetAddress(String buildingStreetAddress) { 222 this.buildingStreetAddress = buildingStreetAddress; 223 } 224 225 /** 226 * Gets the active attribute. 227 * @return Returns the active. 228 */ 229 public boolean isActive() { 230 return active; 231 } 232 233 /** 234 * Sets the active attribute value. 235 * @param active The active to set. 236 */ 237 public void setActive(boolean active) { 238 this.active = active; 239 } 240 241 /** 242 * Gets the buildingAddressState attribute. 243 * 244 * @return Returns the buildingAddressState. 245 */ 246 public State getBuildingAddressState() { 247 buildingAddressState = SpringContext.getBean(StateService.class).getByPrimaryIdIfNecessary(buildingAddressCountryCode, buildingAddressStateCode, buildingAddressState); 248 return buildingAddressState; 249 } 250 251 /** 252 * Sets the buildingAddressState attribute value. 253 * 254 * @param buildingAddressState The buildingAddressState to set. 255 * @deprecated 256 */ 257 public void setBuildingAddressState(State buildingAddressState) { 258 this.buildingAddressState = buildingAddressState; 259 } 260 261 /** 262 * Gets the buildingAddressZip attribute. 263 * 264 * @return Returns the buildingAddressZip. 265 */ 266 public PostalCode getBuildingAddressZip() { 267 buildingAddressZip = SpringContext.getBean(PostalCodeService.class).getByPrimaryIdIfNecessary(buildingAddressCountryCode, buildingAddressZipCode, buildingAddressZip); 268 return buildingAddressZip; 269 } 270 271 /** 272 * Sets the buildingAddressZip attribute value. 273 * 274 * @param buildingAddressZip The buildingAddressZip to set. 275 * @deprecated 276 */ 277 public void setBuildingAddressZip(PostalCode buildingAddressZip) { 278 this.buildingAddressZip = buildingAddressZip; 279 } 280 281 /** 282 * Gets the buildingAddressCountryCode attribute. 283 * @return Returns the buildingAddressCountryCode. 284 */ 285 public String getBuildingAddressCountryCode() { 286 return buildingAddressCountryCode; 287 } 288 289 /** 290 * Sets the buildingAddressCountryCode attribute value. 291 * @param buildingAddressCountryCode The buildingAddressCountryCode to set. 292 */ 293 public void setBuildingAddressCountryCode(String buildingAddressCountryCode) { 294 this.buildingAddressCountryCode = buildingAddressCountryCode; 295 } 296 297 /** 298 * Gets the buildingAddressCountry attribute. 299 * @return Returns the buildingAddressCountry. 300 */ 301 public Country getBuildingAddressCountry() { 302 buildingAddressCountry = SpringContext.getBean(CountryService.class).getByPrimaryIdIfNecessary(buildingAddressCountryCode, buildingAddressCountry); 303 return buildingAddressCountry; 304 } 305 306 /** 307 * Sets the buildingAddressCountry attribute value. 308 * @param buildingAddressCountry The buildingAddressCountry to set. 309 */ 310 public void setBuildingAddressCountry(Country buildingAddressCountry) { 311 this.buildingAddressCountry = buildingAddressCountry; 312 } 313 314 315 316 317 /** 318 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 319 */ 320 protected LinkedHashMap toStringMapper() { 321 LinkedHashMap m = new LinkedHashMap(); 322 m.put("campusCode", this.campusCode); 323 m.put("buildingCode", this.buildingCode); 324 return m; 325 } 326 327 328 }