Nilesh Gundecha 12 Years Ago This was the much required blog post.. I hope this is also updated in Liferay Wiki. Thanks. Please sign in to reply. Reply as... Cancel Zsolt Berentey Nilesh Gundecha 12 Years Ago I am planning to do some more Please sign in to reply. Reply as... Cancel
Zsolt Berentey Nilesh Gundecha 12 Years Ago I am planning to do some more Please sign in to reply. Reply as... Cancel
Puj Z 12 Years Ago Great post Zsolt! Thanks! I had a question: for custom portlet, where exactly should liferay-social.xml be located? Do you have a sample .xml file? Would be great! Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Hi Puj,Just put it in WEB-INF. As for the sample file, check out the one that is in the portal if you can. You can find a lot of different settings in there.Best,Zs. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago Thanks mate! I successfully added the activities. Now I am struggling with the new resource and asset methods. But I am almost there! ;) I hope a sample code would be available soon in KB, it will save lots of time Please sign in to reply. Reply as... Cancel
Zsolt Berentey Puj Z 12 Years Ago Hi Puj,Just put it in WEB-INF. As for the sample file, check out the one that is in the portal if you can. You can find a lot of different settings in there.Best,Zs. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago Thanks mate! I successfully added the activities. Now I am struggling with the new resource and asset methods. But I am almost there! ;) I hope a sample code would be available soon in KB, it will save lots of time Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 12 Years Ago Thanks mate! I successfully added the activities. Now I am struggling with the new resource and asset methods. But I am almost there! ;) I hope a sample code would be available soon in KB, it will save lots of time Please sign in to reply. Reply as... Cancel
Nilesh Gundecha 12 Years Ago Hi Zsolt,I was using below API in my Liferay 6.0 custom portlet for enabling the Social Equity on the group: -SocialEquityGroupSettingLocalServiceUtil.updateEquityGroupSetting(group.getGroupId(), Group.class.getName(), 1,true);SocialEquityGroupSettingLocalServiceUtil.updateEquityGroupSetting(group.getGroupId(), Group.class.getName(), 2,true); After migrating my application to Liferay 6.1, I replaced the above 2 lines with below line: -SocialActivitySettingLocalServiceUtil.updateActivitySetting(group.getGroupId(), Group.class.getName(), true);But this has not helped me in enabling the Social Equity(Activity). Can u please point me into some direction? Thanks in advance. Please sign in to reply. Reply as... Cancel Zsolt Berentey Nilesh Gundecha 12 Years Ago Hi Nilesh,You are using the right method, but the second parameter is the classNameId for the model you want to enable social activities for in the given group. In other words now you cannot enable/disable on the group level, you need to specify the model too.I hope this helps.Zs. Please sign in to reply. Reply as... Cancel Nilesh Gundecha Zsolt Berentey 12 Years Ago Thanks very much for reply.But then does this mean that I have to call this API for every model? Bcoz apart from Blogs, Wiki, MB, I have my custom assets too on which Social Equity needs to be allocated.SocialEquityGroupSettingLocalServiceUtil.updateEquityGroupSetting(..) method in Liferay 6.0 was enabling all the assets on a given group. Any API providing same functionality?Thanks again. Please sign in to reply. Reply as... Cancel Zsolt Berentey Nilesh Gundecha 12 Years Ago Yes, you need to call the method for each model. Please sign in to reply. Reply as... Cancel Mahendra Mahakle Zsolt Berentey 12 Years Ago Hi Zsolt I was using user.getParticipationEquity() And user.getContributionEquity() to get users participation and contribution score in LR6.0. Now in LR6.1 How will i get users score?.is any equivalent service available here?. Please sign in to reply. Reply as... Cancel Zsolt Berentey Mahendra Mahakle 12 Years Ago - Edited Hi Mahendra,As participation and contribution are handled as counters now, you can simply ask for them through the SocialActivityCounterLocalService. Use the fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType) method. ClassNameId for these counters is the classNameId of com.liferay.portal.model.User, the name is "participation" or "contribution" and the owner type is SocialActivityCounterConstants.TYPE_ACTOR for participation and SocialActivityCounterConstants.TYPE_CREATOR for contribution. The classPK is the userId. The returned counter will have a currentValue for the actual value for the current statistical period (by default the current month) and a totalValue.I hope this helps. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Nilesh Gundecha 12 Years Ago Hi Nilesh,You are using the right method, but the second parameter is the classNameId for the model you want to enable social activities for in the given group. In other words now you cannot enable/disable on the group level, you need to specify the model too.I hope this helps.Zs. Please sign in to reply. Reply as... Cancel Nilesh Gundecha Zsolt Berentey 12 Years Ago Thanks very much for reply.But then does this mean that I have to call this API for every model? Bcoz apart from Blogs, Wiki, MB, I have my custom assets too on which Social Equity needs to be allocated.SocialEquityGroupSettingLocalServiceUtil.updateEquityGroupSetting(..) method in Liferay 6.0 was enabling all the assets on a given group. Any API providing same functionality?Thanks again. Please sign in to reply. Reply as... Cancel Zsolt Berentey Nilesh Gundecha 12 Years Ago Yes, you need to call the method for each model. Please sign in to reply. Reply as... Cancel Mahendra Mahakle Zsolt Berentey 12 Years Ago Hi Zsolt I was using user.getParticipationEquity() And user.getContributionEquity() to get users participation and contribution score in LR6.0. Now in LR6.1 How will i get users score?.is any equivalent service available here?. Please sign in to reply. Reply as... Cancel Zsolt Berentey Mahendra Mahakle 12 Years Ago - Edited Hi Mahendra,As participation and contribution are handled as counters now, you can simply ask for them through the SocialActivityCounterLocalService. Use the fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType) method. ClassNameId for these counters is the classNameId of com.liferay.portal.model.User, the name is "participation" or "contribution" and the owner type is SocialActivityCounterConstants.TYPE_ACTOR for participation and SocialActivityCounterConstants.TYPE_CREATOR for contribution. The classPK is the userId. The returned counter will have a currentValue for the actual value for the current statistical period (by default the current month) and a totalValue.I hope this helps. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Nilesh Gundecha Zsolt Berentey 12 Years Ago Thanks very much for reply.But then does this mean that I have to call this API for every model? Bcoz apart from Blogs, Wiki, MB, I have my custom assets too on which Social Equity needs to be allocated.SocialEquityGroupSettingLocalServiceUtil.updateEquityGroupSetting(..) method in Liferay 6.0 was enabling all the assets on a given group. Any API providing same functionality?Thanks again. Please sign in to reply. Reply as... Cancel Zsolt Berentey Nilesh Gundecha 12 Years Ago Yes, you need to call the method for each model. Please sign in to reply. Reply as... Cancel Mahendra Mahakle Zsolt Berentey 12 Years Ago Hi Zsolt I was using user.getParticipationEquity() And user.getContributionEquity() to get users participation and contribution score in LR6.0. Now in LR6.1 How will i get users score?.is any equivalent service available here?. Please sign in to reply. Reply as... Cancel Zsolt Berentey Mahendra Mahakle 12 Years Ago - Edited Hi Mahendra,As participation and contribution are handled as counters now, you can simply ask for them through the SocialActivityCounterLocalService. Use the fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType) method. ClassNameId for these counters is the classNameId of com.liferay.portal.model.User, the name is "participation" or "contribution" and the owner type is SocialActivityCounterConstants.TYPE_ACTOR for participation and SocialActivityCounterConstants.TYPE_CREATOR for contribution. The classPK is the userId. The returned counter will have a currentValue for the actual value for the current statistical period (by default the current month) and a totalValue.I hope this helps. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Nilesh Gundecha 12 Years Ago Yes, you need to call the method for each model. Please sign in to reply. Reply as... Cancel Mahendra Mahakle Zsolt Berentey 12 Years Ago Hi Zsolt I was using user.getParticipationEquity() And user.getContributionEquity() to get users participation and contribution score in LR6.0. Now in LR6.1 How will i get users score?.is any equivalent service available here?. Please sign in to reply. Reply as... Cancel Zsolt Berentey Mahendra Mahakle 12 Years Ago - Edited Hi Mahendra,As participation and contribution are handled as counters now, you can simply ask for them through the SocialActivityCounterLocalService. Use the fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType) method. ClassNameId for these counters is the classNameId of com.liferay.portal.model.User, the name is "participation" or "contribution" and the owner type is SocialActivityCounterConstants.TYPE_ACTOR for participation and SocialActivityCounterConstants.TYPE_CREATOR for contribution. The classPK is the userId. The returned counter will have a currentValue for the actual value for the current statistical period (by default the current month) and a totalValue.I hope this helps. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Mahendra Mahakle Zsolt Berentey 12 Years Ago Hi Zsolt I was using user.getParticipationEquity() And user.getContributionEquity() to get users participation and contribution score in LR6.0. Now in LR6.1 How will i get users score?.is any equivalent service available here?. Please sign in to reply. Reply as... Cancel Zsolt Berentey Mahendra Mahakle 12 Years Ago - Edited Hi Mahendra,As participation and contribution are handled as counters now, you can simply ask for them through the SocialActivityCounterLocalService. Use the fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType) method. ClassNameId for these counters is the classNameId of com.liferay.portal.model.User, the name is "participation" or "contribution" and the owner type is SocialActivityCounterConstants.TYPE_ACTOR for participation and SocialActivityCounterConstants.TYPE_CREATOR for contribution. The classPK is the userId. The returned counter will have a currentValue for the actual value for the current statistical period (by default the current month) and a totalValue.I hope this helps. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Mahendra Mahakle 12 Years Ago - Edited Hi Mahendra,As participation and contribution are handled as counters now, you can simply ask for them through the SocialActivityCounterLocalService. Use the fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType) method. ClassNameId for these counters is the classNameId of com.liferay.portal.model.User, the name is "participation" or "contribution" and the owner type is SocialActivityCounterConstants.TYPE_ACTOR for participation and SocialActivityCounterConstants.TYPE_CREATOR for contribution. The classPK is the userId. The returned counter will have a currentValue for the actual value for the current statistical period (by default the current month) and a totalValue.I hope this helps. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 12 Years Ago for contribution you mean SocialActivityCounterConstants.TYPE_CREATOR right?TYPE_OWNER doesn't exist in SocialActivityCounterConstants Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Of course Corrected. Please sign in to reply. Reply as... Cancel
Mahendra Mahakle 12 Years Ago Hi Zsolt I want to add social equity on custom assets.i have configured liferay-social.xml for my assets But I am not getting participation and contribution for that.can you give me some right direction?please refer this post for deatails: http://www.liferay.com/community/forums/-/message_boards/message/12486137ThanksMahendra Please sign in to reply. Reply as... Cancel Zsolt Berentey Mahendra Mahakle 12 Years Ago Hi Mahendra,I have commented on the message boards. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago Ho Zsolt,I am trying to read the score of a user in a portlet and I am using this method: long userClassNameId = ClassNameLocalServiceUtil.getClassNameId(User.class.getName()); SocialActivityCounter counter = SocialActivityCounterLocalServiceUtil.fetchLatestActivityCounter(scopeGroupId, userClassNameId,user2.getUserId(), "participation",SocialActivityCounterConstants.TYPE_ACTOR); int pScore = counter.getTotalValue();//currentValue() for the actual value for the current statistical period (by default the current month) counter = SocialActivityCounterLocalServiceUtil.fetchLatestActivityCounter(scopeGroupId, userClassNameId,user2.getUserId(), "contribution", SocialActivityCounterConstants.TYPE_CREATOR); int cScore = counter.getTotalValue(); int totalScore = pScore+cScore;The problem is, I strangely get a JasperException when calling the totalValue() method of the counter:Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530) at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:316) at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:366) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:382) at com.liferay.util.bridges.mvc.MVCPortlet.doView(MVCPortlet.java:145) at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:211) at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:318) at javax.portlet.GenericPortlet.render(GenericPortlet.java:233) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.jaDo you know why this is happening? I am doing something wrong or is it a bug?Cheers Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Can you try to enclose the call in a try catch and print the stack trace so that we know what's happening? Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,I am still struggling with the configuration. I have a question: what is <counter> for? Is it optional? If I have a custom model called collection and I want to add social equity for adding a new collection, can I just call it <counter>user.collections</counter>? I left it out but then it is not being included in the User Statistics portlet. I am confused.Here is my definition in liferay-social.xml:<liferay-social> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type> <language-key>ADD_COLLECTION</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>10</participation-value> <participation-limit enabled="false"/> </activity>I left out the counter part. Please sign in to reply. Reply as... Cancel Puj Z Puj Z 11 Years Ago maybe I should asset.activities in <counter> for custom models? Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Mahendra Mahakle 12 Years Ago Hi Mahendra,I have commented on the message boards. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 12 Years Ago Ho Zsolt,I am trying to read the score of a user in a portlet and I am using this method: long userClassNameId = ClassNameLocalServiceUtil.getClassNameId(User.class.getName()); SocialActivityCounter counter = SocialActivityCounterLocalServiceUtil.fetchLatestActivityCounter(scopeGroupId, userClassNameId,user2.getUserId(), "participation",SocialActivityCounterConstants.TYPE_ACTOR); int pScore = counter.getTotalValue();//currentValue() for the actual value for the current statistical period (by default the current month) counter = SocialActivityCounterLocalServiceUtil.fetchLatestActivityCounter(scopeGroupId, userClassNameId,user2.getUserId(), "contribution", SocialActivityCounterConstants.TYPE_CREATOR); int cScore = counter.getTotalValue(); int totalScore = pScore+cScore;The problem is, I strangely get a JasperException when calling the totalValue() method of the counter:Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530) at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:316) at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:366) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:382) at com.liferay.util.bridges.mvc.MVCPortlet.doView(MVCPortlet.java:145) at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:211) at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:318) at javax.portlet.GenericPortlet.render(GenericPortlet.java:233) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.jaDo you know why this is happening? I am doing something wrong or is it a bug?Cheers Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Can you try to enclose the call in a try catch and print the stack trace so that we know what's happening? Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,I am still struggling with the configuration. I have a question: what is <counter> for? Is it optional? If I have a custom model called collection and I want to add social equity for adding a new collection, can I just call it <counter>user.collections</counter>? I left it out but then it is not being included in the User Statistics portlet. I am confused.Here is my definition in liferay-social.xml:<liferay-social> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type> <language-key>ADD_COLLECTION</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>10</participation-value> <participation-limit enabled="false"/> </activity>I left out the counter part. Please sign in to reply. Reply as... Cancel Puj Z Puj Z 11 Years Ago maybe I should asset.activities in <counter> for custom models? Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 12 Years Ago Ho Zsolt,I am trying to read the score of a user in a portlet and I am using this method: long userClassNameId = ClassNameLocalServiceUtil.getClassNameId(User.class.getName()); SocialActivityCounter counter = SocialActivityCounterLocalServiceUtil.fetchLatestActivityCounter(scopeGroupId, userClassNameId,user2.getUserId(), "participation",SocialActivityCounterConstants.TYPE_ACTOR); int pScore = counter.getTotalValue();//currentValue() for the actual value for the current statistical period (by default the current month) counter = SocialActivityCounterLocalServiceUtil.fetchLatestActivityCounter(scopeGroupId, userClassNameId,user2.getUserId(), "contribution", SocialActivityCounterConstants.TYPE_CREATOR); int cScore = counter.getTotalValue(); int totalScore = pScore+cScore;The problem is, I strangely get a JasperException when calling the totalValue() method of the counter:Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530) at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:316) at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:366) at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:382) at com.liferay.util.bridges.mvc.MVCPortlet.doView(MVCPortlet.java:145) at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:211) at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:318) at javax.portlet.GenericPortlet.render(GenericPortlet.java:233) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.jaDo you know why this is happening? I am doing something wrong or is it a bug?Cheers Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 12 Years Ago Can you try to enclose the call in a try catch and print the stack trace so that we know what's happening? Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,I am still struggling with the configuration. I have a question: what is <counter> for? Is it optional? If I have a custom model called collection and I want to add social equity for adding a new collection, can I just call it <counter>user.collections</counter>? I left it out but then it is not being included in the User Statistics portlet. I am confused.Here is my definition in liferay-social.xml:<liferay-social> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type> <language-key>ADD_COLLECTION</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>10</participation-value> <participation-limit enabled="false"/> </activity>I left out the counter part. Please sign in to reply. Reply as... Cancel Puj Z Puj Z 11 Years Ago maybe I should asset.activities in <counter> for custom models? Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Puj Z 12 Years Ago Can you try to enclose the call in a try catch and print the stack trace so that we know what's happening? Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,I am still struggling with the configuration. I have a question: what is <counter> for? Is it optional? If I have a custom model called collection and I want to add social equity for adding a new collection, can I just call it <counter>user.collections</counter>? I left it out but then it is not being included in the User Statistics portlet. I am confused.Here is my definition in liferay-social.xml:<liferay-social> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type> <language-key>ADD_COLLECTION</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>10</participation-value> <participation-limit enabled="false"/> </activity>I left out the counter part. Please sign in to reply. Reply as... Cancel Puj Z Puj Z 11 Years Ago maybe I should asset.activities in <counter> for custom models? Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,I am still struggling with the configuration. I have a question: what is <counter> for? Is it optional? If I have a custom model called collection and I want to add social equity for adding a new collection, can I just call it <counter>user.collections</counter>? I left it out but then it is not being included in the User Statistics portlet. I am confused.Here is my definition in liferay-social.xml:<liferay-social> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type> <language-key>ADD_COLLECTION</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>10</participation-value> <participation-limit enabled="false"/> </activity>I left out the counter part. Please sign in to reply. Reply as... Cancel Puj Z Puj Z 11 Years Ago maybe I should asset.activities in <counter> for custom models? Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Puj Z Puj Z 11 Years Ago maybe I should asset.activities in <counter> for custom models? Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Puj Z 11 Years Ago Hi Puj,What exactly is it that you want to achieve here? In order to have participation or contribution points related to a custom asset the only thing you need is the config you have. Of course you have to enable the model in control panel. If you would like to have a counter for example to count the number of collections the user has made, you need to create a counter in your config.The main thing with counters is that they are tied to either a user or the asset in question. This you can control with the <owner-type>. You can put asset, actor or creator in there. If you put asset, you will have a different counter for each collection asset (and in this case it doesn't make sense, since you can create an asset only once ). If it is actor, you will have one for each user who ever added a collection and it will count how many collections he or she adds because it will be incremented on each ADD_COLLECTION action for the user who is adding the collection. If the owner type is creator the counter is incremented for the user who is the owner of the asset, and it doesn't make any sense for add actions either.Hope this helps,Zsolt Please sign in to reply. Reply as... Cancel Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Zsolt Berentey 11 Years Ago One more thing. The name of the counter doesn't matter. I named them user.*, or asset.* so that it is evident what type of counter it is just by looking at its name.And the last thing. If you want it to appear on User Statistics, you explicitly have to add it in the configuration of User Statistics. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 11 Years Ago Hi Zsolt,thanks a lot! I write my steps here in case someone else is interested. However, it is still not working. Is it maybe because the collections have been already added and the changes apply only for new collections? I have added add_collection as a social activity. I don't know whether the changes in the counter are retroactive or not.And another question: how can I set the frequency of equity (counter) updates? The User Statistics portlet is not being updated very often. In Liferay 6.0, we could set the parameter social.equity.equity.log.check.interval in portal-ext. I cannot find any similar one in 6.1.And another question if you don't mind me shooting one question after another! ;), where are the counters being saved? I checked socialactivitycounter but the currentValue does not represent the value I set for the participation points. Is this the only table that is responsible for saving points?Thanks for your help! And here are the steps I have taken so that add collection and commeting under a collection would be rewarded (still doesn't work, I don't know if it is cache or I have missed anything):in liferay-social.xml<liferay-social><activity><model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name><activity-type>${org.fortiss.fb3.innovationRepository.social.CollectionActivityKeys.ADD_COLLECTION}</activity-type><language-key>ADD_COLLECTION</language-key><log-activity>true</log-activity><contribution-value>0</contribution-value><contribution-limit enabled="false" /><participation-value>10</participation-value><participation-limit enabled="false"/> <counter> <name>creator.collections</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.collections</name> <owner-type>actor</owner-type> </counter></activity> <activity> <model-name>org.fortiss.fb3.innovationRepository.model.Collection</model-name> <activity-type>${com.liferay.portlet.social.model.SocialActivityConstants.TYPE_ADD_COMMENT}</activity-type> <language-key>ADD_COMMENT</language-key> <log-activity>true</log-activity> <contribution-value>0</contribution-value> <contribution-limit enabled="false" /> <participation-value>3</participation-value> <participation-limit enabled="false"/> <counter> <name>asset.comments</name> <owner-type>asset</owner-type> </counter> <counter> <name>creator.comments</name> <owner-type>creator</owner-type> </counter> <counter> <name>user.comments</name> <owner-type>actor</owner-type> </counter> </activity>In addCollection of CollectionLocalServiceImpl, I had of course added the pertinent resource, asset and then socialActivityLocalService.addActivity( collection.getUserId(), collection.getGroupId(), Idea.class.getName(), collection.getPrimaryKey(), CollectionActivityKeys.ADD_COLLECTION, StringPool.BLANK, 0);Then I activate the social equity for the model (collection) in control panel.Then I went to the configuration of User Statistics portlet and added social.counter.user.collections and social.counter.creator.collections to the list of counters.The values that user statistics shows are still 0 and not all the users that have been adding collections or commments are being shown. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Puj Z 11 Years Ago Ok, first of all, User Statistics is update on every page refresh, so unless you're doing something with Ajax without refreshing other portlets, it should update immediately. Secondly, yes, counters are not retroactively applied, so you should only see it increment for new additions. As to your third question, yes, you should see every counter in the SocialActivityCounter table. As for what you are doing, I think there is an error there. You're passing in the class name of the Idea class, while your asset is the Collection class. You have to pass in the asset's class name or at least the one you have your actions configured for (which is in this case 'org.fortiss.fb3.innovateionRepository.model.Collection'). Because of this, the system cannot find an activity for this action, it doesn't do anything. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 11 Years Ago oh sorry, idea was the old name, I have Collection.class.getName() in the new code, so this one is actually correct.I checked it again and the User Statistics have started counting! This is great! The only problem now is the old collections.Can you give me any hints what I should do so that the users that already have added a collection would be given the points? I can add rows manually to database if necessary. And their "adding" is already saved as a social activity in socialactivity portlet. Only the points are not being counted for some reason. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Puj Z 11 Years Ago Well if you are sure that they don't have a row (and never had) in the database for this counter, you can use the addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod) method in SocialActivityLocalService. Maybe an even better option is to select all those social activities and call the addActivity(SocialActivity activity) method for each. This is basically what is normally happening. This would create and increment the necessary counters, even participation. Of course it would do all of these for the current period only, so you cannot create "past" data with it. Please sign in to reply. Reply as... Cancel Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Puj Z Zsolt Berentey 11 Years Ago Thanks! Strangely, there ARE rows in socialActivity table for these past "adding" actions, they are just being ignored by the User Statistic portlet. I don't know why. I tried to change the date, but it didn't help. I don't see any difference in the rows of socialActivity table for new activities (that are being counted) and past activities. If you say no other table or factors are involved, then it should be some sort of cache problem I guess. Please sign in to reply. Reply as... Cancel Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Zsolt Berentey Puj Z 11 Years Ago User Statistics shows the current value (which is for the current period) and the total value that should be the total of all current values that exist for that counter. Please sign in to reply. Reply as... Cancel
Jay Patel 11 Years Ago Thanks for Sharing this Zsolt.. Please sign in to reply. Reply as... Cancel Cesar Ingaruca Jay Patel 11 Years Ago Hi Zsolt,i don't need to use "periods" of time to show pointshow can i get all the points for each user in all their timelife? Please sign in to reply. Reply as... Cancel
Cesar Ingaruca Jay Patel 11 Years Ago Hi Zsolt,i don't need to use "periods" of time to show pointshow can i get all the points for each user in all their timelife? Please sign in to reply. Reply as... Cancel
Cesar Ingaruca 11 Years Ago Hi Zsolt,i don't need to use "periods" of time to show pointshow can i get all the points for each user in all their timelife? Please sign in to reply. Reply as... Cancel Zsolt Berentey Cesar Ingaruca 11 Years Ago Hi Cesar,There is a total for each counter that can be retrieved from the counter by calling the getTotalValue() method. Best,Zsolt. Please sign in to reply. Reply as... Cancel Daniel Aschauer Zsolt Berentey 11 Years Ago Thanks for the great post.I am not sure how to add my own definitions to liferay-social.xml. Is it necessary to do this with a ext-plugin? Please sign in to reply. Reply as... Cancel Daniel Aschauer Daniel Aschauer 11 Years Ago Found it myself. its possible to add an additional liferay-social.xml using an hook plugin. Please sign in to reply. Reply as... Cancel Zsolt Berentey Daniel Aschauer 11 Years Ago Yes that is correct Please sign in to reply. Reply as... Cancel
Zsolt Berentey Cesar Ingaruca 11 Years Ago Hi Cesar,There is a total for each counter that can be retrieved from the counter by calling the getTotalValue() method. Best,Zsolt. Please sign in to reply. Reply as... Cancel Daniel Aschauer Zsolt Berentey 11 Years Ago Thanks for the great post.I am not sure how to add my own definitions to liferay-social.xml. Is it necessary to do this with a ext-plugin? Please sign in to reply. Reply as... Cancel Daniel Aschauer Daniel Aschauer 11 Years Ago Found it myself. its possible to add an additional liferay-social.xml using an hook plugin. Please sign in to reply. Reply as... Cancel Zsolt Berentey Daniel Aschauer 11 Years Ago Yes that is correct Please sign in to reply. Reply as... Cancel
Daniel Aschauer Zsolt Berentey 11 Years Ago Thanks for the great post.I am not sure how to add my own definitions to liferay-social.xml. Is it necessary to do this with a ext-plugin? Please sign in to reply. Reply as... Cancel Daniel Aschauer Daniel Aschauer 11 Years Ago Found it myself. its possible to add an additional liferay-social.xml using an hook plugin. Please sign in to reply. Reply as... Cancel Zsolt Berentey Daniel Aschauer 11 Years Ago Yes that is correct Please sign in to reply. Reply as... Cancel
Daniel Aschauer Daniel Aschauer 11 Years Ago Found it myself. its possible to add an additional liferay-social.xml using an hook plugin. Please sign in to reply. Reply as... Cancel Zsolt Berentey Daniel Aschauer 11 Years Ago Yes that is correct Please sign in to reply. Reply as... Cancel
Zsolt Berentey Daniel Aschauer 11 Years Ago Yes that is correct Please sign in to reply. Reply as... Cancel
Juanjo Pérez 10 Years Ago Hi Zsolt.As far as I've seen, there is no negative impact in Social Equity if a contribution of a user is deleted. For instance, let's imagine a user that posts an inappropiate comment in a message board. If someone (a moderator) deletes the post there is no negative impact in Social Equity, is it? I mean, there is no substraction of his score in Social Equity.I have another doubt. Imagine a message board with a kaleo workflow for moderation purposes. If a user posts an entry, when is the social equity score added? After or before the post is approved by a moderator?Thanks. Regards. Please sign in to reply. Reply as... Cancel Zsolt Berentey Juanjo Pérez 10 Years Ago Hi Juanjo,When you delete an asset from the system, the author of the asset loses the contribution points related to that asset, so yes there is some kind of a negative impact. This is however only relates to contribution score that is a reflection of how others rate your content by reading it, subscribing to it, etc. If a user simply posts a message he doesn't get any contribution points for just writing the post, so deleting it wouldn't affect his score. Also note, that deleting an asset doesn't affect participation score in any way.As for your second question, the points are recorded when the post gets approved. I hope I could help.Best,Zsolt Please sign in to reply. Reply as... Cancel
Zsolt Berentey Juanjo Pérez 10 Years Ago Hi Juanjo,When you delete an asset from the system, the author of the asset loses the contribution points related to that asset, so yes there is some kind of a negative impact. This is however only relates to contribution score that is a reflection of how others rate your content by reading it, subscribing to it, etc. If a user simply posts a message he doesn't get any contribution points for just writing the post, so deleting it wouldn't affect his score. Also note, that deleting an asset doesn't affect participation score in any way.As for your second question, the points are recorded when the post gets approved. I hope I could help.Best,Zsolt Please sign in to reply. Reply as... Cancel
Nilesh Gundecha 10 Years Ago Hi Zsolt,Who gets the contribution points when user subscribes to the Blogs portlet (not to the individual blog comments)? I am using Liferay 6.1 GA3 CE and it seems that contribution points are given to any random site member. I have also written little more little in the below thread, please let me know if this is a bug. https://www.liferay.com/community/forums/-/message_boards/message/34247784 Please sign in to reply. Reply as... Cancel