Coverage Report - org.kuali.rice.ken.service.impl.NotificationChannelServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
NotificationChannelServiceImpl
0%
0/19
0%
0/6
1.4
 
 1  
 /*
 2  
  * Copyright 2006-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  
 
 17  
 package org.kuali.rice.ken.service.impl;
 18  
 
 19  
 import org.kuali.rice.core.framework.persistence.dao.GenericDao;
 20  
 import org.kuali.rice.ken.bo.NotificationChannel;
 21  
 import org.kuali.rice.ken.service.NotificationChannelService;
 22  
 
 23  
 import java.util.Collection;
 24  
 import java.util.HashMap;
 25  
 import java.util.Map;
 26  
 
 27  
 /**
 28  
  * NotificationChannelService implementation - uses the businessObjectDao to get at data in the underlying database.
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  */
 31  0
 public class NotificationChannelServiceImpl implements NotificationChannelService {
 32  
     private GenericDao businessObjectDao;
 33  
 
 34  
     /**
 35  
      * Constructs a NotificationChannelServiceImpl.java.
 36  
      * @param businessObjectDao
 37  
      */
 38  0
     public NotificationChannelServiceImpl(GenericDao businessObjectDao) {
 39  0
         this.businessObjectDao = businessObjectDao;
 40  0
     }
 41  
 
 42  
     /**
 43  
      * @see org.kuali.rice.ken.service.NotificationChannelService#getNotificationChannel(java.lang.String)
 44  
      */
 45  
     public NotificationChannel getNotificationChannel(String id) {
 46  0
         Map<String,  String> primaryKeys = new HashMap<String, String>();
 47  0
         primaryKeys.put("id", id);
 48  0
         return (NotificationChannel) businessObjectDao.findByPrimaryKey(NotificationChannel.class, primaryKeys);
 49  
     }
 50  
 
 51  
     /**
 52  
      * @see org.kuali.rice.ken.service.NotificationChannelService#getNotificationChannelByName(java.lang.String)
 53  
      */
 54  
     public NotificationChannel getNotificationChannelByName(String name) {
 55  0
         Map<String,  String> fields = new HashMap<String, String>();
 56  0
         fields.put("name", name);
 57  0
         Collection<NotificationChannel> found = businessObjectDao.findMatching(NotificationChannel.class, fields);
 58  0
         assert(found.size() <= 1);
 59  0
         if (found.size() == 0) return null;
 60  0
         return found.iterator().next();
 61  
     }
 62  
 
 63  
     /**
 64  
      * @see org.kuali.rice.ken.service.NotificationChannelService#getSubscribableChannels()
 65  
      */
 66  
     public Collection getSubscribableChannels() {
 67  0
         Map<String, Boolean> fieldValues = new HashMap<String, Boolean>();
 68  0
         String sortField = new String("name");
 69  0
         fieldValues.put("subscribable", true);
 70  0
         return businessObjectDao.findMatchingOrderBy(NotificationChannel.class, fieldValues, sortField, true);
 71  
     }
 72  
 
 73  
     /**
 74  
      * @see org.kuali.rice.ken.service.NotificationChannelService#getAllNotificationChannels()
 75  
      */
 76  
     public Collection getAllNotificationChannels() {
 77  0
         String sortField = new String("name");
 78  0
         return businessObjectDao.findAllOrderBy(NotificationChannel.class, sortField, true);
 79  
     }
 80  
 }