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