001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.expando.service.base;
016    
017    import com.liferay.counter.service.CounterLocalService;
018    
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.service.ResourceLocalService;
027    import com.liferay.portal.service.ResourceService;
028    import com.liferay.portal.service.UserLocalService;
029    import com.liferay.portal.service.UserService;
030    import com.liferay.portal.service.persistence.ResourceFinder;
031    import com.liferay.portal.service.persistence.ResourcePersistence;
032    import com.liferay.portal.service.persistence.UserFinder;
033    import com.liferay.portal.service.persistence.UserPersistence;
034    
035    import com.liferay.portlet.expando.model.ExpandoRow;
036    import com.liferay.portlet.expando.service.ExpandoColumnLocalService;
037    import com.liferay.portlet.expando.service.ExpandoColumnService;
038    import com.liferay.portlet.expando.service.ExpandoRowLocalService;
039    import com.liferay.portlet.expando.service.ExpandoTableLocalService;
040    import com.liferay.portlet.expando.service.ExpandoValueLocalService;
041    import com.liferay.portlet.expando.service.ExpandoValueService;
042    import com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence;
043    import com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence;
044    import com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence;
045    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
046    
047    import java.util.List;
048    
049    import javax.sql.DataSource;
050    
051    /**
052     * The base implementation of the expando row local service.
053     *
054     * <p>
055     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portlet.expando.service.impl.ExpandoRowLocalServiceImpl}.
056     * </p>
057     *
058     * <p>
059     * Never modify or reference this class directly. Always use {@link com.liferay.portlet.expando.service.ExpandoRowLocalServiceUtil} to access the expando row local service.
060     * </p>
061     *
062     * @author Brian Wing Shun Chan
063     * @see com.liferay.portlet.expando.service.impl.ExpandoRowLocalServiceImpl
064     * @see com.liferay.portlet.expando.service.ExpandoRowLocalServiceUtil
065     * @generated
066     */
067    public abstract class ExpandoRowLocalServiceBaseImpl
068            implements ExpandoRowLocalService {
069            /**
070             * Adds the expando row to the database. Also notifies the appropriate model listeners.
071             *
072             * @param expandoRow the expando row to add
073             * @return the expando row that was added
074             * @throws SystemException if a system exception occurred
075             */
076            public ExpandoRow addExpandoRow(ExpandoRow expandoRow)
077                    throws SystemException {
078                    expandoRow.setNew(true);
079    
080                    return expandoRowPersistence.update(expandoRow, false);
081            }
082    
083            /**
084             * Creates a new expando row with the primary key. Does not add the expando row to the database.
085             *
086             * @param rowId the primary key for the new expando row
087             * @return the new expando row
088             */
089            public ExpandoRow createExpandoRow(long rowId) {
090                    return expandoRowPersistence.create(rowId);
091            }
092    
093            /**
094             * Deletes the expando row with the primary key from the database. Also notifies the appropriate model listeners.
095             *
096             * @param rowId the primary key of the expando row to delete
097             * @throws PortalException if a expando row with the primary key could not be found
098             * @throws SystemException if a system exception occurred
099             */
100            public void deleteExpandoRow(long rowId)
101                    throws PortalException, SystemException {
102                    expandoRowPersistence.remove(rowId);
103            }
104    
105            /**
106             * Deletes the expando row from the database. Also notifies the appropriate model listeners.
107             *
108             * @param expandoRow the expando row to delete
109             * @throws SystemException if a system exception occurred
110             */
111            public void deleteExpandoRow(ExpandoRow expandoRow)
112                    throws SystemException {
113                    expandoRowPersistence.remove(expandoRow);
114            }
115    
116            /**
117             * Performs a dynamic query on the database and returns the matching rows.
118             *
119             * @param dynamicQuery the dynamic query to search with
120             * @return the matching rows
121             * @throws SystemException if a system exception occurred
122             */
123            @SuppressWarnings("rawtypes")
124            public List dynamicQuery(DynamicQuery dynamicQuery)
125                    throws SystemException {
126                    return expandoRowPersistence.findWithDynamicQuery(dynamicQuery);
127            }
128    
129            /**
130             * Performs a dynamic query on the database and returns a range of the matching rows.
131             *
132             * <p>
133             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
134             * </p>
135             *
136             * @param dynamicQuery the dynamic query to search with
137             * @param start the lower bound of the range of model instances to return
138             * @param end the upper bound of the range of model instances to return (not inclusive)
139             * @return the range of matching rows
140             * @throws SystemException if a system exception occurred
141             */
142            @SuppressWarnings("rawtypes")
143            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
144                    throws SystemException {
145                    return expandoRowPersistence.findWithDynamicQuery(dynamicQuery, start,
146                            end);
147            }
148    
149            /**
150             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
151             *
152             * <p>
153             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
154             * </p>
155             *
156             * @param dynamicQuery the dynamic query to search with
157             * @param start the lower bound of the range of model instances to return
158             * @param end the upper bound of the range of model instances to return (not inclusive)
159             * @param orderByComparator the comparator to order the results by
160             * @return the ordered range of matching rows
161             * @throws SystemException if a system exception occurred
162             */
163            @SuppressWarnings("rawtypes")
164            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
165                    OrderByComparator orderByComparator) throws SystemException {
166                    return expandoRowPersistence.findWithDynamicQuery(dynamicQuery, start,
167                            end, orderByComparator);
168            }
169    
170            /**
171             * Counts the number of rows that match the dynamic query.
172             *
173             * @param dynamicQuery the dynamic query to search with
174             * @return the number of rows that match the dynamic query
175             * @throws SystemException if a system exception occurred
176             */
177            public long dynamicQueryCount(DynamicQuery dynamicQuery)
178                    throws SystemException {
179                    return expandoRowPersistence.countWithDynamicQuery(dynamicQuery);
180            }
181    
182            /**
183             * Gets the expando row with the primary key.
184             *
185             * @param rowId the primary key of the expando row to get
186             * @return the expando row
187             * @throws PortalException if a expando row with the primary key could not be found
188             * @throws SystemException if a system exception occurred
189             */
190            public ExpandoRow getExpandoRow(long rowId)
191                    throws PortalException, SystemException {
192                    return expandoRowPersistence.findByPrimaryKey(rowId);
193            }
194    
195            /**
196             * Gets a range of all the expando rows.
197             *
198             * <p>
199             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
200             * </p>
201             *
202             * @param start the lower bound of the range of expando rows to return
203             * @param end the upper bound of the range of expando rows to return (not inclusive)
204             * @return the range of expando rows
205             * @throws SystemException if a system exception occurred
206             */
207            public List<ExpandoRow> getExpandoRows(int start, int end)
208                    throws SystemException {
209                    return expandoRowPersistence.findAll(start, end);
210            }
211    
212            /**
213             * Gets the number of expando rows.
214             *
215             * @return the number of expando rows
216             * @throws SystemException if a system exception occurred
217             */
218            public int getExpandoRowsCount() throws SystemException {
219                    return expandoRowPersistence.countAll();
220            }
221    
222            /**
223             * Updates the expando row in the database. Also notifies the appropriate model listeners.
224             *
225             * @param expandoRow the expando row to update
226             * @return the expando row that was updated
227             * @throws SystemException if a system exception occurred
228             */
229            public ExpandoRow updateExpandoRow(ExpandoRow expandoRow)
230                    throws SystemException {
231                    expandoRow.setNew(false);
232    
233                    return expandoRowPersistence.update(expandoRow, true);
234            }
235    
236            /**
237             * Updates the expando row in the database. Also notifies the appropriate model listeners.
238             *
239             * @param expandoRow the expando row to update
240             * @param merge whether to merge the expando row with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
241             * @return the expando row that was updated
242             * @throws SystemException if a system exception occurred
243             */
244            public ExpandoRow updateExpandoRow(ExpandoRow expandoRow, boolean merge)
245                    throws SystemException {
246                    expandoRow.setNew(false);
247    
248                    return expandoRowPersistence.update(expandoRow, merge);
249            }
250    
251            /**
252             * Gets the expando column local service.
253             *
254             * @return the expando column local service
255             */
256            public ExpandoColumnLocalService getExpandoColumnLocalService() {
257                    return expandoColumnLocalService;
258            }
259    
260            /**
261             * Sets the expando column local service.
262             *
263             * @param expandoColumnLocalService the expando column local service
264             */
265            public void setExpandoColumnLocalService(
266                    ExpandoColumnLocalService expandoColumnLocalService) {
267                    this.expandoColumnLocalService = expandoColumnLocalService;
268            }
269    
270            /**
271             * Gets the expando column remote service.
272             *
273             * @return the expando column remote service
274             */
275            public ExpandoColumnService getExpandoColumnService() {
276                    return expandoColumnService;
277            }
278    
279            /**
280             * Sets the expando column remote service.
281             *
282             * @param expandoColumnService the expando column remote service
283             */
284            public void setExpandoColumnService(
285                    ExpandoColumnService expandoColumnService) {
286                    this.expandoColumnService = expandoColumnService;
287            }
288    
289            /**
290             * Gets the expando column persistence.
291             *
292             * @return the expando column persistence
293             */
294            public ExpandoColumnPersistence getExpandoColumnPersistence() {
295                    return expandoColumnPersistence;
296            }
297    
298            /**
299             * Sets the expando column persistence.
300             *
301             * @param expandoColumnPersistence the expando column persistence
302             */
303            public void setExpandoColumnPersistence(
304                    ExpandoColumnPersistence expandoColumnPersistence) {
305                    this.expandoColumnPersistence = expandoColumnPersistence;
306            }
307    
308            /**
309             * Gets the expando row local service.
310             *
311             * @return the expando row local service
312             */
313            public ExpandoRowLocalService getExpandoRowLocalService() {
314                    return expandoRowLocalService;
315            }
316    
317            /**
318             * Sets the expando row local service.
319             *
320             * @param expandoRowLocalService the expando row local service
321             */
322            public void setExpandoRowLocalService(
323                    ExpandoRowLocalService expandoRowLocalService) {
324                    this.expandoRowLocalService = expandoRowLocalService;
325            }
326    
327            /**
328             * Gets the expando row persistence.
329             *
330             * @return the expando row persistence
331             */
332            public ExpandoRowPersistence getExpandoRowPersistence() {
333                    return expandoRowPersistence;
334            }
335    
336            /**
337             * Sets the expando row persistence.
338             *
339             * @param expandoRowPersistence the expando row persistence
340             */
341            public void setExpandoRowPersistence(
342                    ExpandoRowPersistence expandoRowPersistence) {
343                    this.expandoRowPersistence = expandoRowPersistence;
344            }
345    
346            /**
347             * Gets the expando table local service.
348             *
349             * @return the expando table local service
350             */
351            public ExpandoTableLocalService getExpandoTableLocalService() {
352                    return expandoTableLocalService;
353            }
354    
355            /**
356             * Sets the expando table local service.
357             *
358             * @param expandoTableLocalService the expando table local service
359             */
360            public void setExpandoTableLocalService(
361                    ExpandoTableLocalService expandoTableLocalService) {
362                    this.expandoTableLocalService = expandoTableLocalService;
363            }
364    
365            /**
366             * Gets the expando table persistence.
367             *
368             * @return the expando table persistence
369             */
370            public ExpandoTablePersistence getExpandoTablePersistence() {
371                    return expandoTablePersistence;
372            }
373    
374            /**
375             * Sets the expando table persistence.
376             *
377             * @param expandoTablePersistence the expando table persistence
378             */
379            public void setExpandoTablePersistence(
380                    ExpandoTablePersistence expandoTablePersistence) {
381                    this.expandoTablePersistence = expandoTablePersistence;
382            }
383    
384            /**
385             * Gets the expando value local service.
386             *
387             * @return the expando value local service
388             */
389            public ExpandoValueLocalService getExpandoValueLocalService() {
390                    return expandoValueLocalService;
391            }
392    
393            /**
394             * Sets the expando value local service.
395             *
396             * @param expandoValueLocalService the expando value local service
397             */
398            public void setExpandoValueLocalService(
399                    ExpandoValueLocalService expandoValueLocalService) {
400                    this.expandoValueLocalService = expandoValueLocalService;
401            }
402    
403            /**
404             * Gets the expando value remote service.
405             *
406             * @return the expando value remote service
407             */
408            public ExpandoValueService getExpandoValueService() {
409                    return expandoValueService;
410            }
411    
412            /**
413             * Sets the expando value remote service.
414             *
415             * @param expandoValueService the expando value remote service
416             */
417            public void setExpandoValueService(ExpandoValueService expandoValueService) {
418                    this.expandoValueService = expandoValueService;
419            }
420    
421            /**
422             * Gets the expando value persistence.
423             *
424             * @return the expando value persistence
425             */
426            public ExpandoValuePersistence getExpandoValuePersistence() {
427                    return expandoValuePersistence;
428            }
429    
430            /**
431             * Sets the expando value persistence.
432             *
433             * @param expandoValuePersistence the expando value persistence
434             */
435            public void setExpandoValuePersistence(
436                    ExpandoValuePersistence expandoValuePersistence) {
437                    this.expandoValuePersistence = expandoValuePersistence;
438            }
439    
440            /**
441             * Gets the counter local service.
442             *
443             * @return the counter local service
444             */
445            public CounterLocalService getCounterLocalService() {
446                    return counterLocalService;
447            }
448    
449            /**
450             * Sets the counter local service.
451             *
452             * @param counterLocalService the counter local service
453             */
454            public void setCounterLocalService(CounterLocalService counterLocalService) {
455                    this.counterLocalService = counterLocalService;
456            }
457    
458            /**
459             * Gets the resource local service.
460             *
461             * @return the resource local service
462             */
463            public ResourceLocalService getResourceLocalService() {
464                    return resourceLocalService;
465            }
466    
467            /**
468             * Sets the resource local service.
469             *
470             * @param resourceLocalService the resource local service
471             */
472            public void setResourceLocalService(
473                    ResourceLocalService resourceLocalService) {
474                    this.resourceLocalService = resourceLocalService;
475            }
476    
477            /**
478             * Gets the resource remote service.
479             *
480             * @return the resource remote service
481             */
482            public ResourceService getResourceService() {
483                    return resourceService;
484            }
485    
486            /**
487             * Sets the resource remote service.
488             *
489             * @param resourceService the resource remote service
490             */
491            public void setResourceService(ResourceService resourceService) {
492                    this.resourceService = resourceService;
493            }
494    
495            /**
496             * Gets the resource persistence.
497             *
498             * @return the resource persistence
499             */
500            public ResourcePersistence getResourcePersistence() {
501                    return resourcePersistence;
502            }
503    
504            /**
505             * Sets the resource persistence.
506             *
507             * @param resourcePersistence the resource persistence
508             */
509            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
510                    this.resourcePersistence = resourcePersistence;
511            }
512    
513            /**
514             * Gets the resource finder.
515             *
516             * @return the resource finder
517             */
518            public ResourceFinder getResourceFinder() {
519                    return resourceFinder;
520            }
521    
522            /**
523             * Sets the resource finder.
524             *
525             * @param resourceFinder the resource finder
526             */
527            public void setResourceFinder(ResourceFinder resourceFinder) {
528                    this.resourceFinder = resourceFinder;
529            }
530    
531            /**
532             * Gets the user local service.
533             *
534             * @return the user local service
535             */
536            public UserLocalService getUserLocalService() {
537                    return userLocalService;
538            }
539    
540            /**
541             * Sets the user local service.
542             *
543             * @param userLocalService the user local service
544             */
545            public void setUserLocalService(UserLocalService userLocalService) {
546                    this.userLocalService = userLocalService;
547            }
548    
549            /**
550             * Gets the user remote service.
551             *
552             * @return the user remote service
553             */
554            public UserService getUserService() {
555                    return userService;
556            }
557    
558            /**
559             * Sets the user remote service.
560             *
561             * @param userService the user remote service
562             */
563            public void setUserService(UserService userService) {
564                    this.userService = userService;
565            }
566    
567            /**
568             * Gets the user persistence.
569             *
570             * @return the user persistence
571             */
572            public UserPersistence getUserPersistence() {
573                    return userPersistence;
574            }
575    
576            /**
577             * Sets the user persistence.
578             *
579             * @param userPersistence the user persistence
580             */
581            public void setUserPersistence(UserPersistence userPersistence) {
582                    this.userPersistence = userPersistence;
583            }
584    
585            /**
586             * Gets the user finder.
587             *
588             * @return the user finder
589             */
590            public UserFinder getUserFinder() {
591                    return userFinder;
592            }
593    
594            /**
595             * Sets the user finder.
596             *
597             * @param userFinder the user finder
598             */
599            public void setUserFinder(UserFinder userFinder) {
600                    this.userFinder = userFinder;
601            }
602    
603            /**
604             * Performs an SQL query.
605             *
606             * @param sql the sql query to perform
607             */
608            protected void runSQL(String sql) throws SystemException {
609                    try {
610                            DataSource dataSource = expandoRowPersistence.getDataSource();
611    
612                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
613                                            sql, new int[0]);
614    
615                            sqlUpdate.update();
616                    }
617                    catch (Exception e) {
618                            throw new SystemException(e);
619                    }
620            }
621    
622            @BeanReference(type = ExpandoColumnLocalService.class)
623            protected ExpandoColumnLocalService expandoColumnLocalService;
624            @BeanReference(type = ExpandoColumnService.class)
625            protected ExpandoColumnService expandoColumnService;
626            @BeanReference(type = ExpandoColumnPersistence.class)
627            protected ExpandoColumnPersistence expandoColumnPersistence;
628            @BeanReference(type = ExpandoRowLocalService.class)
629            protected ExpandoRowLocalService expandoRowLocalService;
630            @BeanReference(type = ExpandoRowPersistence.class)
631            protected ExpandoRowPersistence expandoRowPersistence;
632            @BeanReference(type = ExpandoTableLocalService.class)
633            protected ExpandoTableLocalService expandoTableLocalService;
634            @BeanReference(type = ExpandoTablePersistence.class)
635            protected ExpandoTablePersistence expandoTablePersistence;
636            @BeanReference(type = ExpandoValueLocalService.class)
637            protected ExpandoValueLocalService expandoValueLocalService;
638            @BeanReference(type = ExpandoValueService.class)
639            protected ExpandoValueService expandoValueService;
640            @BeanReference(type = ExpandoValuePersistence.class)
641            protected ExpandoValuePersistence expandoValuePersistence;
642            @BeanReference(type = CounterLocalService.class)
643            protected CounterLocalService counterLocalService;
644            @BeanReference(type = ResourceLocalService.class)
645            protected ResourceLocalService resourceLocalService;
646            @BeanReference(type = ResourceService.class)
647            protected ResourceService resourceService;
648            @BeanReference(type = ResourcePersistence.class)
649            protected ResourcePersistence resourcePersistence;
650            @BeanReference(type = ResourceFinder.class)
651            protected ResourceFinder resourceFinder;
652            @BeanReference(type = UserLocalService.class)
653            protected UserLocalService userLocalService;
654            @BeanReference(type = UserService.class)
655            protected UserService userService;
656            @BeanReference(type = UserPersistence.class)
657            protected UserPersistence userPersistence;
658            @BeanReference(type = UserFinder.class)
659            protected UserFinder userFinder;
660    }