Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void setUserLocation() {
- if (this.user != null) {
- String locationId = this.user.getUserProperty(OpenmrsConstants.USER_PROPERTY_DEFAULT_LOCATION);
- if (StringUtils.isNotBlank(locationId)) {
- //only go ahead if it has actually changed OR if wasn't set before
- if (this.locationId == null || !this.locationId.getName().equalsIgnoreCase(locationId)) {
- try {
- this.locationId = Context.getLocationService().getLocationId(Integer.valueOf(locationId));
- }
- catch (NumberFormatException e) {
- //Drop the stored value since we have no match for the set id
- if (this.locationId != null)
- this.locationId = null;
- log.warn("The value of the default Location property of the user with id:" + this.user.getUserId()
- + " should be an integer", e);
- }
- }
- } else {
- if (this.locationId != null)
- this.locationId = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement