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.timeblock;
017    
018    import java.sql.Timestamp;
019    import java.util.ArrayList;
020    import java.util.List;
021    
022    import org.kuali.hr.time.service.base.TkServiceLocator;
023    import org.kuali.rice.kim.api.identity.Person;
024    
025    public class TimeBlockHistory extends TimeBlock {
026    
027            /**
028             *
029             */
030            private static final long serialVersionUID = 3943771766084238699L;
031    
032            private String tkTimeBlockHistoryId = null;
033            private String actionHistory;
034            private String modifiedByPrincipalId;
035            private Timestamp timestampModified;
036            private transient Person principal;
037            private transient Person userPrincipal;
038            private List<TimeBlockHistoryDetail> timeBlockHistoryDetails = new ArrayList<TimeBlockHistoryDetail>();
039        private TimeBlock timeBlock;
040    
041            public TimeBlockHistory() {
042            }
043    
044            public TimeBlockHistory(TimeBlock tb) {
045                    this.setTkTimeBlockId(tb.getTkTimeBlockId());
046                    this.setDocumentId(tb.getDocumentId());
047                    this.setJobNumber(tb.getJobNumber());
048                    this.setWorkArea(tb.getWorkArea());
049                    this.setTask(tb.getTask());
050                    this.setEarnCode(tb.getEarnCode());
051                    this.setBeginTimestamp(tb.getBeginTimestamp());
052                    this.setEndTimestamp(tb.getEndTimestamp());
053                    this.setClockLogCreated(tb.getClockLogCreated());
054                    this.setHours(tb.getHours());
055                    this.setUserPrincipalId(tb.getUserPrincipalId());
056                    this.setPrincipalId(tb.getPrincipalId());
057                    this.setTimestamp(tb.getTimestamp());
058                    this.setBeginTimestampTimezone(tb.getBeginTimestampTimezone());
059                    this.setEndTimestampTimezone(tb.getEndTimestampTimezone());
060                    // add time block history details for this time block history
061                    TkServiceLocator.getTimeBlockHistoryService().addTimeBlockHistoryDetails(this, tb);
062            }
063            
064    
065            public String getTkTimeBlockHistoryId() {
066                    return tkTimeBlockHistoryId;
067            }
068            public void setTkTimeBlockHistoryId(String tkTimeBlockHistoryId) {
069                    this.tkTimeBlockHistoryId = tkTimeBlockHistoryId;
070            }
071            public String getActionHistory() {
072                    return actionHistory;
073            }
074            public void setActionHistory(String actionHistory) {
075                    this.actionHistory = actionHistory;
076            }
077            public String getModifiedByPrincipalId() {
078                    return modifiedByPrincipalId;
079            }
080            public void setModifiedByPrincipalId(String modifiedByPrincipalId) {
081                    this.modifiedByPrincipalId = modifiedByPrincipalId;
082            }
083    
084            public Timestamp getTimestampModified() {
085                    return timestampModified;
086            }
087    
088            public void setTimestampModified(Timestamp timestampModified) {
089                    this.timestampModified = timestampModified;
090            }
091    
092            public Person getPrincipal() {
093                    return principal;
094            }
095    
096            public void setPrincipal(Person principal) {
097                    this.principal = principal;
098            }
099    
100            public Person getUserPrincipal() {
101                    return userPrincipal;
102            }
103    
104            public void setUserPrincipal(Person userPrincipal) {
105                    this.userPrincipal = userPrincipal;
106            }
107    
108            public List<TimeBlockHistoryDetail> getTimeBlockHistoryDetails() {
109                    return timeBlockHistoryDetails;
110            }
111    
112            public void setTimeBlockHistoryDetails(List<TimeBlockHistoryDetail> timeBlockHistoryDetails) {
113                    this.timeBlockHistoryDetails = timeBlockHistoryDetails;
114            }
115    
116        public TimeBlock getTimeBlock(){
117            return this.timeBlock;
118        }
119    
120        public void setTimeBlock(TimeBlock timeBlock) {
121            this.timeBlock = timeBlock;
122        }
123    
124        public TimeBlockHistory copy() {
125            return new TimeBlockHistory(this);
126        }
127    }