View Javadoc

1   /**
2    * Copyright 2005-2012 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  	private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentHeaderDaoOjb.class);
31  
32  	private Class documentHeaderBaseClass = DocumentHeader.class;
33  
34  	/**
35  	 * Default constructor
36  	 */
37  	public DocumentHeaderDaoOjb() {
38  		super();
39  	}
40  
41  	/**
42  	 * @see org.kuali.rice.krad.dao.DocumentHeaderDao#getByDocumentHeaderId(java.lang.String)
43  	 */
44  	public DocumentHeader getByDocumentHeaderId(String id) {
45  		Criteria criteria = new Criteria();
46  		criteria.addEqualTo(KRADPropertyConstants.DOCUMENT_NUMBER, id);
47  
48  		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  		return this.documentHeaderBaseClass;
58  	}
59  
60  	/**
61  	 * @param documentHeaderBaseClass the documentHeaderBaseClass to set
62  	 */
63  	public void setDocumentHeaderBaseClass(Class documentHeaderBaseClass) {
64  		this.documentHeaderBaseClass = documentHeaderBaseClass;
65  	}
66  
67  }