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