001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.social.service;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.exception.SystemException;
021    import com.liferay.portal.kernel.search.IndexableType;
022    import com.liferay.portal.kernel.transaction.Isolation;
023    import com.liferay.portal.kernel.transaction.Propagation;
024    import com.liferay.portal.kernel.transaction.Transactional;
025    import com.liferay.portal.service.BaseLocalService;
026    import com.liferay.portal.service.PersistedModelLocalService;
027    
028    /**
029     * Provides the local service interface for SocialActivityCounter. Methods of this
030     * service will not have security checks based on the propagated JAAS
031     * credentials because this service can only be accessed from within the same
032     * VM.
033     *
034     * @author Brian Wing Shun Chan
035     * @see SocialActivityCounterLocalServiceUtil
036     * @see com.liferay.portlet.social.service.base.SocialActivityCounterLocalServiceBaseImpl
037     * @see com.liferay.portlet.social.service.impl.SocialActivityCounterLocalServiceImpl
038     * @generated
039     */
040    @ProviderType
041    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
042            PortalException.class, SystemException.class})
043    public interface SocialActivityCounterLocalService extends BaseLocalService,
044            PersistedModelLocalService {
045            /*
046             * NOTE FOR DEVELOPERS:
047             *
048             * Never modify or reference this interface directly. Always use {@link SocialActivityCounterLocalServiceUtil} to access the social activity counter local service. Add custom service methods to {@link com.liferay.portlet.social.service.impl.SocialActivityCounterLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
049             */
050    
051            /**
052            * Adds an activity counter specifying a previous activity and period
053            * length.
054            *
055            * <p>
056            * This method uses the lock service to guard against multiple threads
057            * trying to insert the same counter because this service is called
058            * asynchronously from the social activity service.
059            * </p>
060            *
061            * @param groupId the primary key of the group
062            * @param classNameId the primary key of the entity's class this counter
063            belongs to
064            * @param classPK the primary key of the entity this counter belongs to
065            * @param name the counter name
066            * @param ownerType the counter's owner type. Acceptable values are
067            <code>TYPE_ACTOR</code>, <code>TYPE_ASSET</code> and
068            <code>TYPE_CREATOR</code> defined in {@link
069            SocialActivityCounterConstants}.
070            * @param totalValue the counter's total value (optionally <code>0</code>)
071            * @param previousActivityCounterId the primary key of the activity counter
072            for the previous time period (optionally <code>0</code>, if this
073            is the first)
074            * @param periodLength the period length in days,
075            <code>PERIOD_LENGTH_INFINITE</code> for never ending counters or
076            <code>PERIOD_LENGTH_SYSTEM</code> for the period length defined
077            in <code>portal-ext.properties</code>. For more information see
078            {@link SocialActivityCounterConstants}.
079            * @return the added activity counter
080            */
081            @Transactional(propagation = Propagation.REQUIRES_NEW)
082            public com.liferay.portlet.social.model.SocialActivityCounter addActivityCounter(
083                    long groupId, long classNameId, long classPK, java.lang.String name,
084                    int ownerType, int totalValue, long previousActivityCounterId,
085                    int periodLength) throws PortalException;
086    
087            /**
088            * Adds or increments activity counters related to an activity.
089            *
090            * </p>
091            * This method is called asynchronously from the social activity service
092            * when the user performs an activity defined in
093            * </code>liferay-social.xml</code>.
094            * </p>
095            *
096            * <p>
097            * This method first calls the activity processor class, if there is one
098            * defined for the activity, checks for limits and increments all the
099            * counters that belong to the activity. Afterwards, it processes the
100            * activity with respect to achievement classes, if any. Lastly it
101            * increments the built-in <code>user.activities</code> and
102            * <code>asset.activities</code> counters.
103            * </p>
104            *
105            * @param activity the social activity
106            */
107            public void addActivityCounters(
108                    com.liferay.portlet.social.model.SocialActivity activity)
109                    throws PortalException;
110    
111            /**
112            * Adds the social activity counter to the database. Also notifies the appropriate model listeners.
113            *
114            * @param socialActivityCounter the social activity counter
115            * @return the social activity counter that was added
116            */
117            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX)
118            public com.liferay.portlet.social.model.SocialActivityCounter addSocialActivityCounter(
119                    com.liferay.portlet.social.model.SocialActivityCounter socialActivityCounter);
120    
121            /**
122            * Creates a new social activity counter with the primary key. Does not add the social activity counter to the database.
123            *
124            * @param activityCounterId the primary key for the new social activity counter
125            * @return the new social activity counter
126            */
127            public com.liferay.portlet.social.model.SocialActivityCounter createSocialActivityCounter(
128                    long activityCounterId);
129    
130            /**
131            * Deletes all activity counters, limits, and settings related to the asset.
132            *
133            * <p>
134            * This method subtracts the asset's popularity from the owner's
135            * contribution points. It also creates a new contribution period if the
136            * latest one does not belong to the current period.
137            * </p>
138            *
139            * @param assetEntry the asset entry
140            */
141            public void deleteActivityCounters(
142                    com.liferay.portlet.asset.model.AssetEntry assetEntry)
143                    throws PortalException;
144    
145            /**
146            * Deletes all activity counters for the entity identified by the class name
147            * and class primary key.
148            *
149            * @param className the entity's class name
150            * @param classPK the primary key of the entity
151            */
152            public void deleteActivityCounters(java.lang.String className, long classPK)
153                    throws PortalException;
154    
155            /**
156            * Deletes all activity counters, limits, and settings related to the entity
157            * identified by the class name ID and class primary key.
158            *
159            * @param classNameId the primary key of the entity's class
160            * @param classPK the primary key of the entity
161            */
162            public void deleteActivityCounters(long classNameId, long classPK)
163                    throws PortalException;
164    
165            /**
166            * @throws PortalException
167            */
168            @Override
169            public com.liferay.portal.model.PersistedModel deletePersistedModel(
170                    com.liferay.portal.model.PersistedModel persistedModel)
171                    throws PortalException;
172    
173            /**
174            * Deletes the social activity counter with the primary key from the database. Also notifies the appropriate model listeners.
175            *
176            * @param activityCounterId the primary key of the social activity counter
177            * @return the social activity counter that was removed
178            * @throws PortalException if a social activity counter with the primary key could not be found
179            */
180            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE)
181            public com.liferay.portlet.social.model.SocialActivityCounter deleteSocialActivityCounter(
182                    long activityCounterId) throws PortalException;
183    
184            /**
185            * Deletes the social activity counter from the database. Also notifies the appropriate model listeners.
186            *
187            * @param socialActivityCounter the social activity counter
188            * @return the social activity counter that was removed
189            */
190            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE)
191            public com.liferay.portlet.social.model.SocialActivityCounter deleteSocialActivityCounter(
192                    com.liferay.portlet.social.model.SocialActivityCounter socialActivityCounter);
193    
194            /**
195            * Disables all the counters of an asset identified by the class name and
196            * class primary key.
197            *
198            * <p>
199            * This method is used by the recycle bin to disable all counters of assets
200            * put into the recycle bin. It adjusts the owner's contribution score.
201            * </p>
202            *
203            * @param className the asset's class name
204            * @param classPK the primary key of the asset
205            */
206            public void disableActivityCounters(java.lang.String className, long classPK)
207                    throws PortalException;
208    
209            /**
210            * Disables all the counters of an asset identified by the class name ID and
211            * class primary key.
212            *
213            * <p>
214            * This method is used by the recycle bin to disable all counters of assets
215            * put into the recycle bin. It adjusts the owner's contribution score.
216            * </p>
217            *
218            * @param classNameId the primary key of the asset's class
219            * @param classPK the primary key of the asset
220            */
221            public void disableActivityCounters(long classNameId, long classPK)
222                    throws PortalException;
223    
224            public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery();
225    
226            /**
227            * Performs a dynamic query on the database and returns the matching rows.
228            *
229            * @param dynamicQuery the dynamic query
230            * @return the matching rows
231            */
232            public <T> java.util.List<T> dynamicQuery(
233                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery);
234    
235            /**
236            * Performs a dynamic query on the database and returns a range of the matching rows.
237            *
238            * <p>
239            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialActivityCounterModelImpl}. 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.
240            * </p>
241            *
242            * @param dynamicQuery the dynamic query
243            * @param start the lower bound of the range of model instances
244            * @param end the upper bound of the range of model instances (not inclusive)
245            * @return the range of matching rows
246            */
247            public <T> java.util.List<T> dynamicQuery(
248                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
249                    int end);
250    
251            /**
252            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
253            *
254            * <p>
255            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialActivityCounterModelImpl}. 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.
256            * </p>
257            *
258            * @param dynamicQuery the dynamic query
259            * @param start the lower bound of the range of model instances
260            * @param end the upper bound of the range of model instances (not inclusive)
261            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
262            * @return the ordered range of matching rows
263            */
264            public <T> java.util.List<T> dynamicQuery(
265                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
266                    int end,
267                    com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator);
268    
269            /**
270            * Returns the number of rows matching the dynamic query.
271            *
272            * @param dynamicQuery the dynamic query
273            * @return the number of rows matching the dynamic query
274            */
275            public long dynamicQueryCount(
276                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery);
277    
278            /**
279            * Returns the number of rows matching the dynamic query.
280            *
281            * @param dynamicQuery the dynamic query
282            * @param projection the projection to apply to the query
283            * @return the number of rows matching the dynamic query
284            */
285            public long dynamicQueryCount(
286                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
287                    com.liferay.portal.kernel.dao.orm.Projection projection);
288    
289            /**
290            * Enables all the counters of an asset identified by the class name and
291            * class primary key.
292            *
293            * <p>
294            * This method is used by the recycle bin to enable all counters of assets
295            * restored from the recycle bin. It adjusts the owner's contribution score.
296            * </p>
297            *
298            * @param className the asset's class name
299            * @param classPK the primary key of the asset
300            */
301            public void enableActivityCounters(java.lang.String className, long classPK)
302                    throws PortalException;
303    
304            /**
305            * Enables all activity counters of an asset identified by the class name ID
306            * and class primary key.
307            *
308            * <p>
309            * This method is used by the recycle bin to enable all counters of assets
310            * restored from the recycle bin. It adjusts the owner's contribution score.
311            * </p>
312            *
313            * @param classNameId the primary key of the asset's class
314            * @param classPK the primary key of the asset
315            */
316            public void enableActivityCounters(long classNameId, long classPK)
317                    throws PortalException;
318    
319            /**
320            * Returns the activity counter with the given name, owner, and end period
321            * that belong to the given entity.
322            *
323            * @param groupId the primary key of the group
324            * @param classNameId the primary key of the entity's class
325            * @param classPK the primary key of the entity
326            * @param name the counter name
327            * @param ownerType the owner type
328            * @param endPeriod the end period, <code>-1</code> for the latest one
329            * @return the matching activity counter
330            */
331            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
332            public com.liferay.portlet.social.model.SocialActivityCounter fetchActivityCounterByEndPeriod(
333                    long groupId, long classNameId, long classPK, java.lang.String name,
334                    int ownerType, int endPeriod);
335    
336            /**
337            * Returns the activity counter with the given name, owner, and start period
338            * that belong to the given entity.
339            *
340            * @param groupId the primary key of the group
341            * @param classNameId the primary key of the entity's class
342            * @param classPK the primary key of the entity
343            * @param name the counter name
344            * @param ownerType the owner type
345            * @param startPeriod the start period
346            * @return the matching activity counter
347            */
348            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
349            public com.liferay.portlet.social.model.SocialActivityCounter fetchActivityCounterByStartPeriod(
350                    long groupId, long classNameId, long classPK, java.lang.String name,
351                    int ownerType, int startPeriod);
352    
353            /**
354            * Returns the latest activity counter with the given name and owner that
355            * belong to the given entity.
356            *
357            * @param groupId the primary key of the group
358            * @param classNameId the primary key of the entity's class
359            * @param classPK the primary key of the entity
360            * @param name the counter name
361            * @param ownerType the owner type
362            * @return the matching activity counter
363            */
364            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
365            public com.liferay.portlet.social.model.SocialActivityCounter fetchLatestActivityCounter(
366                    long groupId, long classNameId, long classPK, java.lang.String name,
367                    int ownerType);
368    
369            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
370            public com.liferay.portlet.social.model.SocialActivityCounter fetchSocialActivityCounter(
371                    long activityCounterId);
372    
373            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
374            public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery();
375    
376            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
377            public com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
378    
379            /**
380            * Returns the OSGi service identifier.
381            *
382            * @return the OSGi service identifier
383            */
384            public java.lang.String getOSGiServiceIdentifier();
385    
386            /**
387            * Returns all the activity counters with the given name and period offsets.
388            *
389            * <p>
390            * The start and end offsets can belong to different periods. This method
391            * groups the counters by name and returns the sum of their current values.
392            * </p>
393            *
394            * @param groupId the primary key of the group
395            * @param name the counter name
396            * @param startOffset the offset for the start period
397            * @param endOffset the offset for the end period
398            * @return the matching activity counters
399            */
400            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
401            public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getOffsetActivityCounters(
402                    long groupId, java.lang.String name, int startOffset, int endOffset);
403    
404            /**
405            * Returns the distribution of the activity counters with the given name and
406            * period offsets.
407            *
408            * <p>
409            * The start and end offsets can belong to different periods. This method
410            * groups the counters by their owner entity (usually some asset) and
411            * returns a counter for each entity class with the sum of the counters'
412            * current values.
413            * </p>
414            *
415            * @param groupId the primary key of the group
416            * @param name the counter name
417            * @param startOffset the offset for the start period
418            * @param endOffset the offset for the end period
419            * @return the distribution of matching activity counters
420            */
421            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
422            public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getOffsetDistributionActivityCounters(
423                    long groupId, java.lang.String name, int startOffset, int endOffset);
424    
425            /**
426            * Returns all the activity counters with the given name and time period.
427            *
428            * <p>
429            * The start and end period values can belong to different periods. This
430            * method groups the counters by name and returns the sum of their current
431            * values.
432            * </p>
433            *
434            * @param groupId the primary key of the group
435            * @param name the counter name
436            * @param startPeriod the start period
437            * @param endPeriod the end period
438            * @return the matching activity counters
439            */
440            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
441            public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getPeriodActivityCounters(
442                    long groupId, java.lang.String name, int startPeriod, int endPeriod);
443    
444            /**
445            * Returns the distribution of activity counters with the given name and
446            * time period.
447            *
448            * <p>
449            * The start and end period values can belong to different periods. This
450            * method groups the counters by their owner entity (usually some asset) and
451            * returns a counter for each entity class with the sum of the counters'
452            * current values.
453            * </p>
454            *
455            * @param groupId the primary key of the group
456            * @param name the counter name
457            * @param startPeriod the start period
458            * @param endPeriod the end period
459            * @return the distribution of matching activity counters
460            */
461            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
462            public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getPeriodDistributionActivityCounters(
463                    long groupId, java.lang.String name, int startPeriod, int endPeriod);
464    
465            @Override
466            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
467            public com.liferay.portal.model.PersistedModel getPersistedModel(
468                    java.io.Serializable primaryKeyObj) throws PortalException;
469    
470            /**
471            * Returns the social activity counter with the primary key.
472            *
473            * @param activityCounterId the primary key of the social activity counter
474            * @return the social activity counter
475            * @throws PortalException if a social activity counter with the primary key could not be found
476            */
477            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
478            public com.liferay.portlet.social.model.SocialActivityCounter getSocialActivityCounter(
479                    long activityCounterId) throws PortalException;
480    
481            /**
482            * Returns a range of all the social activity counters.
483            *
484            * <p>
485            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialActivityCounterModelImpl}. 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.
486            * </p>
487            *
488            * @param start the lower bound of the range of social activity counters
489            * @param end the upper bound of the range of social activity counters (not inclusive)
490            * @return the range of social activity counters
491            */
492            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
493            public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getSocialActivityCounters(
494                    int start, int end);
495    
496            /**
497            * Returns the number of social activity counters.
498            *
499            * @return the number of social activity counters
500            */
501            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
502            public int getSocialActivityCountersCount();
503    
504            /**
505            * Returns the range of tuples that contain users and a list of activity
506            * counters.
507            *
508            * <p>
509            * The counters returned for each user are passed to this method in the
510            * selectedNames array. The method also accepts an array of counter names
511            * that are used to rank the users.
512            * </p>
513            *
514            * <p>
515            * Useful when paginating results. Returns a maximum of <code>end -
516            * start</code> instances. <code>start</code> and <code>end</code> are not
517            * primary keys, they are indexes in the result set. Thus, <code>0</code>
518            * refers to the first result in the set. Setting both <code>start</code>
519            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
520            * result set.
521            * </p>
522            *
523            * @param groupId the primary key of the group
524            * @param rankingNames the ranking counter names
525            * @param selectedNames the counter names that will be returned with each
526            user
527            * @param start the lower bound of the range of results
528            * @param end the upper bound of the range of results (not inclusive)
529            * @return the range of matching tuples
530            */
531            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
532            public java.util.List<com.liferay.portal.kernel.util.Tuple> getUserActivityCounters(
533                    long groupId, java.lang.String[] rankingNames,
534                    java.lang.String[] selectedNames, int start, int end);
535    
536            /**
537            * Returns the number of users having a rank based on the given counters.
538            *
539            * @param groupId the primary key of the group
540            * @param rankingNames the ranking counter names
541            * @return the number of matching users
542            */
543            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
544            public int getUserActivityCountersCount(long groupId,
545                    java.lang.String[] rankingNames);
546    
547            /**
548            * Increments the <code>user.achievements</code> counter for a user.
549            *
550            * <p>
551            * This method should be used by an external achievement class when the
552            * users unlocks an achievement.
553            * </p>
554            *
555            * @param userId the primary key of the user
556            * @param groupId the primary key of the group
557            */
558            public void incrementUserAchievementCounter(long userId, long groupId)
559                    throws PortalException;
560    
561            /**
562            * Updates the social activity counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
563            *
564            * @param socialActivityCounter the social activity counter
565            * @return the social activity counter that was updated
566            */
567            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX)
568            public com.liferay.portlet.social.model.SocialActivityCounter updateSocialActivityCounter(
569                    com.liferay.portlet.social.model.SocialActivityCounter socialActivityCounter);
570    }