001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.ratings.service.base;
022:
023: import com.liferay.counter.service.CounterLocalService;
024: import com.liferay.counter.service.CounterLocalServiceFactory;
025: import com.liferay.counter.service.CounterService;
026: import com.liferay.counter.service.CounterServiceFactory;
027:
028: import com.liferay.portal.SystemException;
029: import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
030:
031: import com.liferay.portlet.ratings.model.RatingsStats;
032: import com.liferay.portlet.ratings.model.impl.RatingsStatsImpl;
033: import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
034: import com.liferay.portlet.ratings.service.RatingsEntryLocalServiceFactory;
035: import com.liferay.portlet.ratings.service.RatingsEntryService;
036: import com.liferay.portlet.ratings.service.RatingsEntryServiceFactory;
037: import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
038: import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
039: import com.liferay.portlet.ratings.service.persistence.RatingsEntryUtil;
040: import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
041: import com.liferay.portlet.ratings.service.persistence.RatingsStatsUtil;
042:
043: import org.springframework.beans.factory.InitializingBean;
044:
045: import java.util.List;
046:
047: /**
048: * <a href="RatingsStatsLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
049: *
050: * @author Brian Wing Shun Chan
051: *
052: */
053: public abstract class RatingsStatsLocalServiceBaseImpl implements
054: RatingsStatsLocalService, InitializingBean {
055: public RatingsStats addRatingsStats(RatingsStats model)
056: throws SystemException {
057: RatingsStats ratingsStats = new RatingsStatsImpl();
058:
059: ratingsStats.setNew(true);
060:
061: ratingsStats.setStatsId(model.getStatsId());
062: ratingsStats.setClassNameId(model.getClassNameId());
063: ratingsStats.setClassPK(model.getClassPK());
064: ratingsStats.setTotalEntries(model.getTotalEntries());
065: ratingsStats.setTotalScore(model.getTotalScore());
066: ratingsStats.setAverageScore(model.getAverageScore());
067:
068: return ratingsStatsPersistence.update(ratingsStats);
069: }
070:
071: public List dynamicQuery(DynamicQueryInitializer queryInitializer)
072: throws SystemException {
073: return ratingsStatsPersistence
074: .findWithDynamicQuery(queryInitializer);
075: }
076:
077: public List dynamicQuery(DynamicQueryInitializer queryInitializer,
078: int begin, int end) throws SystemException {
079: return ratingsStatsPersistence.findWithDynamicQuery(
080: queryInitializer, begin, end);
081: }
082:
083: public RatingsStats updateRatingsStats(RatingsStats model)
084: throws SystemException {
085: return ratingsStatsPersistence.update(model, true);
086: }
087:
088: public RatingsEntryLocalService getRatingsEntryLocalService() {
089: return ratingsEntryLocalService;
090: }
091:
092: public void setRatingsEntryLocalService(
093: RatingsEntryLocalService ratingsEntryLocalService) {
094: this .ratingsEntryLocalService = ratingsEntryLocalService;
095: }
096:
097: public RatingsEntryService getRatingsEntryService() {
098: return ratingsEntryService;
099: }
100:
101: public void setRatingsEntryService(
102: RatingsEntryService ratingsEntryService) {
103: this .ratingsEntryService = ratingsEntryService;
104: }
105:
106: public RatingsEntryPersistence getRatingsEntryPersistence() {
107: return ratingsEntryPersistence;
108: }
109:
110: public void setRatingsEntryPersistence(
111: RatingsEntryPersistence ratingsEntryPersistence) {
112: this .ratingsEntryPersistence = ratingsEntryPersistence;
113: }
114:
115: public RatingsStatsPersistence getRatingsStatsPersistence() {
116: return ratingsStatsPersistence;
117: }
118:
119: public void setRatingsStatsPersistence(
120: RatingsStatsPersistence ratingsStatsPersistence) {
121: this .ratingsStatsPersistence = ratingsStatsPersistence;
122: }
123:
124: public CounterLocalService getCounterLocalService() {
125: return counterLocalService;
126: }
127:
128: public void setCounterLocalService(
129: CounterLocalService counterLocalService) {
130: this .counterLocalService = counterLocalService;
131: }
132:
133: public CounterService getCounterService() {
134: return counterService;
135: }
136:
137: public void setCounterService(CounterService counterService) {
138: this .counterService = counterService;
139: }
140:
141: public void afterPropertiesSet() {
142: if (ratingsEntryLocalService == null) {
143: ratingsEntryLocalService = RatingsEntryLocalServiceFactory
144: .getImpl();
145: }
146:
147: if (ratingsEntryService == null) {
148: ratingsEntryService = RatingsEntryServiceFactory.getImpl();
149: }
150:
151: if (ratingsEntryPersistence == null) {
152: ratingsEntryPersistence = RatingsEntryUtil.getPersistence();
153: }
154:
155: if (ratingsStatsPersistence == null) {
156: ratingsStatsPersistence = RatingsStatsUtil.getPersistence();
157: }
158:
159: if (counterLocalService == null) {
160: counterLocalService = CounterLocalServiceFactory.getImpl();
161: }
162:
163: if (counterService == null) {
164: counterService = CounterServiceFactory.getImpl();
165: }
166: }
167:
168: protected RatingsEntryLocalService ratingsEntryLocalService;
169: protected RatingsEntryService ratingsEntryService;
170: protected RatingsEntryPersistence ratingsEntryPersistence;
171: protected RatingsStatsPersistence ratingsStatsPersistence;
172: protected CounterLocalService counterLocalService;
173: protected CounterService counterService;
174: }
|