001    /**
002     * Copyright 2004-2013 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 String holidayCalendarGroup;
039            private String timezone;
040            private Boolean history;
041            // KPME-1268 Kagata added recordTime and recordLeave variables
042            // KPME-1676 
043    //      private String recordTime;
044    //      private String recordLeave;
045            
046            private Calendar calendar;
047            private Person person;
048    
049        public HolidayCalendar getHolidayCalendar() {
050            return holidayCalendar;
051        }
052    
053        public void setHolidayCalendar(HolidayCalendar holidayCalendar) {
054            this.holidayCalendar = holidayCalendar;
055        }
056    
057        private HolidayCalendar holidayCalendar;
058    
059            public String getPrincipalId() {
060                    return principalId;
061            }
062    
063            public void setPrincipalId(String principalId) {
064                    this.principalId = principalId;
065                    person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
066            }
067    
068            public String getName() {
069                     if (person == null) {
070                        person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
071                }
072                return (person != null) ? person.getName() : "";
073            }
074    
075            public String getPayCalendar() {
076                    return payCalendar;
077            }
078    
079            public void setPayCalendar(String payCalendar) {
080                    this.payCalendar = payCalendar;
081            }
082    
083            public Date getServiceDate() {
084                    return serviceDate;
085            }
086    
087            public void setServiceDate(Date serviceDate) {
088                    this.serviceDate = serviceDate;
089            }
090    
091            public Date getEffectiveDate() {
092                    return effectiveDate;
093            }
094    
095            public void setEffectiveDate(Date effectiveDate) {
096                    this.effectiveDate = effectiveDate;
097            }
098    
099            public Timestamp getTimestamp() {
100                    return timestamp;
101            }
102    
103            public void setTimestamp(Timestamp timestamp) {
104                    this.timestamp = timestamp;
105            }
106            
107            public String getHolidayCalendarGroup() {
108                    return holidayCalendarGroup;
109            }
110    
111            public void setHolidayCalendarGroup(String holidayCalendarGroup) {
112                    this.holidayCalendarGroup = holidayCalendarGroup;
113            }
114    
115            public String getTimezone() {
116                    return timezone;
117            }
118    
119            public void setTimezone(String timezone) {
120                    this.timezone = timezone;
121            }
122    
123            public Calendar getCalendar() {
124                    return calendar;
125            }
126    
127            public void setCalendar(Calendar calendar) {
128                    this.calendar = calendar;
129            }
130    
131            public Person getPerson() {
132                    return person;
133            }
134    
135            public void setPerson(Person person) {
136                    this.person = person;
137            }
138    
139            public Boolean getActive() {
140                    return active;
141            }
142    
143            public void setActive(Boolean active) {
144                    this.active = active;
145            }
146    
147            @Override
148            protected String getUniqueKey() {
149                    return principalId + "_" + payCalendar == null ? "" : payCalendar;
150            }
151    
152            @Override
153            public String getId() {
154                    return this.getHrPrincipalAttributeId();
155            }
156            @Override
157            public void setId(String id) {
158                    setHrPrincipalAttributeId(id);
159            }
160    
161            public String getHrPrincipalAttributeId() {
162                    return hrPrincipalAttributeId;
163            }
164    
165            public void setHrPrincipalAttributeId(String hrPrincipalAttributeId) {
166                    this.hrPrincipalAttributeId = hrPrincipalAttributeId;
167            }
168            
169            public Boolean getHistory() {
170                    return history;
171            }
172    
173            public void setHistory(Boolean history) {
174                    this.history = history;
175            }
176    }