1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.ratings.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.portal.PortalException;
29  import com.liferay.portal.SystemException;
30  import com.liferay.portal.kernel.annotation.BeanReference;
31  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
32  import com.liferay.portal.util.PortalUtil;
33  
34  import com.liferay.portlet.ratings.model.RatingsStats;
35  import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
36  import com.liferay.portlet.ratings.service.RatingsEntryService;
37  import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
38  import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
39  import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
40  
41  import java.util.List;
42  
43  /**
44   * <a href="RatingsStatsLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
45   *
46   * @author Brian Wing Shun Chan
47   *
48   */
49  public abstract class RatingsStatsLocalServiceBaseImpl
50      implements RatingsStatsLocalService {
51      public RatingsStats addRatingsStats(RatingsStats ratingsStats)
52          throws SystemException {
53          ratingsStats.setNew(true);
54  
55          return ratingsStatsPersistence.update(ratingsStats, false);
56      }
57  
58      public RatingsStats createRatingsStats(long statsId) {
59          return ratingsStatsPersistence.create(statsId);
60      }
61  
62      public void deleteRatingsStats(long statsId)
63          throws PortalException, SystemException {
64          ratingsStatsPersistence.remove(statsId);
65      }
66  
67      public void deleteRatingsStats(RatingsStats ratingsStats)
68          throws SystemException {
69          ratingsStatsPersistence.remove(ratingsStats);
70      }
71  
72      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
73          throws SystemException {
74          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
75      }
76  
77      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
78          int end) throws SystemException {
79          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
80              start, end);
81      }
82  
83      public RatingsStats getRatingsStats(long statsId)
84          throws PortalException, SystemException {
85          return ratingsStatsPersistence.findByPrimaryKey(statsId);
86      }
87  
88      public List<RatingsStats> getRatingsStatses(int start, int end)
89          throws SystemException {
90          return ratingsStatsPersistence.findAll(start, end);
91      }
92  
93      public int getRatingsStatsesCount() throws SystemException {
94          return ratingsStatsPersistence.countAll();
95      }
96  
97      public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
98          throws SystemException {
99          ratingsStats.setNew(false);
100 
101         return ratingsStatsPersistence.update(ratingsStats, true);
102     }
103 
104     public RatingsStats updateRatingsStats(RatingsStats ratingsStats,
105         boolean merge) throws SystemException {
106         ratingsStats.setNew(false);
107 
108         return ratingsStatsPersistence.update(ratingsStats, merge);
109     }
110 
111     public RatingsEntryLocalService getRatingsEntryLocalService() {
112         return ratingsEntryLocalService;
113     }
114 
115     public void setRatingsEntryLocalService(
116         RatingsEntryLocalService ratingsEntryLocalService) {
117         this.ratingsEntryLocalService = ratingsEntryLocalService;
118     }
119 
120     public RatingsEntryService getRatingsEntryService() {
121         return ratingsEntryService;
122     }
123 
124     public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
125         this.ratingsEntryService = ratingsEntryService;
126     }
127 
128     public RatingsEntryPersistence getRatingsEntryPersistence() {
129         return ratingsEntryPersistence;
130     }
131 
132     public void setRatingsEntryPersistence(
133         RatingsEntryPersistence ratingsEntryPersistence) {
134         this.ratingsEntryPersistence = ratingsEntryPersistence;
135     }
136 
137     public RatingsStatsLocalService getRatingsStatsLocalService() {
138         return ratingsStatsLocalService;
139     }
140 
141     public void setRatingsStatsLocalService(
142         RatingsStatsLocalService ratingsStatsLocalService) {
143         this.ratingsStatsLocalService = ratingsStatsLocalService;
144     }
145 
146     public RatingsStatsPersistence getRatingsStatsPersistence() {
147         return ratingsStatsPersistence;
148     }
149 
150     public void setRatingsStatsPersistence(
151         RatingsStatsPersistence ratingsStatsPersistence) {
152         this.ratingsStatsPersistence = ratingsStatsPersistence;
153     }
154 
155     public CounterLocalService getCounterLocalService() {
156         return counterLocalService;
157     }
158 
159     public void setCounterLocalService(CounterLocalService counterLocalService) {
160         this.counterLocalService = counterLocalService;
161     }
162 
163     public CounterService getCounterService() {
164         return counterService;
165     }
166 
167     public void setCounterService(CounterService counterService) {
168         this.counterService = counterService;
169     }
170 
171     protected void runSQL(String sql) throws SystemException {
172         try {
173             PortalUtil.runSQL(sql);
174         }
175         catch (Exception e) {
176             throw new SystemException(e);
177         }
178     }
179 
180     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsEntryLocalService.impl")
181     protected RatingsEntryLocalService ratingsEntryLocalService;
182     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsEntryService.impl")
183     protected RatingsEntryService ratingsEntryService;
184     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence.impl")
185     protected RatingsEntryPersistence ratingsEntryPersistence;
186     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsStatsLocalService.impl")
187     protected RatingsStatsLocalService ratingsStatsLocalService;
188     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence.impl")
189     protected RatingsStatsPersistence ratingsStatsPersistence;
190     @BeanReference(name = "com.liferay.counter.service.CounterLocalService.impl")
191     protected CounterLocalService counterLocalService;
192     @BeanReference(name = "com.liferay.counter.service.CounterService.impl")
193     protected CounterService counterService;
194 }