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.module.gl.bo;
17:
18: import org.kuali.core.bo.user.KualiModuleUserBase;
19: import org.kuali.core.bo.user.UniversalUser;
20: import org.kuali.kfs.KFSPropertyConstants;
21: import org.kuali.module.chart.bo.ChartUser;
22:
23: /**
24: * Represents user who works with G/L related functions
25: */
26: public class GlUser extends KualiModuleUserBase {
27:
28: public static final String MODULE_ID = "gl";
29:
30: public GlUser(UniversalUser user) {
31: super (MODULE_ID, user);
32: }
33:
34: /**
35: * Returns the active flag from the embedded ChartUser object.
36: *
37: * @see org.kuali.core.bo.user.KualiModuleUser#isActive()
38: */
39: public boolean isActive() {
40: if (getUniversalUser() == null)
41: return false;
42: String activeStatus = getUniversalUser().getModuleProperties(
43: ChartUser.MODULE_ID).get(KFSPropertyConstants.ACTIVE);
44: return activeStatus != null && activeStatus.equals("Y");
45: }
46:
47: @Override
48: public boolean isModified(UniversalUser oldRecord,
49: UniversalUser newRecord) {
50: boolean isThisModuleUserForNewRecordActive = "Y"
51: .equals(newRecord.getModuleProperties(
52: ChartUser.MODULE_ID).get(
53: KFSPropertyConstants.ACTIVE));
54: return super .isModified(oldRecord, newRecord)
55: || (oldRecord == null && isThisModuleUserForNewRecordActive)
56: || (oldRecord != null && oldRecord.getModuleUser(
57: MODULE_ID).isActive() != isThisModuleUserForNewRecordActive);
58: }
59:
60: public void setActive(boolean active) {
61: throw new UnsupportedOperationException(
62: "setActive is not supported on "
63: + this .getClass().getSimpleName() + " objects");
64: }
65: }
|