Coverage Report - br.com.arsmachina.authentication.dao.hibernate.PermissionGroupDAOImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionGroupDAOImpl
0%
0/6
N/A
0
 
 1  
 // Copyright 2008 Thiago H. de Paula Figueiredo
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package br.com.arsmachina.authentication.dao.hibernate;
 16  
 
 17  
 
 18  
 import org.hibernate.Criteria;
 19  
 import org.hibernate.SessionFactory;
 20  
 import org.hibernate.criterion.Restrictions;
 21  
 
 22  
 import br.com.arsmachina.authentication.dao.PermissionGroupDAO;
 23  
 import br.com.arsmachina.authentication.entity.PermissionGroup;
 24  
 import br.com.arsmachina.dao.SortCriterion;
 25  
 import br.com.arsmachina.dao.hibernate.GenericDAOImpl;
 26  
 
 27  
 /**
 28  
  * {@link PermissionGroupDAO} implementation using Hibernate.
 29  
  * 
 30  
  * @author Thiago H. de Paula Figueiredo
 31  
  */
 32  
 public class PermissionGroupDAOImpl extends GenericDAOImpl<PermissionGroup, Integer> implements
 33  
                 PermissionGroupDAO {
 34  
 
 35  
         /**
 36  
          * Single constructor of this class.
 37  
          * 
 38  
          * @param sessionFactory a {@link SessionFactory}. It cannot be null.
 39  
          */
 40  
         public PermissionGroupDAOImpl(SessionFactory sessionFactory) {
 41  0
                 super(sessionFactory);
 42  0
         }
 43  
 
 44  
         /**
 45  
          * @see br.com.arsmachina.authentication.dao.PermissionGroupDAO#findByName(java.lang.String)
 46  
          */
 47  
         public PermissionGroup findByName(String name) {
 48  
 
 49  0
                 final Criteria criteria = createCriteria();
 50  0
                 criteria.add(Restrictions.eq("name", name));
 51  
 
 52  0
                 return (PermissionGroup) criteria.uniqueResult();
 53  
 
 54  
         }
 55  
 
 56  
         /**
 57  
          * Returns {@link Constants#ASCENDING_NAME_SORT_CRITERIA}.
 58  
          * 
 59  
          * @see br.com.arsmachina.dao.hibernate.GenericDAOImpl#getDefaultSortCriteria()
 60  
          */
 61  
         @Override
 62  
         public SortCriterion[] getDefaultSortCriteria() {
 63  0
                 return Constants.ASCENDING_NAME_SORT_CRITERIA;
 64  
         }
 65  
 
 66  
 }