01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.dao.ojb;
17:
18: import java.sql.Date;
19: import java.util.Collection;
20:
21: import org.apache.ojb.broker.query.Criteria;
22: import org.apache.ojb.broker.query.QueryFactory;
23: import org.kuali.RicePropertyConstants;
24: import org.kuali.core.bo.DocumentHeader;
25: import org.kuali.core.dao.DocumentHeaderDao;
26:
27: /**
28: * This class is the OJB implementation of the DocumentHeaderDao interface.
29: *
30: *
31: */
32: public class DocumentHeaderDaoOjb extends PlatformAwareDaoBaseOjb
33: implements DocumentHeaderDao {
34: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
35: .getLogger(DocumentHeaderDaoOjb.class);
36:
37: /**
38: *
39: */
40: public DocumentHeaderDaoOjb() {
41: super ();
42: }
43:
44: /*
45: * (non-Javadoc)
46: *
47: * @see org.kuali.dao.DocumentHeaderDao#getByDocumentHeaderId(java.lang.Long)
48: */
49: public DocumentHeader getByDocumentHeaderId(String id) {
50: Criteria criteria = new Criteria();
51: criteria.addEqualTo("FDOC_NBR", id);
52:
53: return (DocumentHeader) getPersistenceBrokerTemplate()
54: .getObjectByQuery(
55: QueryFactory.newQuery(DocumentHeader.class,
56: criteria));
57: }
58:
59: /*
60: * (non-Javadoc)
61: *
62: * @see org.kuali.dao.DocumentHeaderDao#getCorrectingDocumentHeader(java.lang.Long)
63: */
64: public DocumentHeader getCorrectingDocumentHeader(String documentId) {
65: Criteria correctedByCriteria = new Criteria();
66: correctedByCriteria.addEqualTo(
67: "financialDocumentInErrorNumber", documentId);
68:
69: return (DocumentHeader) getPersistenceBrokerTemplate()
70: .getObjectByQuery(
71: QueryFactory.newQuery(DocumentHeader.class,
72: correctedByCriteria));
73: }
74:
75: /**
76: * @see org.kuali.core.dao.DocumentHeaderDao#getByDocumentFinalDate(Date documentFinalDate)
77: */
78: public Collection getByDocumentFinalDate(Date documentFinalDate) {
79: Criteria criteria = new Criteria();
80: criteria.addEqualTo(RicePropertyConstants.DOCUMENT_FINAL_DATE,
81: documentFinalDate);
82: return getPersistenceBrokerTemplate().getCollectionByQuery(
83: QueryFactory.newQuery(DocumentHeader.class, criteria));
84: }
85: }
|