001    /**
002     * Copyright (c) 2000-present 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.softwarecatalog.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.bean.IdentifiableBean;
021    import com.liferay.portal.kernel.dao.db.DB;
022    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
028    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
029    import com.liferay.portal.kernel.dao.orm.Projection;
030    import com.liferay.portal.kernel.exception.PortalException;
031    import com.liferay.portal.kernel.exception.SystemException;
032    import com.liferay.portal.kernel.search.Indexable;
033    import com.liferay.portal.kernel.search.IndexableType;
034    import com.liferay.portal.kernel.util.OrderByComparator;
035    import com.liferay.portal.model.PersistedModel;
036    import com.liferay.portal.service.BaseLocalServiceImpl;
037    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
038    import com.liferay.portal.service.persistence.ImagePersistence;
039    import com.liferay.portal.util.PortalUtil;
040    
041    import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
042    import com.liferay.portlet.softwarecatalog.service.SCProductScreenshotLocalService;
043    import com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence;
044    
045    import java.io.Serializable;
046    
047    import java.util.List;
048    
049    import javax.sql.DataSource;
050    
051    /**
052     * Provides the base implementation for the s c product screenshot 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.softwarecatalog.service.impl.SCProductScreenshotLocalServiceImpl}.
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see com.liferay.portlet.softwarecatalog.service.impl.SCProductScreenshotLocalServiceImpl
060     * @see com.liferay.portlet.softwarecatalog.service.SCProductScreenshotLocalServiceUtil
061     * @generated
062     */
063    @ProviderType
064    public abstract class SCProductScreenshotLocalServiceBaseImpl
065            extends BaseLocalServiceImpl implements SCProductScreenshotLocalService,
066                    IdentifiableBean {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.softwarecatalog.service.SCProductScreenshotLocalServiceUtil} to access the s c product screenshot local service.
071             */
072    
073            /**
074             * Adds the s c product screenshot to the database. Also notifies the appropriate model listeners.
075             *
076             * @param scProductScreenshot the s c product screenshot
077             * @return the s c product screenshot that was added
078             */
079            @Indexable(type = IndexableType.REINDEX)
080            @Override
081            public SCProductScreenshot addSCProductScreenshot(
082                    SCProductScreenshot scProductScreenshot) {
083                    scProductScreenshot.setNew(true);
084    
085                    return scProductScreenshotPersistence.update(scProductScreenshot);
086            }
087    
088            /**
089             * Creates a new s c product screenshot with the primary key. Does not add the s c product screenshot to the database.
090             *
091             * @param productScreenshotId the primary key for the new s c product screenshot
092             * @return the new s c product screenshot
093             */
094            @Override
095            public SCProductScreenshot createSCProductScreenshot(
096                    long productScreenshotId) {
097                    return scProductScreenshotPersistence.create(productScreenshotId);
098            }
099    
100            /**
101             * Deletes the s c product screenshot with the primary key from the database. Also notifies the appropriate model listeners.
102             *
103             * @param productScreenshotId the primary key of the s c product screenshot
104             * @return the s c product screenshot that was removed
105             * @throws PortalException if a s c product screenshot with the primary key could not be found
106             */
107            @Indexable(type = IndexableType.DELETE)
108            @Override
109            public SCProductScreenshot deleteSCProductScreenshot(
110                    long productScreenshotId) throws PortalException {
111                    return scProductScreenshotPersistence.remove(productScreenshotId);
112            }
113    
114            /**
115             * Deletes the s c product screenshot from the database. Also notifies the appropriate model listeners.
116             *
117             * @param scProductScreenshot the s c product screenshot
118             * @return the s c product screenshot that was removed
119             */
120            @Indexable(type = IndexableType.DELETE)
121            @Override
122            public SCProductScreenshot deleteSCProductScreenshot(
123                    SCProductScreenshot scProductScreenshot) {
124                    return scProductScreenshotPersistence.remove(scProductScreenshot);
125            }
126    
127            @Override
128            public DynamicQuery dynamicQuery() {
129                    Class<?> clazz = getClass();
130    
131                    return DynamicQueryFactoryUtil.forClass(SCProductScreenshot.class,
132                            clazz.getClassLoader());
133            }
134    
135            /**
136             * Performs a dynamic query on the database and returns the matching rows.
137             *
138             * @param dynamicQuery the dynamic query
139             * @return the matching rows
140             */
141            @Override
142            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
143                    return scProductScreenshotPersistence.findWithDynamicQuery(dynamicQuery);
144            }
145    
146            /**
147             * Performs a dynamic query on the database and returns a range of the matching rows.
148             *
149             * <p>
150             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
151             * </p>
152             *
153             * @param dynamicQuery the dynamic query
154             * @param start the lower bound of the range of model instances
155             * @param end the upper bound of the range of model instances (not inclusive)
156             * @return the range of matching rows
157             */
158            @Override
159            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
160                    int end) {
161                    return scProductScreenshotPersistence.findWithDynamicQuery(dynamicQuery,
162                            start, end);
163            }
164    
165            /**
166             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
167             *
168             * <p>
169             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
170             * </p>
171             *
172             * @param dynamicQuery the dynamic query
173             * @param start the lower bound of the range of model instances
174             * @param end the upper bound of the range of model instances (not inclusive)
175             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
176             * @return the ordered range of matching rows
177             */
178            @Override
179            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
180                    int end, OrderByComparator<T> orderByComparator) {
181                    return scProductScreenshotPersistence.findWithDynamicQuery(dynamicQuery,
182                            start, end, orderByComparator);
183            }
184    
185            /**
186             * Returns the number of rows matching the dynamic query.
187             *
188             * @param dynamicQuery the dynamic query
189             * @return the number of rows matching the dynamic query
190             */
191            @Override
192            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
193                    return scProductScreenshotPersistence.countWithDynamicQuery(dynamicQuery);
194            }
195    
196            /**
197             * Returns the number of rows matching the dynamic query.
198             *
199             * @param dynamicQuery the dynamic query
200             * @param projection the projection to apply to the query
201             * @return the number of rows matching the dynamic query
202             */
203            @Override
204            public long dynamicQueryCount(DynamicQuery dynamicQuery,
205                    Projection projection) {
206                    return scProductScreenshotPersistence.countWithDynamicQuery(dynamicQuery,
207                            projection);
208            }
209    
210            @Override
211            public SCProductScreenshot fetchSCProductScreenshot(
212                    long productScreenshotId) {
213                    return scProductScreenshotPersistence.fetchByPrimaryKey(productScreenshotId);
214            }
215    
216            /**
217             * Returns the s c product screenshot with the primary key.
218             *
219             * @param productScreenshotId the primary key of the s c product screenshot
220             * @return the s c product screenshot
221             * @throws PortalException if a s c product screenshot with the primary key could not be found
222             */
223            @Override
224            public SCProductScreenshot getSCProductScreenshot(long productScreenshotId)
225                    throws PortalException {
226                    return scProductScreenshotPersistence.findByPrimaryKey(productScreenshotId);
227            }
228    
229            @Override
230            public ActionableDynamicQuery getActionableDynamicQuery() {
231                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
232    
233                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.softwarecatalog.service.SCProductScreenshotLocalServiceUtil.getService());
234                    actionableDynamicQuery.setClass(SCProductScreenshot.class);
235                    actionableDynamicQuery.setClassLoader(getClassLoader());
236    
237                    actionableDynamicQuery.setPrimaryKeyPropertyName("productScreenshotId");
238    
239                    return actionableDynamicQuery;
240            }
241    
242            protected void initActionableDynamicQuery(
243                    ActionableDynamicQuery actionableDynamicQuery) {
244                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.softwarecatalog.service.SCProductScreenshotLocalServiceUtil.getService());
245                    actionableDynamicQuery.setClass(SCProductScreenshot.class);
246                    actionableDynamicQuery.setClassLoader(getClassLoader());
247    
248                    actionableDynamicQuery.setPrimaryKeyPropertyName("productScreenshotId");
249            }
250    
251            /**
252             * @throws PortalException
253             */
254            @Override
255            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
256                    throws PortalException {
257                    return scProductScreenshotLocalService.deleteSCProductScreenshot((SCProductScreenshot)persistedModel);
258            }
259    
260            @Override
261            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
262                    throws PortalException {
263                    return scProductScreenshotPersistence.findByPrimaryKey(primaryKeyObj);
264            }
265    
266            /**
267             * Returns a range of all the s c product screenshots.
268             *
269             * <p>
270             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
271             * </p>
272             *
273             * @param start the lower bound of the range of s c product screenshots
274             * @param end the upper bound of the range of s c product screenshots (not inclusive)
275             * @return the range of s c product screenshots
276             */
277            @Override
278            public List<SCProductScreenshot> getSCProductScreenshots(int start, int end) {
279                    return scProductScreenshotPersistence.findAll(start, end);
280            }
281    
282            /**
283             * Returns the number of s c product screenshots.
284             *
285             * @return the number of s c product screenshots
286             */
287            @Override
288            public int getSCProductScreenshotsCount() {
289                    return scProductScreenshotPersistence.countAll();
290            }
291    
292            /**
293             * Updates the s c product screenshot in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
294             *
295             * @param scProductScreenshot the s c product screenshot
296             * @return the s c product screenshot that was updated
297             */
298            @Indexable(type = IndexableType.REINDEX)
299            @Override
300            public SCProductScreenshot updateSCProductScreenshot(
301                    SCProductScreenshot scProductScreenshot) {
302                    return scProductScreenshotPersistence.update(scProductScreenshot);
303            }
304    
305            /**
306             * Returns the s c product screenshot local service.
307             *
308             * @return the s c product screenshot local service
309             */
310            public SCProductScreenshotLocalService getSCProductScreenshotLocalService() {
311                    return scProductScreenshotLocalService;
312            }
313    
314            /**
315             * Sets the s c product screenshot local service.
316             *
317             * @param scProductScreenshotLocalService the s c product screenshot local service
318             */
319            public void setSCProductScreenshotLocalService(
320                    SCProductScreenshotLocalService scProductScreenshotLocalService) {
321                    this.scProductScreenshotLocalService = scProductScreenshotLocalService;
322            }
323    
324            /**
325             * Returns the s c product screenshot persistence.
326             *
327             * @return the s c product screenshot persistence
328             */
329            public SCProductScreenshotPersistence getSCProductScreenshotPersistence() {
330                    return scProductScreenshotPersistence;
331            }
332    
333            /**
334             * Sets the s c product screenshot persistence.
335             *
336             * @param scProductScreenshotPersistence the s c product screenshot persistence
337             */
338            public void setSCProductScreenshotPersistence(
339                    SCProductScreenshotPersistence scProductScreenshotPersistence) {
340                    this.scProductScreenshotPersistence = scProductScreenshotPersistence;
341            }
342    
343            /**
344             * Returns the counter local service.
345             *
346             * @return the counter local service
347             */
348            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
349                    return counterLocalService;
350            }
351    
352            /**
353             * Sets the counter local service.
354             *
355             * @param counterLocalService the counter local service
356             */
357            public void setCounterLocalService(
358                    com.liferay.counter.service.CounterLocalService counterLocalService) {
359                    this.counterLocalService = counterLocalService;
360            }
361    
362            /**
363             * Returns the image local service.
364             *
365             * @return the image local service
366             */
367            public com.liferay.portal.service.ImageLocalService getImageLocalService() {
368                    return imageLocalService;
369            }
370    
371            /**
372             * Sets the image local service.
373             *
374             * @param imageLocalService the image local service
375             */
376            public void setImageLocalService(
377                    com.liferay.portal.service.ImageLocalService imageLocalService) {
378                    this.imageLocalService = imageLocalService;
379            }
380    
381            /**
382             * Returns the image remote service.
383             *
384             * @return the image remote service
385             */
386            public com.liferay.portal.service.ImageService getImageService() {
387                    return imageService;
388            }
389    
390            /**
391             * Sets the image remote service.
392             *
393             * @param imageService the image remote service
394             */
395            public void setImageService(
396                    com.liferay.portal.service.ImageService imageService) {
397                    this.imageService = imageService;
398            }
399    
400            /**
401             * Returns the image persistence.
402             *
403             * @return the image persistence
404             */
405            public ImagePersistence getImagePersistence() {
406                    return imagePersistence;
407            }
408    
409            /**
410             * Sets the image persistence.
411             *
412             * @param imagePersistence the image persistence
413             */
414            public void setImagePersistence(ImagePersistence imagePersistence) {
415                    this.imagePersistence = imagePersistence;
416            }
417    
418            public void afterPropertiesSet() {
419                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.softwarecatalog.model.SCProductScreenshot",
420                            scProductScreenshotLocalService);
421            }
422    
423            public void destroy() {
424                    persistedModelLocalServiceRegistry.unregister(
425                            "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
426            }
427    
428            /**
429             * Returns the Spring bean ID for this bean.
430             *
431             * @return the Spring bean ID for this bean
432             */
433            @Override
434            public String getBeanIdentifier() {
435                    return _beanIdentifier;
436            }
437    
438            /**
439             * Sets the Spring bean ID for this bean.
440             *
441             * @param beanIdentifier the Spring bean ID for this bean
442             */
443            @Override
444            public void setBeanIdentifier(String beanIdentifier) {
445                    _beanIdentifier = beanIdentifier;
446            }
447    
448            protected Class<?> getModelClass() {
449                    return SCProductScreenshot.class;
450            }
451    
452            protected String getModelClassName() {
453                    return SCProductScreenshot.class.getName();
454            }
455    
456            /**
457             * Performs a SQL query.
458             *
459             * @param sql the sql query
460             */
461            protected void runSQL(String sql) {
462                    try {
463                            DataSource dataSource = scProductScreenshotPersistence.getDataSource();
464    
465                            DB db = DBFactoryUtil.getDB();
466    
467                            sql = db.buildSQL(sql);
468                            sql = PortalUtil.transformSQL(sql);
469    
470                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
471                                            sql, new int[0]);
472    
473                            sqlUpdate.update();
474                    }
475                    catch (Exception e) {
476                            throw new SystemException(e);
477                    }
478            }
479    
480            @BeanReference(type = SCProductScreenshotLocalService.class)
481            protected SCProductScreenshotLocalService scProductScreenshotLocalService;
482            @BeanReference(type = SCProductScreenshotPersistence.class)
483            protected SCProductScreenshotPersistence scProductScreenshotPersistence;
484            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
485            protected com.liferay.counter.service.CounterLocalService counterLocalService;
486            @BeanReference(type = com.liferay.portal.service.ImageLocalService.class)
487            protected com.liferay.portal.service.ImageLocalService imageLocalService;
488            @BeanReference(type = com.liferay.portal.service.ImageService.class)
489            protected com.liferay.portal.service.ImageService imageService;
490            @BeanReference(type = ImagePersistence.class)
491            protected ImagePersistence imagePersistence;
492            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
493            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
494            private String _beanIdentifier;
495    }