View Javadoc
1   /*
2    * Copyright 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.ole.sys.dataaccess.impl;
17  
18  import org.apache.log4j.Logger;
19  import org.apache.ojb.broker.query.Criteria;
20  import org.apache.ojb.broker.query.QueryByCriteria;
21  import org.apache.ojb.broker.query.QueryFactory;
22  import org.kuali.ole.sys.businessobject.OriginationCode;
23  import org.kuali.ole.sys.dataaccess.OriginationCodeDao;
24  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
25  
26  public class OriginationCodeDaoOjb extends PlatformAwareDaoBaseOjb implements OriginationCodeDao {
27      private static Logger LOG = Logger.getLogger(OriginationCodeDaoOjb.class);
28  
29      public OriginationCodeDaoOjb() {
30          super();
31      }
32  
33      /*
34       * (non-Javadoc)
35       * 
36       * @see org.kuali.rice.krad.dao.OriginationCodeDao#delete(org.kuali.rice.krad.bo.OriginationCode)
37       */
38      public void delete(OriginationCode code) {
39          getPersistenceBrokerTemplate().delete(code);
40      }
41  
42      /*
43       * (non-Javadoc)
44       * 
45       * @see org.kuali.rice.krad.dao.OriginationCodeDao#findByCode(java.lang.String)
46       */
47      public OriginationCode findByCode(String originationCode) {
48          // TODO Auto-generated method stub
49          Criteria criteria = new Criteria();
50          criteria.addEqualTo("FS_ORIGIN_CD", originationCode);
51  
52          QueryByCriteria query = QueryFactory.newQuery(OriginationCode.class, criteria);
53          return (OriginationCode) getPersistenceBrokerTemplate().getObjectByQuery(query);
54      }
55  
56  }