View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.kpme.tklm.time.timeblock.dao;
17  
18  import java.util.List;
19  
20  import org.apache.log4j.Logger;
21  import org.apache.ojb.broker.query.Criteria;
22  import org.apache.ojb.broker.query.Query;
23  import org.apache.ojb.broker.query.QueryFactory;
24  import org.joda.time.LocalDate;
25  import org.kuali.kpme.tklm.time.timeblock.TimeBlock;
26  import org.kuali.kpme.tklm.time.timeblock.TimeBlockHistory;
27  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
28  
29  public class TimeBlockHistoryDaoOjbImpl extends PlatformAwareDaoBaseOjb implements TimeBlockHistoryDao {
30  
31  	private static final Logger LOG = Logger.getLogger(TimeBlockHistoryDaoOjbImpl.class);
32  
33  	public void saveOrUpdate(TimeBlockHistory timeBlockHistory) {
34  		this.getPersistenceBrokerTemplate().store(timeBlockHistory);
35  	}
36  
37  	public void saveOrUpdate(List<TimeBlockHistory> timeBlockHistoryList) {
38  		if (timeBlockHistoryList != null) {
39  			for (TimeBlockHistory timeBlockHistory : timeBlockHistoryList) {
40  				this.getPersistenceBrokerTemplate().store(timeBlockHistory);
41  			}
42  		}
43  	}
44  
45      @Override
46      public List<TimeBlockHistory> getTimeBlockHistoryByTkTimeBlockId(String tkTimeBlockId) {
47          Criteria currentRecordCriteria = new Criteria();
48  		currentRecordCriteria.addEqualTo("tkTimeBlockId", tkTimeBlockId);
49  		Query query = QueryFactory.newQuery(TimeBlockHistory.class, currentRecordCriteria);
50  
51  		return (List<TimeBlockHistory>)this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
52      }
53  
54  	@Override
55  	public List<TimeBlock> getTimeBlockHistoriesForLookup(String documentId,
56  			String principalId, String userPrincipalId, LocalDate fromDate,
57  			LocalDate toDate) {
58  		// TODO Auto-generated method stub
59  		return null;
60  	}
61  }