1   /**
2    * Copyright (c) 2000-2008 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.bean.InitializingBean;
31  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
32  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
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, InitializingBean {
51      public RatingsStats addRatingsStats(RatingsStats ratingsStats)
52          throws SystemException {
53          ratingsStats.setNew(true);
54  
55          return ratingsStatsPersistence.update(ratingsStats, false);
56      }
57  
58      public void deleteRatingsStats(long statsId)
59          throws PortalException, SystemException {
60          ratingsStatsPersistence.remove(statsId);
61      }
62  
63      public void deleteRatingsStats(RatingsStats ratingsStats)
64          throws SystemException {
65          ratingsStatsPersistence.remove(ratingsStats);
66      }
67  
68      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
69          throws SystemException {
70          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
71      }
72  
73      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
74          int end) throws SystemException {
75          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
76              start, end);
77      }
78  
79      public RatingsStats getRatingsStats(long statsId)
80          throws PortalException, SystemException {
81          return ratingsStatsPersistence.findByPrimaryKey(statsId);
82      }
83  
84      public List<RatingsStats> getRatingsStatses(int start, int end)
85          throws SystemException {
86          return ratingsStatsPersistence.findAll(start, end);
87      }
88  
89      public int getRatingsStatsesCount() throws SystemException {
90          return ratingsStatsPersistence.countAll();
91      }
92  
93      public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
94          throws SystemException {
95          ratingsStats.setNew(false);
96  
97          return ratingsStatsPersistence.update(ratingsStats, true);
98      }
99  
100     public RatingsEntryLocalService getRatingsEntryLocalService() {
101         return ratingsEntryLocalService;
102     }
103 
104     public void setRatingsEntryLocalService(
105         RatingsEntryLocalService ratingsEntryLocalService) {
106         this.ratingsEntryLocalService = ratingsEntryLocalService;
107     }
108 
109     public RatingsEntryService getRatingsEntryService() {
110         return ratingsEntryService;
111     }
112 
113     public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
114         this.ratingsEntryService = ratingsEntryService;
115     }
116 
117     public RatingsEntryPersistence getRatingsEntryPersistence() {
118         return ratingsEntryPersistence;
119     }
120 
121     public void setRatingsEntryPersistence(
122         RatingsEntryPersistence ratingsEntryPersistence) {
123         this.ratingsEntryPersistence = ratingsEntryPersistence;
124     }
125 
126     public RatingsStatsPersistence getRatingsStatsPersistence() {
127         return ratingsStatsPersistence;
128     }
129 
130     public void setRatingsStatsPersistence(
131         RatingsStatsPersistence ratingsStatsPersistence) {
132         this.ratingsStatsPersistence = ratingsStatsPersistence;
133     }
134 
135     public CounterLocalService getCounterLocalService() {
136         return counterLocalService;
137     }
138 
139     public void setCounterLocalService(CounterLocalService counterLocalService) {
140         this.counterLocalService = counterLocalService;
141     }
142 
143     public CounterService getCounterService() {
144         return counterService;
145     }
146 
147     public void setCounterService(CounterService counterService) {
148         this.counterService = counterService;
149     }
150 
151     public void afterPropertiesSet() {
152         if (ratingsEntryLocalService == null) {
153             ratingsEntryLocalService = (RatingsEntryLocalService)PortalBeanLocatorUtil.locate(RatingsEntryLocalService.class.getName() +
154                     ".impl");
155         }
156 
157         if (ratingsEntryService == null) {
158             ratingsEntryService = (RatingsEntryService)PortalBeanLocatorUtil.locate(RatingsEntryService.class.getName() +
159                     ".impl");
160         }
161 
162         if (ratingsEntryPersistence == null) {
163             ratingsEntryPersistence = (RatingsEntryPersistence)PortalBeanLocatorUtil.locate(RatingsEntryPersistence.class.getName() +
164                     ".impl");
165         }
166 
167         if (ratingsStatsPersistence == null) {
168             ratingsStatsPersistence = (RatingsStatsPersistence)PortalBeanLocatorUtil.locate(RatingsStatsPersistence.class.getName() +
169                     ".impl");
170         }
171 
172         if (counterLocalService == null) {
173             counterLocalService = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName() +
174                     ".impl");
175         }
176 
177         if (counterService == null) {
178             counterService = (CounterService)PortalBeanLocatorUtil.locate(CounterService.class.getName() +
179                     ".impl");
180         }
181     }
182 
183     protected RatingsEntryLocalService ratingsEntryLocalService;
184     protected RatingsEntryService ratingsEntryService;
185     protected RatingsEntryPersistence ratingsEntryPersistence;
186     protected RatingsStatsPersistence ratingsStatsPersistence;
187     protected CounterLocalService counterLocalService;
188     protected CounterService counterService;
189 }