View Javadoc
1   /*
2    * Copyright 2008 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.ole.module.purap.businessobject;
17  
18  
19  import org.kuali.ole.integration.purap.CapitalAssetLocation;
20  import org.kuali.ole.sys.businessobject.Building;
21  import org.kuali.ole.vnd.businessobject.CampusParameter;
22  import org.kuali.rice.core.api.util.type.KualiDecimal;
23  import org.kuali.rice.kim.api.identity.Person;
24  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
25  import org.kuali.rice.krad.util.GlobalVariables;
26  import org.kuali.rice.krad.util.ObjectUtils;
27  
28  public abstract class PurchasingCapitalAssetLocationBase extends PersistableBusinessObjectBase implements CapitalAssetLocation {
29  
30      protected Integer capitalAssetLocationIdentifier;
31      protected Integer capitalAssetSystemIdentifier;
32      protected KualiDecimal itemQuantity;
33      protected String campusCode;
34      protected boolean offCampusIndicator;
35      protected String buildingCode;
36      protected String buildingRoomNumber;
37      protected String capitalAssetLine1Address;
38      protected String capitalAssetCityName;
39      protected String capitalAssetStateCode;
40      protected String capitalAssetPostalCode;
41      protected String capitalAssetCountryCode;
42  
43      protected CampusParameter campus;
44  
45      public PurchasingCapitalAssetLocationBase() {
46          super();
47          if (GlobalVariables.getUserSession() != null && GlobalVariables.getUserSession().getPerson() != null) {
48              Person user = GlobalVariables.getUserSession().getPerson();
49              this.campusCode = user.getCampusCode();
50          }
51      }
52  
53      @Override
54      public Integer getCapitalAssetSystemIdentifier() {
55          return capitalAssetSystemIdentifier;
56      }
57  
58      @Override
59      public void setCapitalAssetSystemIdentifier(Integer capitalAssetSystemIdentifier) {
60          this.capitalAssetSystemIdentifier = capitalAssetSystemIdentifier;
61      }
62  
63      @Override
64      public Integer getCapitalAssetLocationIdentifier() {
65          return capitalAssetLocationIdentifier;
66      }
67  
68      @Override
69      public void setCapitalAssetLocationIdentifier(Integer capitalAssetLocationIdentifier) {
70          this.capitalAssetLocationIdentifier = capitalAssetLocationIdentifier;
71      }
72  
73      @Override
74      public KualiDecimal getItemQuantity() {
75          return itemQuantity;
76      }
77  
78      @Override
79      public void setItemQuantity(KualiDecimal itemQuantity) {
80          this.itemQuantity = itemQuantity;
81      }
82  
83      @Override
84      public String getCampusCode() {
85          return campusCode;
86      }
87  
88      @Override
89      public void setCampusCode(String campusCode) {
90          this.campusCode = campusCode;
91      }
92  
93      @Override
94      public boolean isOffCampusIndicator() {
95          return offCampusIndicator;
96      }
97  
98      @Override
99      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 }