001/* 002 * Copyright 2008 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 */ 016package org.kuali.ole.module.purap.businessobject; 017 018 019import org.kuali.ole.integration.purap.CapitalAssetLocation; 020import org.kuali.ole.sys.businessobject.Building; 021import org.kuali.ole.vnd.businessobject.CampusParameter; 022import org.kuali.rice.core.api.util.type.KualiDecimal; 023import org.kuali.rice.kim.api.identity.Person; 024import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 025import org.kuali.rice.krad.util.GlobalVariables; 026import org.kuali.rice.krad.util.ObjectUtils; 027 028public abstract class PurchasingCapitalAssetLocationBase extends PersistableBusinessObjectBase implements CapitalAssetLocation { 029 030 protected Integer capitalAssetLocationIdentifier; 031 protected Integer capitalAssetSystemIdentifier; 032 protected KualiDecimal itemQuantity; 033 protected String campusCode; 034 protected boolean offCampusIndicator; 035 protected String buildingCode; 036 protected String buildingRoomNumber; 037 protected String capitalAssetLine1Address; 038 protected String capitalAssetCityName; 039 protected String capitalAssetStateCode; 040 protected String capitalAssetPostalCode; 041 protected String capitalAssetCountryCode; 042 043 protected CampusParameter campus; 044 045 public PurchasingCapitalAssetLocationBase() { 046 super(); 047 if (GlobalVariables.getUserSession() != null && GlobalVariables.getUserSession().getPerson() != null) { 048 Person user = GlobalVariables.getUserSession().getPerson(); 049 this.campusCode = user.getCampusCode(); 050 } 051 } 052 053 @Override 054 public Integer getCapitalAssetSystemIdentifier() { 055 return capitalAssetSystemIdentifier; 056 } 057 058 @Override 059 public void setCapitalAssetSystemIdentifier(Integer capitalAssetSystemIdentifier) { 060 this.capitalAssetSystemIdentifier = capitalAssetSystemIdentifier; 061 } 062 063 @Override 064 public Integer getCapitalAssetLocationIdentifier() { 065 return capitalAssetLocationIdentifier; 066 } 067 068 @Override 069 public void setCapitalAssetLocationIdentifier(Integer capitalAssetLocationIdentifier) { 070 this.capitalAssetLocationIdentifier = capitalAssetLocationIdentifier; 071 } 072 073 @Override 074 public KualiDecimal getItemQuantity() { 075 return itemQuantity; 076 } 077 078 @Override 079 public void setItemQuantity(KualiDecimal itemQuantity) { 080 this.itemQuantity = itemQuantity; 081 } 082 083 @Override 084 public String getCampusCode() { 085 return campusCode; 086 } 087 088 @Override 089 public void setCampusCode(String campusCode) { 090 this.campusCode = campusCode; 091 } 092 093 @Override 094 public boolean isOffCampusIndicator() { 095 return offCampusIndicator; 096 } 097 098 @Override 099 public void setOffCampusIndicator(boolean offCampusIndicator) { 100 this.offCampusIndicator = offCampusIndicator; 101 } 102 103 @Override 104 public String getBuildingCode() { 105 return buildingCode; 106 } 107 108 @Override 109 public void setBuildingCode(String buildingCode) { 110 this.buildingCode = buildingCode; 111 } 112 113 @Override 114 public String getBuildingRoomNumber() { 115 return buildingRoomNumber; 116 } 117 118 @Override 119 public void setBuildingRoomNumber(String buildingRoomNumber) { 120 this.buildingRoomNumber = buildingRoomNumber; 121 } 122 123 @Override 124 public String getCapitalAssetLine1Address() { 125 return capitalAssetLine1Address; 126 } 127 128 @Override 129 public void setCapitalAssetLine1Address(String capitalAssetLine1Address) { 130 this.capitalAssetLine1Address = capitalAssetLine1Address; 131 } 132 133 @Override 134 public String getCapitalAssetCityName() { 135 return capitalAssetCityName; 136 } 137 138 @Override 139 public void setCapitalAssetCityName(String capitalAssetCityName) { 140 this.capitalAssetCityName = capitalAssetCityName; 141 } 142 143 @Override 144 public String getCapitalAssetStateCode() { 145 return capitalAssetStateCode; 146 } 147 148 @Override 149 public void setCapitalAssetStateCode(String capitalAssetStateCode) { 150 this.capitalAssetStateCode = capitalAssetStateCode; 151 } 152 153 @Override 154 public String getCapitalAssetPostalCode() { 155 return capitalAssetPostalCode; 156 } 157 158 @Override 159 public void setCapitalAssetPostalCode(String capitalAssetPostalCode) { 160 this.capitalAssetPostalCode = capitalAssetPostalCode; 161 } 162 163 @Override 164 public String getCapitalAssetCountryCode() { 165 return capitalAssetCountryCode; 166 } 167 168 @Override 169 public void setCapitalAssetCountryCode(String capitalAssetCountryCode) { 170 this.capitalAssetCountryCode = capitalAssetCountryCode; 171 } 172 173 @Override 174 public CampusParameter getCampus() { 175 return campus; 176 } 177 178 @Override 179 public void setCampus(CampusParameter campus) { 180 this.campus = campus; 181 } 182 183 @Override 184 public void templateBuilding(Building building) { 185 if (ObjectUtils.isNotNull(building)) { 186 this.setOffCampusIndicator(false); 187 this.setBuildingCode(building.getBuildingCode()); 188 this.setCampusCode(building.getCampusCode()); 189 this.setCapitalAssetLine1Address(building.getBuildingStreetAddress()); 190 this.setCapitalAssetCityName(building.getBuildingAddressCityName()); 191 this.setCapitalAssetStateCode(building.getBuildingAddressStateCode()); 192 this.setCapitalAssetPostalCode(building.getBuildingAddressZipCode()); 193 this.setCapitalAssetCountryCode(building.getBuildingAddressCountryCode()); 194 } 195 } 196 197}