Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentHeaderDaoOjb |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2005-2007 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.rice.kns.dao.impl; | |
17 | ||
18 | import org.apache.ojb.broker.query.Criteria; | |
19 | import org.apache.ojb.broker.query.QueryFactory; | |
20 | import org.kuali.rice.kns.bo.DocumentHeader; | |
21 | import org.kuali.rice.kns.dao.DocumentHeaderDao; | |
22 | import org.kuali.rice.kns.util.KNSPropertyConstants; | |
23 | ||
24 | /** | |
25 | * This class is the OJB implementation of the DocumentHeaderDao interface. | |
26 | * | |
27 | */ | |
28 | public class DocumentHeaderDaoOjb extends PlatformAwareDaoBaseOjb implements DocumentHeaderDao { | |
29 | 0 | private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentHeaderDaoOjb.class); |
30 | ||
31 | 0 | private Class documentHeaderBaseClass = DocumentHeader.class; |
32 | ||
33 | /** | |
34 | * Default constructor | |
35 | */ | |
36 | public DocumentHeaderDaoOjb() { | |
37 | 0 | super(); |
38 | 0 | } |
39 | ||
40 | /** | |
41 | * @see org.kuali.rice.kns.dao.DocumentHeaderDao#getByDocumentHeaderId(java.lang.String) | |
42 | */ | |
43 | public DocumentHeader getByDocumentHeaderId(String id) { | |
44 | 0 | Criteria criteria = new Criteria(); |
45 | 0 | criteria.addEqualTo(KNSPropertyConstants.DOCUMENT_NUMBER, id); |
46 | ||
47 | 0 | return (DocumentHeader) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(getDocumentHeaderBaseClass(), criteria)); |
48 | } | |
49 | ||
50 | /** | |
51 | * Method used to define the {@link DocumentHeader} object to use in case clients need to override the class. Default value is {@link DocumentHeader}. | |
52 | * | |
53 | * @see org.kuali.rice.kns.dao.DocumentHeaderDao#getDocumentHeaderBaseClass() | |
54 | */ | |
55 | public Class getDocumentHeaderBaseClass() { | |
56 | 0 | return this.documentHeaderBaseClass; |
57 | } | |
58 | ||
59 | /** | |
60 | * @param documentHeaderBaseClass the documentHeaderBaseClass to set | |
61 | */ | |
62 | public void setDocumentHeaderBaseClass(Class documentHeaderBaseClass) { | |
63 | 0 | this.documentHeaderBaseClass = documentHeaderBaseClass; |
64 | 0 | } |
65 | ||
66 | } |