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