Coverage Report - org.kuali.rice.edl.impl.dao.impl.EDocLiteDAOOjbImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
EDocLiteDAOOjbImpl
0%
0/40
0%
0/12
1.75
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.edl.impl.dao.impl;
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.Iterator;
 21  
 import java.util.List;
 22  
 
 23  
 import org.apache.ojb.broker.query.Criteria;
 24  
 import org.apache.ojb.broker.query.QueryByCriteria;
 25  
 import org.kuali.rice.edl.impl.bo.EDocLiteAssociation;
 26  
 import org.kuali.rice.edl.impl.bo.EDocLiteDefinition;
 27  
 import org.kuali.rice.edl.impl.dao.EDocLiteDAO;
 28  
 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
 29  
 
 30  
 
 31  0
 public class EDocLiteDAOOjbImpl extends PersistenceBrokerDaoSupport implements EDocLiteDAO {
 32  
 
 33  
     public void saveEDocLiteDefinition(EDocLiteDefinition edocLiteData) {
 34  0
             this.getPersistenceBrokerTemplate().store(edocLiteData);
 35  0
     }
 36  
 
 37  
     public void saveEDocLiteAssociation(EDocLiteAssociation assoc) {
 38  0
             this.getPersistenceBrokerTemplate().store(assoc);
 39  0
     }
 40  
 
 41  
     public EDocLiteDefinition getEDocLiteDefinition(String defName) {
 42  0
         Criteria criteria = new Criteria();
 43  0
         criteria.addEqualTo("name", defName);
 44  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 45  0
         return (EDocLiteDefinition) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria));
 46  
     }
 47  
 
 48  
     public EDocLiteAssociation getEDocLiteAssociation(String docTypeName) {
 49  0
         Criteria criteria = new Criteria();
 50  0
         criteria.addEqualTo("edlName", docTypeName);
 51  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 52  0
         return (EDocLiteAssociation) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteAssociation.class, criteria));
 53  
     }
 54  
 
 55  
     public List getEDocLiteDefinitions() {
 56  0
         Criteria criteria = new Criteria();
 57  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 58  0
         Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria));
 59  0
         List defs = new ArrayList();
 60  0
         while (it.hasNext()) {
 61  0
             defs.add(((EDocLiteDefinition) it.next()).getName());
 62  
         }
 63  0
         return defs;
 64  
     }
 65  
 
 66  
     public List getEDocLiteAssociations() {
 67  0
         Criteria criteria = new Criteria();
 68  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 69  0
         Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteAssociation.class, criteria));
 70  0
         List assocs = new ArrayList();
 71  0
         while (it.hasNext()) {
 72  0
             assocs.add(it.next());
 73  
         }
 74  0
         return assocs;
 75  
     }
 76  
 
 77  
         public List search(EDocLiteAssociation edocLite) {
 78  0
                 Criteria crit = new Criteria();
 79  0
                 if (edocLite.getActiveInd() != null) {
 80  0
                         crit.addEqualTo("activeInd", edocLite.getActiveInd());
 81  
                 }
 82  0
                 if (edocLite.getDefinition() != null) {
 83  0
                         crit.addLike("UPPER(definition)", "%"+edocLite.getDefinition().toUpperCase()+"%");
 84  
                 }
 85  0
                 if (edocLite.getEdlName() != null) {
 86  0
                         crit.addLike("UPPER(edlName)", "%"+edocLite.getEdlName().toUpperCase()+"%");
 87  
                 }
 88  0
                 if (edocLite.getStyle() != null) {
 89  0
                         crit.addLike("UPPER(style)", "%"+edocLite.getStyle().toUpperCase()+"%");
 90  
                 }
 91  0
                 return (List)this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(EDocLiteAssociation.class, crit));
 92  
         }
 93  
 
 94  
         public EDocLiteAssociation getEDocLiteAssociation(Long associationId) {
 95  0
                 Criteria crit = new Criteria();
 96  0
                 crit.addEqualTo("edocLiteAssocId", associationId);
 97  0
                 return (EDocLiteAssociation)this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteAssociation.class, crit));
 98  
         }
 99  
 }