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 package org.kuali.kfs.module.cam.businessobject; 017 018 import java.util.LinkedHashMap; 019 020 import org.kuali.kfs.sys.context.SpringContext; 021 import org.kuali.rice.kns.bo.Country; 022 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; 023 import org.kuali.rice.kns.bo.PostalCode; 024 import org.kuali.rice.kns.bo.State; 025 import org.kuali.rice.kns.service.CountryService; 026 import org.kuali.rice.kns.service.PostalCodeService; 027 import org.kuali.rice.kns.service.StateService; 028 029 /** 030 * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu) 031 */ 032 public class AssetLocation extends PersistableBusinessObjectBase { 033 034 private Long capitalAssetNumber; 035 private String assetLocationTypeCode; 036 private String assetLocationContactName; 037 private String assetLocationContactIdentifier; 038 private String assetLocationInstitutionName; 039 private String assetLocationPhoneNumber; 040 private String assetLocationStreetAddress; 041 private String assetLocationCityName; 042 private String assetLocationStateCode; 043 private String assetLocationCountryCode; 044 private String assetLocationZipCode; 045 046 private Asset asset; 047 private AssetLocationType assetLocationType; 048 049 private State assetLocationState; 050 private Country assetLocationCountry; 051 private PostalCode postalZipCode; 052 053 /** 054 * Default constructor. 055 */ 056 public AssetLocation() { 057 058 } 059 060 public AssetLocation(Long assetNumber) { 061 this.capitalAssetNumber = assetNumber; 062 } 063 064 public AssetLocation(AssetLocation copiedLocation) { 065 this.capitalAssetNumber = copiedLocation.getCapitalAssetNumber(); 066 this.assetLocationTypeCode = copiedLocation.getAssetLocationTypeCode(); 067 this.assetLocationContactName = copiedLocation.getAssetLocationContactName(); 068 this.assetLocationContactIdentifier = copiedLocation.getAssetLocationContactIdentifier(); 069 this.assetLocationInstitutionName = copiedLocation.getAssetLocationInstitutionName(); 070 this.assetLocationPhoneNumber = copiedLocation.getAssetLocationPhoneNumber(); 071 this.assetLocationStreetAddress = copiedLocation.getAssetLocationStreetAddress(); 072 this.assetLocationCityName = copiedLocation.getAssetLocationCityName(); 073 this.assetLocationStateCode = copiedLocation.getAssetLocationStateCode(); 074 this.assetLocationCountryCode = copiedLocation.getAssetLocationCountryCode(); 075 this.assetLocationZipCode = copiedLocation.getAssetLocationZipCode(); 076 } 077 078 /** 079 * Gets the capitalAssetNumber attribute. 080 * 081 * @return Returns the capitalAssetNumber 082 */ 083 public Long getCapitalAssetNumber() { 084 return capitalAssetNumber; 085 } 086 087 /** 088 * Sets the capitalAssetNumber attribute. 089 * 090 * @param capitalAssetNumber The capitalAssetNumber to set. 091 */ 092 public void setCapitalAssetNumber(Long capitalAssetNumber) { 093 this.capitalAssetNumber = capitalAssetNumber; 094 } 095 096 097 /** 098 * Gets the assetLocationTypeCode attribute. 099 * 100 * @return Returns the assetLocationTypeCode 101 */ 102 public String getAssetLocationTypeCode() { 103 return assetLocationTypeCode; 104 } 105 106 /** 107 * Sets the assetLocationTypeCode attribute. 108 * 109 * @param assetLocationTypeCode The assetLocationTypeCode to set. 110 */ 111 public void setAssetLocationTypeCode(String assetLocationTypeCode) { 112 this.assetLocationTypeCode = assetLocationTypeCode; 113 } 114 115 116 /** 117 * Gets the assetLocationContactName attribute. 118 * 119 * @return Returns the assetLocationContactName 120 */ 121 public String getAssetLocationContactName() { 122 return assetLocationContactName; 123 } 124 125 /** 126 * Sets the assetLocationContactName attribute. 127 * 128 * @param assetLocationContactName The assetLocationContactName to set. 129 */ 130 public void setAssetLocationContactName(String assetLocationContactName) { 131 this.assetLocationContactName = assetLocationContactName; 132 } 133 134 135 /** 136 * Gets the assetLocationContactIdentifier attribute. 137 * 138 * @return Returns the assetLocationContactIdentifier 139 */ 140 public String getAssetLocationContactIdentifier() { 141 return assetLocationContactIdentifier; 142 } 143 144 /** 145 * Sets the assetLocationContactIdentifier attribute. 146 * 147 * @param assetLocationContactIdentifier The assetLocationContactIdentifier to set. 148 */ 149 public void setAssetLocationContactIdentifier(String assetLocationContactIdentifier) { 150 this.assetLocationContactIdentifier = assetLocationContactIdentifier; 151 } 152 153 154 /** 155 * Gets the assetLocationInstitutionName attribute. 156 * 157 * @return Returns the assetLocationInstitutionName 158 */ 159 public String getAssetLocationInstitutionName() { 160 return assetLocationInstitutionName; 161 } 162 163 /** 164 * Sets the assetLocationInstitutionName attribute. 165 * 166 * @param assetLocationInstitutionName The assetLocationInstitutionName to set. 167 */ 168 public void setAssetLocationInstitutionName(String assetLocationInstitutionName) { 169 this.assetLocationInstitutionName = assetLocationInstitutionName; 170 } 171 172 173 /** 174 * Gets the assetLocationPhoneNumber attribute. 175 * 176 * @return Returns the assetLocationPhoneNumber 177 */ 178 public String getAssetLocationPhoneNumber() { 179 return assetLocationPhoneNumber; 180 } 181 182 /** 183 * Sets the assetLocationPhoneNumber attribute. 184 * 185 * @param assetLocationPhoneNumber The assetLocationPhoneNumber to set. 186 */ 187 public void setAssetLocationPhoneNumber(String assetLocationPhoneNumber) { 188 this.assetLocationPhoneNumber = assetLocationPhoneNumber; 189 } 190 191 192 /** 193 * Gets the assetLocationStreetAddress attribute. 194 * 195 * @return Returns the assetLocationStreetAddress 196 */ 197 public String getAssetLocationStreetAddress() { 198 return assetLocationStreetAddress; 199 } 200 201 /** 202 * Sets the assetLocationStreetAddress attribute. 203 * 204 * @param assetLocationStreetAddress The assetLocationStreetAddress to set. 205 */ 206 public void setAssetLocationStreetAddress(String assetLocationStreetAddress) { 207 this.assetLocationStreetAddress = assetLocationStreetAddress; 208 } 209 210 211 /** 212 * Gets the assetLocationCityName attribute. 213 * 214 * @return Returns the assetLocationCityName 215 */ 216 public String getAssetLocationCityName() { 217 return assetLocationCityName; 218 } 219 220 /** 221 * Sets the assetLocationCityName attribute. 222 * 223 * @param assetLocationCityName The assetLocationCityName to set. 224 */ 225 public void setAssetLocationCityName(String assetLocationCityName) { 226 this.assetLocationCityName = assetLocationCityName; 227 } 228 229 230 /** 231 * Gets the assetLocationStateCode attribute. 232 * 233 * @return Returns the assetLocationStateCode 234 */ 235 public String getAssetLocationStateCode() { 236 return assetLocationStateCode; 237 } 238 239 /** 240 * Sets the assetLocationStateCode attribute. 241 * 242 * @param assetLocationStateCode The assetLocationStateCode to set. 243 */ 244 public void setAssetLocationStateCode(String assetLocationStateCode) { 245 this.assetLocationStateCode = assetLocationStateCode; 246 } 247 248 249 /** 250 * Gets the assetLocationCountryCode attribute. 251 * 252 * @return Returns the assetLocationCountryCode 253 */ 254 public String getAssetLocationCountryCode() { 255 return assetLocationCountryCode; 256 } 257 258 /** 259 * Sets the assetLocationCountryCode attribute. 260 * 261 * @param assetLocationCountryCode The assetLocationCountryCode to set. 262 */ 263 public void setAssetLocationCountryCode(String assetLocationCountryCode) { 264 this.assetLocationCountryCode = assetLocationCountryCode; 265 } 266 267 268 /** 269 * Gets the assetLocationZipCode attribute. 270 * 271 * @return Returns the assetLocationZipCode 272 */ 273 public String getAssetLocationZipCode() { 274 return assetLocationZipCode; 275 } 276 277 /** 278 * Sets the assetLocationZipCode attribute. 279 * 280 * @param assetLocationZipCode The assetLocationZipCode to set. 281 */ 282 public void setAssetLocationZipCode(String assetLocationZipCode) { 283 this.assetLocationZipCode = assetLocationZipCode; 284 } 285 286 /** 287 * Gets the postalZipCode attribute. 288 * 289 * @return Returns the postalZipCode 290 */ 291 public PostalCode getPostalZipCode() { 292 postalZipCode = SpringContext.getBean(PostalCodeService.class).getByPrimaryIdIfNecessary(assetLocationCountryCode, assetLocationZipCode, postalZipCode); 293 return postalZipCode; 294 } 295 296 /** 297 * Sets the postalZipCode attribute. 298 * 299 * @param postalZipCode The postalZipCode to set. 300 */ 301 public void setPostalZipCode(PostalCode postalZipCode) { 302 this.postalZipCode = postalZipCode; 303 } 304 305 /** 306 * Gets the asset attribute. 307 * 308 * @return Returns the asset 309 */ 310 public Asset getAsset() { 311 return asset; 312 } 313 314 /** 315 * Sets the asset attribute. 316 * 317 * @param asset The asset to set. 318 * @deprecated 319 */ 320 public void setAsset(Asset asset) { 321 this.asset = asset; 322 } 323 324 /** 325 * Gets the assetLocationType attribute. 326 * 327 * @return Returns the assetLocationType. 328 */ 329 public AssetLocationType getAssetLocationType() { 330 return assetLocationType; 331 } 332 333 /** 334 * Sets the assetLocationType attribute value. 335 * 336 * @param assetLocationType The assetLocationType to set. 337 * @deprecated 338 */ 339 public void setAssetLocationType(AssetLocationType assetLocationType) { 340 this.assetLocationType = assetLocationType; 341 } 342 343 /** 344 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 345 */ 346 protected LinkedHashMap toStringMapper() { 347 LinkedHashMap m = new LinkedHashMap(); 348 if (this.capitalAssetNumber != null) { 349 m.put("capitalAssetNumber", this.capitalAssetNumber.toString()); 350 } 351 m.put("assetLocationTypeCode", this.assetLocationTypeCode); 352 return m; 353 } 354 355 public Country getAssetLocationCountry() { 356 assetLocationCountry = SpringContext.getBean(CountryService.class).getByPrimaryIdIfNecessary(assetLocationCountryCode, assetLocationCountry); 357 return assetLocationCountry; 358 } 359 360 public void setAssetLocationCountry(Country assetLocationCountry) { 361 this.assetLocationCountry = assetLocationCountry; 362 } 363 364 public State getAssetLocationState() { 365 assetLocationState = SpringContext.getBean(StateService.class).getByPrimaryIdIfNecessary(assetLocationCountryCode, assetLocationStateCode, assetLocationState); 366 return assetLocationState; 367 } 368 369 public void setAssetLocationState(State assetLocationState) { 370 this.assetLocationState = assetLocationState; 371 } 372 }