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