01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.bo;
17:
18: import org.kuali.core.bo.user.AuthenticationUserId;
19: import org.kuali.core.bo.user.UniversalUser;
20: import org.kuali.core.exceptions.UserNotFoundException;
21: import org.kuali.rice.KNSServiceLocator;
22:
23: /**
24: * Ad Hoc Route Person Business Object
25: */
26: public class AdHocRoutePerson extends AdHocRouteRecipient {
27:
28: private static final long serialVersionUID = 1L;
29:
30: private transient UniversalUser universalUser;
31:
32: public AdHocRoutePerson() {
33: setType(PERSON_TYPE);
34: }
35:
36: @Override
37: public void setType(Integer type) {
38: if (!PERSON_TYPE.equals(type)) {
39: throw new IllegalArgumentException("cannot change type to "
40: + type);
41: }
42: super .setType(type);
43: }
44:
45: @Override
46: public String getName() {
47: if (universalUser == null
48: || universalUser.getPersonUserIdentifier() == null
49: || !universalUser.getPersonUserIdentifier()
50: .equalsIgnoreCase(getId())) {
51: universalUser = null;
52: try {
53: universalUser = KNSServiceLocator
54: .getUniversalUserService().getUniversalUser(
55: new AuthenticationUserId(getId()));
56: } catch (UserNotFoundException ex) {
57: // do nothing, leave UU as null
58: }
59: }
60: if (universalUser == null) {
61: return "";
62: }
63: return universalUser.getPersonName();
64: }
65:
66: }
|