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