Coverage Report - org.kuali.rice.core.impl.style.StyleDaoOjb
 
Classes in this File Line Coverage Branch Coverage Complexity
StyleDaoOjb
0%
0/18
0%
0/6
2.667
 
 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.core.impl.style;
 18  
 
 19  
 import java.util.ArrayList;
 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.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
 25  
 
 26  
 /**
 27  
  * An OJB implementation of the {@link StyleDao}.
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  *
 31  
  */
 32  0
 public class StyleDaoOjb extends PersistenceBrokerDaoSupport implements StyleDao {
 33  
 
 34  
         @Override
 35  
     public void saveStyle(StyleBo styleData) {
 36  0
                 if (styleData == null) {
 37  0
                         return;
 38  
                 }
 39  0
         this.getPersistenceBrokerTemplate().store(styleData);
 40  0
     }
 41  
 
 42  
         @Override
 43  
     public StyleBo getStyle(String styleName) {
 44  0
                 if (styleName == null) {
 45  0
                         return null;
 46  
                 }
 47  0
         Criteria criteria = new Criteria();
 48  0
         criteria.addEqualTo("name", styleName);
 49  0
         criteria.addEqualTo("active", Boolean.TRUE);
 50  0
         return (StyleBo) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(StyleBo.class, criteria));
 51  
     }
 52  
         
 53  
         @Override
 54  
         public List<String> getAllStyleNames() {
 55  0
                 Criteria criteria = new Criteria();
 56  0
         criteria.addEqualTo("active", Boolean.TRUE);
 57  0
         List<StyleBo> styles = (List<StyleBo>)this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(StyleBo.class, criteria));
 58  0
         List<String> styleNames = new ArrayList<String>();
 59  0
         for (StyleBo style : styles) {
 60  0
                 styleNames.add(style.getName());
 61  
         }
 62  0
         return styleNames;
 63  
     }
 64  
 
 65  
 }