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.PersistedModel;
037    import com.liferay.portal.model.WorkflowDefinitionLink;
038    import com.liferay.portal.service.BaseLocalServiceImpl;
039    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040    import com.liferay.portal.service.WorkflowDefinitionLinkLocalService;
041    import com.liferay.portal.service.persistence.ClassNamePersistence;
042    import com.liferay.portal.service.persistence.SubscriptionPersistence;
043    import com.liferay.portal.service.persistence.UserFinder;
044    import com.liferay.portal.service.persistence.UserPersistence;
045    import com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence;
046    import com.liferay.portal.util.PortalUtil;
047    
048    import java.io.Serializable;
049    
050    import java.util.List;
051    
052    import javax.sql.DataSource;
053    
054    /**
055     * Provides the base implementation for the workflow definition link local service.
056     *
057     * <p>
058     * 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.WorkflowDefinitionLinkLocalServiceImpl}.
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see com.liferay.portal.service.impl.WorkflowDefinitionLinkLocalServiceImpl
063     * @see com.liferay.portal.service.WorkflowDefinitionLinkLocalServiceUtil
064     * @generated
065     */
066    @ProviderType
067    public abstract class WorkflowDefinitionLinkLocalServiceBaseImpl
068            extends BaseLocalServiceImpl implements WorkflowDefinitionLinkLocalService,
069                    IdentifiableOSGiService {
070            /*
071             * NOTE FOR DEVELOPERS:
072             *
073             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.WorkflowDefinitionLinkLocalServiceUtil} to access the workflow definition link local service.
074             */
075    
076            /**
077             * Adds the workflow definition link to the database. Also notifies the appropriate model listeners.
078             *
079             * @param workflowDefinitionLink the workflow definition link
080             * @return the workflow definition link that was added
081             */
082            @Indexable(type = IndexableType.REINDEX)
083            @Override
084            public WorkflowDefinitionLink addWorkflowDefinitionLink(
085                    WorkflowDefinitionLink workflowDefinitionLink) {
086                    workflowDefinitionLink.setNew(true);
087    
088                    return workflowDefinitionLinkPersistence.update(workflowDefinitionLink);
089            }
090    
091            /**
092             * Creates a new workflow definition link with the primary key. Does not add the workflow definition link to the database.
093             *
094             * @param workflowDefinitionLinkId the primary key for the new workflow definition link
095             * @return the new workflow definition link
096             */
097            @Override
098            public WorkflowDefinitionLink createWorkflowDefinitionLink(
099                    long workflowDefinitionLinkId) {
100                    return workflowDefinitionLinkPersistence.create(workflowDefinitionLinkId);
101            }
102    
103            /**
104             * Deletes the workflow definition link with the primary key from the database. Also notifies the appropriate model listeners.
105             *
106             * @param workflowDefinitionLinkId the primary key of the workflow definition link
107             * @return the workflow definition link that was removed
108             * @throws PortalException if a workflow definition link with the primary key could not be found
109             */
110            @Indexable(type = IndexableType.DELETE)
111            @Override
112            public WorkflowDefinitionLink deleteWorkflowDefinitionLink(
113                    long workflowDefinitionLinkId) throws PortalException {
114                    return workflowDefinitionLinkPersistence.remove(workflowDefinitionLinkId);
115            }
116    
117            /**
118             * Deletes the workflow definition link from the database. Also notifies the appropriate model listeners.
119             *
120             * @param workflowDefinitionLink the workflow definition link
121             * @return the workflow definition link that was removed
122             */
123            @Indexable(type = IndexableType.DELETE)
124            @Override
125            public WorkflowDefinitionLink deleteWorkflowDefinitionLink(
126                    WorkflowDefinitionLink workflowDefinitionLink) {
127                    return workflowDefinitionLinkPersistence.remove(workflowDefinitionLink);
128            }
129    
130            @Override
131            public DynamicQuery dynamicQuery() {
132                    Class<?> clazz = getClass();
133    
134                    return DynamicQueryFactoryUtil.forClass(WorkflowDefinitionLink.class,
135                            clazz.getClassLoader());
136            }
137    
138            /**
139             * Performs a dynamic query on the database and returns the matching rows.
140             *
141             * @param dynamicQuery the dynamic query
142             * @return the matching rows
143             */
144            @Override
145            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
146                    return workflowDefinitionLinkPersistence.findWithDynamicQuery(dynamicQuery);
147            }
148    
149            /**
150             * Performs a dynamic query on the database and returns a range of the matching rows.
151             *
152             * <p>
153             * 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.WorkflowDefinitionLinkModelImpl}. 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.
154             * </p>
155             *
156             * @param dynamicQuery the dynamic query
157             * @param start the lower bound of the range of model instances
158             * @param end the upper bound of the range of model instances (not inclusive)
159             * @return the range of matching rows
160             */
161            @Override
162            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
163                    int end) {
164                    return workflowDefinitionLinkPersistence.findWithDynamicQuery(dynamicQuery,
165                            start, end);
166            }
167    
168            /**
169             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
170             *
171             * <p>
172             * 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.WorkflowDefinitionLinkModelImpl}. 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.
173             * </p>
174             *
175             * @param dynamicQuery the dynamic query
176             * @param start the lower bound of the range of model instances
177             * @param end the upper bound of the range of model instances (not inclusive)
178             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
179             * @return the ordered range of matching rows
180             */
181            @Override
182            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
183                    int end, OrderByComparator<T> orderByComparator) {
184                    return workflowDefinitionLinkPersistence.findWithDynamicQuery(dynamicQuery,
185                            start, end, orderByComparator);
186            }
187    
188            /**
189             * Returns the number of rows matching the dynamic query.
190             *
191             * @param dynamicQuery the dynamic query
192             * @return the number of rows matching the dynamic query
193             */
194            @Override
195            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
196                    return workflowDefinitionLinkPersistence.countWithDynamicQuery(dynamicQuery);
197            }
198    
199            /**
200             * Returns the number of rows matching the dynamic query.
201             *
202             * @param dynamicQuery the dynamic query
203             * @param projection the projection to apply to the query
204             * @return the number of rows matching the dynamic query
205             */
206            @Override
207            public long dynamicQueryCount(DynamicQuery dynamicQuery,
208                    Projection projection) {
209                    return workflowDefinitionLinkPersistence.countWithDynamicQuery(dynamicQuery,
210                            projection);
211            }
212    
213            @Override
214            public WorkflowDefinitionLink fetchWorkflowDefinitionLink(
215                    long workflowDefinitionLinkId) {
216                    return workflowDefinitionLinkPersistence.fetchByPrimaryKey(workflowDefinitionLinkId);
217            }
218    
219            /**
220             * Returns the workflow definition link with the primary key.
221             *
222             * @param workflowDefinitionLinkId the primary key of the workflow definition link
223             * @return the workflow definition link
224             * @throws PortalException if a workflow definition link with the primary key could not be found
225             */
226            @Override
227            public WorkflowDefinitionLink getWorkflowDefinitionLink(
228                    long workflowDefinitionLinkId) throws PortalException {
229                    return workflowDefinitionLinkPersistence.findByPrimaryKey(workflowDefinitionLinkId);
230            }
231    
232            @Override
233            public ActionableDynamicQuery getActionableDynamicQuery() {
234                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
235    
236                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WorkflowDefinitionLinkLocalServiceUtil.getService());
237                    actionableDynamicQuery.setClassLoader(getClassLoader());
238                    actionableDynamicQuery.setModelClass(WorkflowDefinitionLink.class);
239    
240                    actionableDynamicQuery.setPrimaryKeyPropertyName(
241                            "workflowDefinitionLinkId");
242    
243                    return actionableDynamicQuery;
244            }
245    
246            @Override
247            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
248                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
249    
250                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WorkflowDefinitionLinkLocalServiceUtil.getService());
251                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
252                    indexableActionableDynamicQuery.setModelClass(WorkflowDefinitionLink.class);
253    
254                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
255                            "workflowDefinitionLinkId");
256    
257                    return indexableActionableDynamicQuery;
258            }
259    
260            protected void initActionableDynamicQuery(
261                    ActionableDynamicQuery actionableDynamicQuery) {
262                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WorkflowDefinitionLinkLocalServiceUtil.getService());
263                    actionableDynamicQuery.setClassLoader(getClassLoader());
264                    actionableDynamicQuery.setModelClass(WorkflowDefinitionLink.class);
265    
266                    actionableDynamicQuery.setPrimaryKeyPropertyName(
267                            "workflowDefinitionLinkId");
268            }
269    
270            /**
271             * @throws PortalException
272             */
273            @Override
274            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
275                    throws PortalException {
276                    return workflowDefinitionLinkLocalService.deleteWorkflowDefinitionLink((WorkflowDefinitionLink)persistedModel);
277            }
278    
279            @Override
280            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
281                    throws PortalException {
282                    return workflowDefinitionLinkPersistence.findByPrimaryKey(primaryKeyObj);
283            }
284    
285            /**
286             * Returns a range of all the workflow definition links.
287             *
288             * <p>
289             * 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.WorkflowDefinitionLinkModelImpl}. 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.
290             * </p>
291             *
292             * @param start the lower bound of the range of workflow definition links
293             * @param end the upper bound of the range of workflow definition links (not inclusive)
294             * @return the range of workflow definition links
295             */
296            @Override
297            public List<WorkflowDefinitionLink> getWorkflowDefinitionLinks(int start,
298                    int end) {
299                    return workflowDefinitionLinkPersistence.findAll(start, end);
300            }
301    
302            /**
303             * Returns the number of workflow definition links.
304             *
305             * @return the number of workflow definition links
306             */
307            @Override
308            public int getWorkflowDefinitionLinksCount() {
309                    return workflowDefinitionLinkPersistence.countAll();
310            }
311    
312            /**
313             * Updates the workflow definition link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
314             *
315             * @param workflowDefinitionLink the workflow definition link
316             * @return the workflow definition link that was updated
317             */
318            @Indexable(type = IndexableType.REINDEX)
319            @Override
320            public WorkflowDefinitionLink updateWorkflowDefinitionLink(
321                    WorkflowDefinitionLink workflowDefinitionLink) {
322                    return workflowDefinitionLinkPersistence.update(workflowDefinitionLink);
323            }
324    
325            /**
326             * Returns the workflow definition link local service.
327             *
328             * @return the workflow definition link local service
329             */
330            public WorkflowDefinitionLinkLocalService getWorkflowDefinitionLinkLocalService() {
331                    return workflowDefinitionLinkLocalService;
332            }
333    
334            /**
335             * Sets the workflow definition link local service.
336             *
337             * @param workflowDefinitionLinkLocalService the workflow definition link local service
338             */
339            public void setWorkflowDefinitionLinkLocalService(
340                    WorkflowDefinitionLinkLocalService workflowDefinitionLinkLocalService) {
341                    this.workflowDefinitionLinkLocalService = workflowDefinitionLinkLocalService;
342            }
343    
344            /**
345             * Returns the workflow definition link persistence.
346             *
347             * @return the workflow definition link persistence
348             */
349            public WorkflowDefinitionLinkPersistence getWorkflowDefinitionLinkPersistence() {
350                    return workflowDefinitionLinkPersistence;
351            }
352    
353            /**
354             * Sets the workflow definition link persistence.
355             *
356             * @param workflowDefinitionLinkPersistence the workflow definition link persistence
357             */
358            public void setWorkflowDefinitionLinkPersistence(
359                    WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence) {
360                    this.workflowDefinitionLinkPersistence = workflowDefinitionLinkPersistence;
361            }
362    
363            /**
364             * Returns the counter local service.
365             *
366             * @return the counter local service
367             */
368            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
369                    return counterLocalService;
370            }
371    
372            /**
373             * Sets the counter local service.
374             *
375             * @param counterLocalService the counter local service
376             */
377            public void setCounterLocalService(
378                    com.liferay.counter.service.CounterLocalService counterLocalService) {
379                    this.counterLocalService = counterLocalService;
380            }
381    
382            /**
383             * Returns the class name local service.
384             *
385             * @return the class name local service
386             */
387            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
388                    return classNameLocalService;
389            }
390    
391            /**
392             * Sets the class name local service.
393             *
394             * @param classNameLocalService the class name local service
395             */
396            public void setClassNameLocalService(
397                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
398                    this.classNameLocalService = classNameLocalService;
399            }
400    
401            /**
402             * Returns the class name persistence.
403             *
404             * @return the class name persistence
405             */
406            public ClassNamePersistence getClassNamePersistence() {
407                    return classNamePersistence;
408            }
409    
410            /**
411             * Sets the class name persistence.
412             *
413             * @param classNamePersistence the class name persistence
414             */
415            public void setClassNamePersistence(
416                    ClassNamePersistence classNamePersistence) {
417                    this.classNamePersistence = classNamePersistence;
418            }
419    
420            /**
421             * Returns the subscription local service.
422             *
423             * @return the subscription local service
424             */
425            public com.liferay.portal.service.SubscriptionLocalService getSubscriptionLocalService() {
426                    return subscriptionLocalService;
427            }
428    
429            /**
430             * Sets the subscription local service.
431             *
432             * @param subscriptionLocalService the subscription local service
433             */
434            public void setSubscriptionLocalService(
435                    com.liferay.portal.service.SubscriptionLocalService subscriptionLocalService) {
436                    this.subscriptionLocalService = subscriptionLocalService;
437            }
438    
439            /**
440             * Returns the subscription persistence.
441             *
442             * @return the subscription persistence
443             */
444            public SubscriptionPersistence getSubscriptionPersistence() {
445                    return subscriptionPersistence;
446            }
447    
448            /**
449             * Sets the subscription persistence.
450             *
451             * @param subscriptionPersistence the subscription persistence
452             */
453            public void setSubscriptionPersistence(
454                    SubscriptionPersistence subscriptionPersistence) {
455                    this.subscriptionPersistence = subscriptionPersistence;
456            }
457    
458            /**
459             * Returns the user local service.
460             *
461             * @return the user local service
462             */
463            public com.liferay.portal.service.UserLocalService getUserLocalService() {
464                    return userLocalService;
465            }
466    
467            /**
468             * Sets the user local service.
469             *
470             * @param userLocalService the user local service
471             */
472            public void setUserLocalService(
473                    com.liferay.portal.service.UserLocalService userLocalService) {
474                    this.userLocalService = userLocalService;
475            }
476    
477            /**
478             * Returns the user persistence.
479             *
480             * @return the user persistence
481             */
482            public UserPersistence getUserPersistence() {
483                    return userPersistence;
484            }
485    
486            /**
487             * Sets the user persistence.
488             *
489             * @param userPersistence the user persistence
490             */
491            public void setUserPersistence(UserPersistence userPersistence) {
492                    this.userPersistence = userPersistence;
493            }
494    
495            /**
496             * Returns the user finder.
497             *
498             * @return the user finder
499             */
500            public UserFinder getUserFinder() {
501                    return userFinder;
502            }
503    
504            /**
505             * Sets the user finder.
506             *
507             * @param userFinder the user finder
508             */
509            public void setUserFinder(UserFinder userFinder) {
510                    this.userFinder = userFinder;
511            }
512    
513            public void afterPropertiesSet() {
514                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.WorkflowDefinitionLink",
515                            workflowDefinitionLinkLocalService);
516            }
517    
518            public void destroy() {
519                    persistedModelLocalServiceRegistry.unregister(
520                            "com.liferay.portal.model.WorkflowDefinitionLink");
521            }
522    
523            /**
524             * Returns the OSGi service identifier.
525             *
526             * @return the OSGi service identifier
527             */
528            @Override
529            public String getOSGiServiceIdentifier() {
530                    return WorkflowDefinitionLinkLocalService.class.getName();
531            }
532    
533            protected Class<?> getModelClass() {
534                    return WorkflowDefinitionLink.class;
535            }
536    
537            protected String getModelClassName() {
538                    return WorkflowDefinitionLink.class.getName();
539            }
540    
541            /**
542             * Performs a SQL query.
543             *
544             * @param sql the sql query
545             */
546            protected void runSQL(String sql) {
547                    try {
548                            DataSource dataSource = workflowDefinitionLinkPersistence.getDataSource();
549    
550                            DB db = DBManagerUtil.getDB();
551    
552                            sql = db.buildSQL(sql);
553                            sql = PortalUtil.transformSQL(sql);
554    
555                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
556                                            sql, new int[0]);
557    
558                            sqlUpdate.update();
559                    }
560                    catch (Exception e) {
561                            throw new SystemException(e);
562                    }
563            }
564    
565            @BeanReference(type = com.liferay.portal.service.WorkflowDefinitionLinkLocalService.class)
566            protected WorkflowDefinitionLinkLocalService workflowDefinitionLinkLocalService;
567            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
568            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
569            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
570            protected com.liferay.counter.service.CounterLocalService counterLocalService;
571            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
572            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
573            @BeanReference(type = ClassNamePersistence.class)
574            protected ClassNamePersistence classNamePersistence;
575            @BeanReference(type = com.liferay.portal.service.SubscriptionLocalService.class)
576            protected com.liferay.portal.service.SubscriptionLocalService subscriptionLocalService;
577            @BeanReference(type = SubscriptionPersistence.class)
578            protected SubscriptionPersistence subscriptionPersistence;
579            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
580            protected com.liferay.portal.service.UserLocalService userLocalService;
581            @BeanReference(type = UserPersistence.class)
582            protected UserPersistence userPersistence;
583            @BeanReference(type = UserFinder.class)
584            protected UserFinder userFinder;
585            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
586            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
587    }