View Javadoc
1   package org.kuali.ole.describe.bo;
2   
3   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
4   
5   import java.util.LinkedHashMap;
6   
7   /**
8    * The OleLocation is a BO class that defines the location fields with getters and setters which
9    * is used for interacting the location data with the persistence layer in OLE.
10   */
11  public class OleLocation extends PersistableBusinessObjectBase {
12  
13      private String locationId;
14      private String locationCode;
15      private String locationName;
16      private String parentLocationId;
17      private String levelId;
18      private String levelCode;
19      private OleLocation oleLocation;
20      private OleLocationLevel oleLocationLevel;
21      private String fullLocationPath;
22  
23      /**
24       * Gets the levelCode string value from this OleLocation class
25       *
26       * @return levelCode
27       */
28      public String getLevelCode() {
29          return oleLocationLevel.getLevelCode();
30      }
31  
32      /**
33       * Sets the levelCode string value inside this OleLocation class
34       *
35       * @param levelCode
36       */
37      public void setLevelCode(String levelCode) {
38          this.levelCode = levelCode;
39      }
40  
41      /**
42       * Gets the parentLocationId string value from this OleLocation class
43       *
44       * @return parentLocationId
45       */
46      public String getParentLocationId() {
47          return parentLocationId;
48      }
49  
50      /**
51       * Sets the parentLocationId string value inside this OleLocation class
52       *
53       * @param parentLocationId
54       */
55      public void setParentLocationId(String parentLocationId) {
56          if (parentLocationId != null && parentLocationId.equals(""))
57              this.parentLocationId = null;
58          else
59              this.parentLocationId = parentLocationId;
60      }
61  
62      /**
63       * Gets the locationName string value from this OleLocation class
64       *
65       * @return locationName
66       */
67      public String getLocationName() {
68          return locationName;
69      }
70  
71      /**
72       * Sets the locationName string value inside this OleLocation class
73       *
74       * @param locationName
75       */
76      public void setLocationName(String locationName) {
77          this.locationName = locationName;
78      }
79  
80      /**
81       * Gets the locationCode string value from this OleLocation class
82       *
83       * @return locationCode
84       */
85      public String getLocationCode() {
86          return locationCode;
87      }
88  
89      /**
90       * Sets the locationCode string value inside this OleLocation class
91       *
92       * @param locationCode
93       */
94      public void setLocationCode(String locationCode) {
95          this.locationCode = locationCode;
96      }
97  
98      /**
99       * Gets the locationId string value from this OleLocation class
100      *
101      * @return locationId
102      */
103     public String getLocationId() {
104         return locationId;
105     }
106 
107     /**
108      * Sets the locationId string value inside this OleLocation class
109      *
110      * @param locationId
111      */
112     public void setLocationId(String locationId) {
113         this.locationId = locationId;
114     }
115 
116     /**
117      * Gets the oleLocation object value from this OleLocation class
118      *
119      * @return oleLocation
120      */
121     public OleLocation getOleLocation() {
122         return oleLocation;
123     }
124 
125     /**
126      * Sets the oleLocation value inside this OleLocation class
127      *
128      * @param oleLocation
129      */
130     public void setOleLocation(OleLocation oleLocation) {
131         this.oleLocation = oleLocation;
132     }
133 
134     /**
135      * Gets the levelId string value from this OleLocation class
136      *
137      * @return levelId
138      */
139     public String getLevelId() {
140         return levelId;
141     }
142 
143     /**
144      * Sets the levelId string value inside this OleLocation class
145      *
146      * @param levelId
147      */
148     public void setLevelId(String levelId) {
149         this.levelId = levelId;
150     }
151 
152     /**
153      * Gets the oleLocationLevel object value from this OleLocation class
154      *
155      * @return oleLocationLevel
156      */
157     public OleLocationLevel getOleLocationLevel() {
158         return oleLocationLevel;
159     }
160 
161     /**
162      * Sets the oleLocationLevel value inside this OleLocation class
163      *
164      * @param oleLocationLevel
165      */
166     public void setOleLocationLevel(OleLocationLevel oleLocationLevel) {
167         this.oleLocationLevel = oleLocationLevel;
168     }
169 
170     /**
171      * This method returns a map that contains the Primary Key value of this OleLocation class
172      *
173      * @return toStringMap
174      */
175     protected LinkedHashMap toStringMapper() {
176         LinkedHashMap toStringMap = new LinkedHashMap();
177         toStringMap.put("locationId", locationId);
178         return toStringMap;
179     }
180 
181 
182     public String getFullLocationPath() {
183         String fullLocationCode = this.getLocationCode();
184         OleLocation deskLocation = this.getOleLocation();
185         while (deskLocation != null) {
186             fullLocationCode = deskLocation.getLocationCode() + "/" + fullLocationCode;
187             if (deskLocation.getParentLocationId() != null) {
188                 deskLocation = deskLocation.getOleLocation();
189             } else
190                 deskLocation = null;
191         }
192         return fullLocationCode;
193     }
194 
195     public void setFullLocationPath(String fullLocationPath) {
196         this.fullLocationPath = fullLocationPath;
197     }
198 
199 
200 }