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-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.edl.impl.dao.impl;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Iterator;
 20  
 import java.util.List;
 21  
 
 22  
 import org.apache.ojb.broker.query.Criteria;
 23  
 import org.apache.ojb.broker.query.QueryByCriteria;
 24  
 import org.kuali.rice.edl.impl.bo.EDocLiteAssociation;
 25  
 import org.kuali.rice.edl.impl.bo.EDocLiteDefinition;
 26  
 import org.kuali.rice.edl.impl.dao.EDocLiteDAO;
 27  
 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
 28  
 
 29  
 
 30  0
 public class EDocLiteDAOOjbImpl extends PersistenceBrokerDaoSupport implements EDocLiteDAO {
 31  
 
 32  
     public void saveEDocLiteDefinition(EDocLiteDefinition edocLiteData) {
 33  0
             this.getPersistenceBrokerTemplate().store(edocLiteData);
 34  0
     }
 35  
 
 36  
     public void saveEDocLiteAssociation(EDocLiteAssociation assoc) {
 37  0
             this.getPersistenceBrokerTemplate().store(assoc);
 38  0
     }
 39  
 
 40  
     public EDocLiteDefinition getEDocLiteDefinition(String defName) {
 41  0
         Criteria criteria = new Criteria();
 42  0
         criteria.addEqualTo("name", defName);
 43  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 44  0
         return (EDocLiteDefinition) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria));
 45  
     }
 46  
 
 47  
     public EDocLiteAssociation getEDocLiteAssociation(String docTypeName) {
 48  0
         Criteria criteria = new Criteria();
 49  0
         criteria.addEqualTo("edlName", docTypeName);
 50  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 51  0
         return (EDocLiteAssociation) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteAssociation.class, criteria));
 52  
     }
 53  
 
 54  
     public List getEDocLiteDefinitions() {
 55  0
         Criteria criteria = new Criteria();
 56  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 57  0
         Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria));
 58  0
         List defs = new ArrayList();
 59  0
         while (it.hasNext()) {
 60  0
             defs.add(((EDocLiteDefinition) it.next()).getName());
 61  
         }
 62  0
         return defs;
 63  
     }
 64  
 
 65  
     public List getEDocLiteAssociations() {
 66  0
         Criteria criteria = new Criteria();
 67  0
         criteria.addEqualTo("activeInd", Boolean.TRUE);
 68  0
         Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteAssociation.class, criteria));
 69  0
         List assocs = new ArrayList();
 70  0
         while (it.hasNext()) {
 71  0
             assocs.add(it.next());
 72  
         }
 73  0
         return assocs;
 74  
     }
 75  
 
 76  
         public List search(EDocLiteAssociation edocLite) {
 77  0
                 Criteria crit = new Criteria();
 78  0
                 if (edocLite.getActiveInd() != null) {
 79  0
                         crit.addEqualTo("activeInd", edocLite.getActiveInd());
 80  
                 }
 81  0
                 if (edocLite.getDefinition() != null) {
 82  0
                         crit.addLike("UPPER(definition)", "%"+edocLite.getDefinition().toUpperCase()+"%");
 83  
                 }
 84  0
                 if (edocLite.getEdlName() != null) {
 85  0
                         crit.addLike("UPPER(edlName)", "%"+edocLite.getEdlName().toUpperCase()+"%");
 86  
                 }
 87  0
                 if (edocLite.getStyle() != null) {
 88  0
                         crit.addLike("UPPER(style)", "%"+edocLite.getStyle().toUpperCase()+"%");
 89  
                 }
 90  0
                 return (List)this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(EDocLiteAssociation.class, crit));
 91  
         }
 92  
 
 93  
         public EDocLiteAssociation getEDocLiteAssociation(Long associationId) {
 94  0
                 Criteria crit = new Criteria();
 95  0
                 crit.addEqualTo("edocLiteAssocId", associationId);
 96  0
                 return (EDocLiteAssociation)this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteAssociation.class, crit));
 97  
         }
 98  
 }