001    /**
002     * Copyright 2004-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.hr.time.principal;
017    
018    import java.sql.Date;
019    import java.sql.Timestamp;
020    
021    import org.kuali.hr.core.KPMEConstants;
022    import org.kuali.hr.time.HrBusinessObject;
023    import org.kuali.hr.time.holidaycalendar.HolidayCalendar;
024    import org.kuali.hr.time.calendar.Calendar;
025    import org.kuali.rice.kim.api.identity.Person;
026    import org.kuali.rice.kim.api.services.KimApiServiceLocator;
027    
028    public class PrincipalHRAttributes extends HrBusinessObject {
029        public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "PrincipalHRAttributes";
030            /**
031             * 
032             */
033            private static final long serialVersionUID = 1L;
034            private String hrPrincipalAttributeId;
035            private String principalId;
036            private String payCalendar;
037            private Date serviceDate;
038            private boolean fmlaEligible;
039            private boolean workmansCompEligible;
040            private String holidayCalendarGroup;
041            private String timezone;
042            // KPME-1268 Kagata added recordTime and recordLeave variables
043            // KPME-1676 
044    //      private String recordTime;
045    //      private String recordLeave;
046            
047            private Calendar calendar;
048            private Person person;
049    
050        public HolidayCalendar getHolidayCalendar() {
051            return holidayCalendar;
052        }
053    
054        public void setHolidayCalendar(HolidayCalendar holidayCalendar) {
055            this.holidayCalendar = holidayCalendar;
056        }
057    
058        private HolidayCalendar holidayCalendar;
059    
060            public String getPrincipalId() {
061                    return principalId;
062            }
063    
064            public void setPrincipalId(String principalId) {
065                    this.principalId = principalId;
066                    person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
067            }
068    
069            public String getName() {
070                     if (person == null) {
071                        person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
072                }
073                return (person != null) ? person.getName() : "";
074            }
075    
076            public String getPayCalendar() {
077                    return payCalendar;
078            }
079    
080            public void setPayCalendar(String payCalendar) {
081                    this.payCalendar = payCalendar;
082            }
083    
084            public Date getServiceDate() {
085                    return serviceDate;
086            }
087    
088            public void setServiceDate(Date serviceDate) {
089                    this.serviceDate = serviceDate;
090            }
091    
092            public boolean isFmlaEligible() {
093                    return fmlaEligible;
094            }
095    
096            public void setFmlaEligible(boolean fmlaEligible) {
097                    this.fmlaEligible = fmlaEligible;
098            }
099    
100            public boolean isWorkmansCompEligible() {
101                    return workmansCompEligible;
102            }
103    
104            public void setWorkmansCompEligible(boolean workmansCompEligible) {
105                    this.workmansCompEligible = workmansCompEligible;
106            }
107    
108            public Date getEffectiveDate() {
109                    return effectiveDate;
110            }
111    
112            public void setEffectiveDate(Date effectiveDate) {
113                    this.effectiveDate = effectiveDate;
114            }
115    
116            public Timestamp getTimestamp() {
117                    return timestamp;
118            }
119    
120            public void setTimestamp(Timestamp timestamp) {
121                    this.timestamp = timestamp;
122            }
123            
124            public String getHolidayCalendarGroup() {
125                    return holidayCalendarGroup;
126            }
127    
128            public void setHolidayCalendarGroup(String holidayCalendarGroup) {
129                    this.holidayCalendarGroup = holidayCalendarGroup;
130            }
131    
132            public String getTimezone() {
133                    return timezone;
134            }
135    
136            public void setTimezone(String timezone) {
137                    this.timezone = timezone;
138            }
139    
140            public Calendar getCalendar() {
141                    return calendar;
142            }
143    
144            public void setCalendar(Calendar calendar) {
145                    this.calendar = calendar;
146            }
147    
148            public Person getPerson() {
149                    return person;
150            }
151    
152            public void setPerson(Person person) {
153                    this.person = person;
154            }
155    
156            public Boolean getActive() {
157                    return active;
158            }
159    
160            public void setActive(Boolean active) {
161                    this.active = active;
162            }
163    
164            @Override
165            protected String getUniqueKey() {
166                    return principalId + "_" + payCalendar == null ? "" : payCalendar;
167            }
168    
169            @Override
170            public void setId(String id) {
171            }
172    
173            @Override
174            public String getId() {
175                    // TODO Auto-generated method stub
176                    return null;
177            }
178    
179            public String getHrPrincipalAttributeId() {
180                    return hrPrincipalAttributeId;
181            }
182    
183            public void setHrPrincipalAttributeId(String hrPrincipalAttributeId) {
184                    this.hrPrincipalAttributeId = hrPrincipalAttributeId;
185            }
186    }