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