1 /**
2 * Copyright 2011 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.mobility.push.service;
17
18 import java.util.List;
19
20 import org.kuali.mobility.push.dao.PreferenceDao;
21 import org.kuali.mobility.push.entity.Preference;
22 import org.kuali.mobility.push.entity.Sender;
23 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.stereotype.Service;
25 import org.springframework.transaction.annotation.Transactional;
26
27 /**
28 * Implementation of the Sender Service
29 *
30 * @author Kuali Mobility Team (mobility.dev@kuali.org)
31 * @since 2.0.0
32 */
33 @Service
34 public class PreferenceServiceImpl implements PreferenceService{
35
36 /** A reference to the <code>PreferenceDao</code> */
37 @Autowired
38 private PreferenceDao preferenceDao;
39
40 /*
41 * (non-Javadoc)
42 * @see org.kuali.mobility.push.service.PreferenceService#findPreferencesByUsername(java.lang.String)
43 */
44 @Transactional
45 public List<Preference> findPreferencesByUsername(String username){
46 return preferenceDao.findPreferencesByUsername(username);
47 }
48
49 /*
50 * (non-Javadoc)
51 * @see org.kuali.mobility.push.service.PreferenceService#findPreference(java.lang.String, java.lang.String)
52 */
53 @Transactional
54 public Preference findPreference(String username, String shortName){
55 return preferenceDao.findPreference(username, shortName);
56 }
57
58 /*
59 * (non-Javadoc)
60 * @see org.kuali.mobility.push.service.PreferenceService#findPreference(java.lang.String, org.kuali.mobility.push.entity.Sender)
61 */
62 @Transactional
63 public Preference findPreference(String username, Sender sender){
64 return preferenceDao.findPreference(username, sender);
65 }
66
67 /*
68 * (non-Javadoc)
69 * @see org.kuali.mobility.push.service.PreferenceService#findPreference(long)
70 */
71 @Transactional
72 public Preference findPreference(long id){
73 return preferenceDao.findPreference(id);
74 }
75
76 /*
77 * (non-Javadoc)
78 * @see org.kuali.mobility.push.service.PreferenceService#savePreference(org.kuali.mobility.push.entity.Preference)
79 */
80 @Transactional
81 public void savePreference(Preference preference){
82 preferenceDao.savePreference(preference);
83 }
84
85 /*
86 * (non-Javadoc)
87 * @see org.kuali.mobility.push.service.PreferenceService#removePreference(org.kuali.mobility.push.entity.Preference)
88 */
89 @Transactional
90 public boolean removePreference(Preference preference){
91 return preferenceDao.removePreference(preference);
92 }
93
94
95 /*
96 * (non-Javadoc)
97 * @see org.kuali.mobility.push.service.PreferenceService#setPreference(org.kuali.mobility.push.entity.Preference, boolean)
98 */
99 @Override
100 @Transactional
101 public void setPreference(Preference preference, boolean enabled ){
102 preferenceDao.setPreference(preference, enabled);
103 }
104
105 /**
106 * Gets the reference to the <code>PreferenceDao</code>
107 * @return
108 */
109 public PreferenceDao getPreferenceDao() {
110 return preferenceDao;
111 }
112
113 /**
114 * Sets the reference to the <code>PreferenceDao</code>
115 * @param dao
116 */
117 @Autowired
118 public void setPreferenceDao(PreferenceDao preferenceDao) {
119 this.preferenceDao = preferenceDao;
120 }
121
122
123
124 }