001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.module.labor.bo;
017:
018: import org.kuali.core.bo.user.KualiModuleUserBase;
019: import org.kuali.core.bo.user.UniversalUser;
020: import org.kuali.kfs.KFSPropertyConstants;
021: import org.kuali.module.chart.bo.ChartUser;
022:
023: /**
024: * Labor business object for laborUser.
025: */
026: public class LaborUser extends KualiModuleUserBase {
027: public static final String MODULE_ID = "labor";
028:
029: /**
030: * Constructs a LaborUser.java.
031: *
032: * @param user
033: */
034: public LaborUser(UniversalUser user) {
035: super (MODULE_ID, user);
036: }
037:
038: /**
039: * Returns the active flag from the embedded ChartUser object.
040: *
041: * @see org.kuali.core.bo.user.KualiModuleUser#isActive()
042: */
043: public boolean isActive() {
044: if (getUniversalUser() == null)
045: return false;
046: String activeStatus = getUniversalUser().getModuleProperties(
047: ChartUser.MODULE_ID).get(KFSPropertyConstants.ACTIVE);
048: return activeStatus != null && activeStatus.equals("Y");
049: }
050:
051: /**
052: * Returns boolean
053: *
054: * @param oldRecord, newRecord
055: * @see org.kuali.core.bo.user.KualiModuleUser#isModified(org.kuali.core.bo.user.UniversalUser,
056: * org.kuali.core.bo.user.UniversalUser)
057: */
058: @Override
059: public boolean isModified(UniversalUser oldRecord,
060: UniversalUser newRecord) {
061: boolean isThisModuleUserForNewRecordActive = "Y"
062: .equals(newRecord.getModuleProperties(
063: ChartUser.MODULE_ID).get(
064: KFSPropertyConstants.ACTIVE));
065: return super .isModified(oldRecord, newRecord)
066: || ((oldRecord == null) && isThisModuleUserForNewRecordActive)
067: || (oldRecord != null && oldRecord.getModuleUser(
068: MODULE_ID).isActive() != isThisModuleUserForNewRecordActive);
069: }
070:
071: /**
072: * @param active
073: * @see org.kuali.core.bo.user.KualiModuleUserBase#setActive(boolean)
074: */
075: public void setActive(boolean active) {
076: throw new UnsupportedOperationException(
077: "setActive is not supported on "
078: + this .getClass().getSimpleName() + " objects");
079: }
080:
081: /**
082: * Sets the PersonPayrollIdentifier.
083: *
084: * @param id
085: * @see UniversalUser#setPersonPayrollIdentifier(String)
086: */
087: public void setPersonPayrollIdentifier(String id) {
088: getUniversalUser().setPersonPayrollIdentifier(id);
089: }
090:
091: /**
092: * Gets the PersonPayrollIdentifier.
093: *
094: * @return Returns the PersonPayrollIdentifier.
095: * @see UniversalUser#getPersonPayrollIdentifier()
096: */
097: public String getPersonPayrollIdentifier() {
098: return getUniversalUser().getPersonPayrollIdentifier();
099: }
100:
101: /**
102: * Gets the PersonsName.
103: *
104: * @return Returns the PersonPayrollIdentifier.
105: * @see UniversalUser#getPersonName()
106: */
107: public String getPersonName() {
108: if (getUniversalUser() != null) {
109: return getUniversalUser().getPersonName();
110: }
111: return null;
112: }
113:
114: /**
115: * Sets the PersonsName.
116: *
117: * @param name
118: * @see UniversalUser#setPersonName(String)
119: */
120: public void setPersonName(String name) {
121: if (getUniversalUser() != null) {
122: getUniversalUser().setPersonName(name);
123: }
124: }
125: }
|