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.shopping.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.util.PortalUtil;
039    
040    import com.liferay.portlet.shopping.model.ShoppingItemPrice;
041    import com.liferay.portlet.shopping.service.ShoppingItemPriceLocalService;
042    import com.liferay.portlet.shopping.service.persistence.ShoppingItemFinder;
043    import com.liferay.portlet.shopping.service.persistence.ShoppingItemPersistence;
044    import com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistence;
045    
046    import java.io.Serializable;
047    
048    import java.util.List;
049    
050    import javax.sql.DataSource;
051    
052    /**
053     * Provides the base implementation for the shopping item price local service.
054     *
055     * <p>
056     * 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.shopping.service.impl.ShoppingItemPriceLocalServiceImpl}.
057     * </p>
058     *
059     * @author Brian Wing Shun Chan
060     * @see com.liferay.portlet.shopping.service.impl.ShoppingItemPriceLocalServiceImpl
061     * @see com.liferay.portlet.shopping.service.ShoppingItemPriceLocalServiceUtil
062     * @generated
063     */
064    @ProviderType
065    public abstract class ShoppingItemPriceLocalServiceBaseImpl
066            extends BaseLocalServiceImpl implements ShoppingItemPriceLocalService,
067                    IdentifiableBean {
068            /*
069             * NOTE FOR DEVELOPERS:
070             *
071             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.shopping.service.ShoppingItemPriceLocalServiceUtil} to access the shopping item price local service.
072             */
073    
074            /**
075             * Adds the shopping item price to the database. Also notifies the appropriate model listeners.
076             *
077             * @param shoppingItemPrice the shopping item price
078             * @return the shopping item price that was added
079             */
080            @Indexable(type = IndexableType.REINDEX)
081            @Override
082            public ShoppingItemPrice addShoppingItemPrice(
083                    ShoppingItemPrice shoppingItemPrice) {
084                    shoppingItemPrice.setNew(true);
085    
086                    return shoppingItemPricePersistence.update(shoppingItemPrice);
087            }
088    
089            /**
090             * Creates a new shopping item price with the primary key. Does not add the shopping item price to the database.
091             *
092             * @param itemPriceId the primary key for the new shopping item price
093             * @return the new shopping item price
094             */
095            @Override
096            public ShoppingItemPrice createShoppingItemPrice(long itemPriceId) {
097                    return shoppingItemPricePersistence.create(itemPriceId);
098            }
099    
100            /**
101             * Deletes the shopping item price with the primary key from the database. Also notifies the appropriate model listeners.
102             *
103             * @param itemPriceId the primary key of the shopping item price
104             * @return the shopping item price that was removed
105             * @throws PortalException if a shopping item price with the primary key could not be found
106             */
107            @Indexable(type = IndexableType.DELETE)
108            @Override
109            public ShoppingItemPrice deleteShoppingItemPrice(long itemPriceId)
110                    throws PortalException {
111                    return shoppingItemPricePersistence.remove(itemPriceId);
112            }
113    
114            /**
115             * Deletes the shopping item price from the database. Also notifies the appropriate model listeners.
116             *
117             * @param shoppingItemPrice the shopping item price
118             * @return the shopping item price that was removed
119             */
120            @Indexable(type = IndexableType.DELETE)
121            @Override
122            public ShoppingItemPrice deleteShoppingItemPrice(
123                    ShoppingItemPrice shoppingItemPrice) {
124                    return shoppingItemPricePersistence.remove(shoppingItemPrice);
125            }
126    
127            @Override
128            public DynamicQuery dynamicQuery() {
129                    Class<?> clazz = getClass();
130    
131                    return DynamicQueryFactoryUtil.forClass(ShoppingItemPrice.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 shoppingItemPricePersistence.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.shopping.model.impl.ShoppingItemPriceModelImpl}. 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 shoppingItemPricePersistence.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.shopping.model.impl.ShoppingItemPriceModelImpl}. 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 shoppingItemPricePersistence.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 shoppingItemPricePersistence.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 shoppingItemPricePersistence.countWithDynamicQuery(dynamicQuery,
207                            projection);
208            }
209    
210            @Override
211            public ShoppingItemPrice fetchShoppingItemPrice(long itemPriceId) {
212                    return shoppingItemPricePersistence.fetchByPrimaryKey(itemPriceId);
213            }
214    
215            /**
216             * Returns the shopping item price with the primary key.
217             *
218             * @param itemPriceId the primary key of the shopping item price
219             * @return the shopping item price
220             * @throws PortalException if a shopping item price with the primary key could not be found
221             */
222            @Override
223            public ShoppingItemPrice getShoppingItemPrice(long itemPriceId)
224                    throws PortalException {
225                    return shoppingItemPricePersistence.findByPrimaryKey(itemPriceId);
226            }
227    
228            @Override
229            public ActionableDynamicQuery getActionableDynamicQuery() {
230                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
231    
232                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.shopping.service.ShoppingItemPriceLocalServiceUtil.getService());
233                    actionableDynamicQuery.setClass(ShoppingItemPrice.class);
234                    actionableDynamicQuery.setClassLoader(getClassLoader());
235    
236                    actionableDynamicQuery.setPrimaryKeyPropertyName("itemPriceId");
237    
238                    return actionableDynamicQuery;
239            }
240    
241            protected void initActionableDynamicQuery(
242                    ActionableDynamicQuery actionableDynamicQuery) {
243                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.shopping.service.ShoppingItemPriceLocalServiceUtil.getService());
244                    actionableDynamicQuery.setClass(ShoppingItemPrice.class);
245                    actionableDynamicQuery.setClassLoader(getClassLoader());
246    
247                    actionableDynamicQuery.setPrimaryKeyPropertyName("itemPriceId");
248            }
249    
250            /**
251             * @throws PortalException
252             */
253            @Override
254            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
255                    throws PortalException {
256                    return shoppingItemPriceLocalService.deleteShoppingItemPrice((ShoppingItemPrice)persistedModel);
257            }
258    
259            @Override
260            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
261                    throws PortalException {
262                    return shoppingItemPricePersistence.findByPrimaryKey(primaryKeyObj);
263            }
264    
265            /**
266             * Returns a range of all the shopping item prices.
267             *
268             * <p>
269             * 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.shopping.model.impl.ShoppingItemPriceModelImpl}. 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.
270             * </p>
271             *
272             * @param start the lower bound of the range of shopping item prices
273             * @param end the upper bound of the range of shopping item prices (not inclusive)
274             * @return the range of shopping item prices
275             */
276            @Override
277            public List<ShoppingItemPrice> getShoppingItemPrices(int start, int end) {
278                    return shoppingItemPricePersistence.findAll(start, end);
279            }
280    
281            /**
282             * Returns the number of shopping item prices.
283             *
284             * @return the number of shopping item prices
285             */
286            @Override
287            public int getShoppingItemPricesCount() {
288                    return shoppingItemPricePersistence.countAll();
289            }
290    
291            /**
292             * Updates the shopping item price in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
293             *
294             * @param shoppingItemPrice the shopping item price
295             * @return the shopping item price that was updated
296             */
297            @Indexable(type = IndexableType.REINDEX)
298            @Override
299            public ShoppingItemPrice updateShoppingItemPrice(
300                    ShoppingItemPrice shoppingItemPrice) {
301                    return shoppingItemPricePersistence.update(shoppingItemPrice);
302            }
303    
304            /**
305             * Returns the shopping item price local service.
306             *
307             * @return the shopping item price local service
308             */
309            public ShoppingItemPriceLocalService getShoppingItemPriceLocalService() {
310                    return shoppingItemPriceLocalService;
311            }
312    
313            /**
314             * Sets the shopping item price local service.
315             *
316             * @param shoppingItemPriceLocalService the shopping item price local service
317             */
318            public void setShoppingItemPriceLocalService(
319                    ShoppingItemPriceLocalService shoppingItemPriceLocalService) {
320                    this.shoppingItemPriceLocalService = shoppingItemPriceLocalService;
321            }
322    
323            /**
324             * Returns the shopping item price persistence.
325             *
326             * @return the shopping item price persistence
327             */
328            public ShoppingItemPricePersistence getShoppingItemPricePersistence() {
329                    return shoppingItemPricePersistence;
330            }
331    
332            /**
333             * Sets the shopping item price persistence.
334             *
335             * @param shoppingItemPricePersistence the shopping item price persistence
336             */
337            public void setShoppingItemPricePersistence(
338                    ShoppingItemPricePersistence shoppingItemPricePersistence) {
339                    this.shoppingItemPricePersistence = shoppingItemPricePersistence;
340            }
341    
342            /**
343             * Returns the counter local service.
344             *
345             * @return the counter local service
346             */
347            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
348                    return counterLocalService;
349            }
350    
351            /**
352             * Sets the counter local service.
353             *
354             * @param counterLocalService the counter local service
355             */
356            public void setCounterLocalService(
357                    com.liferay.counter.service.CounterLocalService counterLocalService) {
358                    this.counterLocalService = counterLocalService;
359            }
360    
361            /**
362             * Returns the shopping item local service.
363             *
364             * @return the shopping item local service
365             */
366            public com.liferay.portlet.shopping.service.ShoppingItemLocalService getShoppingItemLocalService() {
367                    return shoppingItemLocalService;
368            }
369    
370            /**
371             * Sets the shopping item local service.
372             *
373             * @param shoppingItemLocalService the shopping item local service
374             */
375            public void setShoppingItemLocalService(
376                    com.liferay.portlet.shopping.service.ShoppingItemLocalService shoppingItemLocalService) {
377                    this.shoppingItemLocalService = shoppingItemLocalService;
378            }
379    
380            /**
381             * Returns the shopping item remote service.
382             *
383             * @return the shopping item remote service
384             */
385            public com.liferay.portlet.shopping.service.ShoppingItemService getShoppingItemService() {
386                    return shoppingItemService;
387            }
388    
389            /**
390             * Sets the shopping item remote service.
391             *
392             * @param shoppingItemService the shopping item remote service
393             */
394            public void setShoppingItemService(
395                    com.liferay.portlet.shopping.service.ShoppingItemService shoppingItemService) {
396                    this.shoppingItemService = shoppingItemService;
397            }
398    
399            /**
400             * Returns the shopping item persistence.
401             *
402             * @return the shopping item persistence
403             */
404            public ShoppingItemPersistence getShoppingItemPersistence() {
405                    return shoppingItemPersistence;
406            }
407    
408            /**
409             * Sets the shopping item persistence.
410             *
411             * @param shoppingItemPersistence the shopping item persistence
412             */
413            public void setShoppingItemPersistence(
414                    ShoppingItemPersistence shoppingItemPersistence) {
415                    this.shoppingItemPersistence = shoppingItemPersistence;
416            }
417    
418            /**
419             * Returns the shopping item finder.
420             *
421             * @return the shopping item finder
422             */
423            public ShoppingItemFinder getShoppingItemFinder() {
424                    return shoppingItemFinder;
425            }
426    
427            /**
428             * Sets the shopping item finder.
429             *
430             * @param shoppingItemFinder the shopping item finder
431             */
432            public void setShoppingItemFinder(ShoppingItemFinder shoppingItemFinder) {
433                    this.shoppingItemFinder = shoppingItemFinder;
434            }
435    
436            public void afterPropertiesSet() {
437                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.shopping.model.ShoppingItemPrice",
438                            shoppingItemPriceLocalService);
439            }
440    
441            public void destroy() {
442                    persistedModelLocalServiceRegistry.unregister(
443                            "com.liferay.portlet.shopping.model.ShoppingItemPrice");
444            }
445    
446            /**
447             * Returns the Spring bean ID for this bean.
448             *
449             * @return the Spring bean ID for this bean
450             */
451            @Override
452            public String getBeanIdentifier() {
453                    return _beanIdentifier;
454            }
455    
456            /**
457             * Sets the Spring bean ID for this bean.
458             *
459             * @param beanIdentifier the Spring bean ID for this bean
460             */
461            @Override
462            public void setBeanIdentifier(String beanIdentifier) {
463                    _beanIdentifier = beanIdentifier;
464            }
465    
466            protected Class<?> getModelClass() {
467                    return ShoppingItemPrice.class;
468            }
469    
470            protected String getModelClassName() {
471                    return ShoppingItemPrice.class.getName();
472            }
473    
474            /**
475             * Performs a SQL query.
476             *
477             * @param sql the sql query
478             */
479            protected void runSQL(String sql) {
480                    try {
481                            DataSource dataSource = shoppingItemPricePersistence.getDataSource();
482    
483                            DB db = DBFactoryUtil.getDB();
484    
485                            sql = db.buildSQL(sql);
486                            sql = PortalUtil.transformSQL(sql);
487    
488                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
489                                            sql, new int[0]);
490    
491                            sqlUpdate.update();
492                    }
493                    catch (Exception e) {
494                            throw new SystemException(e);
495                    }
496            }
497    
498            @BeanReference(type = ShoppingItemPriceLocalService.class)
499            protected ShoppingItemPriceLocalService shoppingItemPriceLocalService;
500            @BeanReference(type = ShoppingItemPricePersistence.class)
501            protected ShoppingItemPricePersistence shoppingItemPricePersistence;
502            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
503            protected com.liferay.counter.service.CounterLocalService counterLocalService;
504            @BeanReference(type = com.liferay.portlet.shopping.service.ShoppingItemLocalService.class)
505            protected com.liferay.portlet.shopping.service.ShoppingItemLocalService shoppingItemLocalService;
506            @BeanReference(type = com.liferay.portlet.shopping.service.ShoppingItemService.class)
507            protected com.liferay.portlet.shopping.service.ShoppingItemService shoppingItemService;
508            @BeanReference(type = ShoppingItemPersistence.class)
509            protected ShoppingItemPersistence shoppingItemPersistence;
510            @BeanReference(type = ShoppingItemFinder.class)
511            protected ShoppingItemFinder shoppingItemFinder;
512            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
513            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
514            private String _beanIdentifier;
515    }