论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Daniel Aschauer
social activity for webcontent
2013年3月7日 上午6:01
答复

Daniel Aschauer

等级: New Member

帖子: 1

加入日期: 2012年11月6日

最近的帖子

Hi there!
I want to enable social activity for web content, thus I created a hook for the JournalArticleLocalService class overriding the updateStatus message where I added code that calls addActivity.

As i want to assign contribution points to the user that created content i added a new activity definition to liferay-social.xml

<activity>
<model-name>com.liferay.portlet.journal.model.JournalArticle</model-name>
<activity-type>${at.cyberhouse.portlet.journal.service.SocialJournalArticleLocalServiceImpl.ADD_ENTRY}</activity-type>
<language-key>ADD_ENTRY</language-key>
<log-activity>true</log-activity>
<contribution-limit enabled="false" />
<participation-value>50</participation-value>
<participation-limit period="lifetime">1</participation-limit>
<counter>
<name>user.article</name>
<owner-type>actor</owner-type>
</counter>
</activity>


But something seems to be wrong in my definition, as when I enter the social activity configuration a get two entrys for
social.activity.com.liferay.portlet.journal.model.JournalArticle.ADD_ENTRY
and lot of other entrys in Blog, WIKI,.. are missing. There are no exceptions in the logs.
When I activate the points the activity is then logged but no points are assigned.

What could be wrong with the definition?
What is the best way to modify the liferay-social.xml, should this be done with a serperate ext-plugin (I edit the original file on the server)?

Thanks for any hints!
Daniel Aschauer
RE: social activity for webcontent
2013年3月8日 上午3:29
答复

Daniel Aschauer

等级: Junior Member

帖子: 39

加入日期: 2012年10月22日

最近的帖子

Ok, I can reply to myself now.
To add the new definition they have to be configured in a separate liferay-social.xml within a hook plugin. Then everything works fine.
Sergio San José
RE: social activity for webcontent
2013年9月17日 上午4:51
答复

Sergio San José

等级: New Member

帖子: 2

加入日期: 2012年6月13日

最近的帖子

Hi Daniel.

Did you register an Activity Interpreter for the Journal Article? If so, where did you do it? I'm having problems doing this in the liferay-portlet-ext.xml (over <portlet-name>15</portlet-name>).

Thanks!
Sergio San José
RE: social activity for webcontent
2013年9月17日 上午9:47
答复

Sergio San José

等级: New Member

帖子: 2

加入日期: 2012年6月13日

最近的帖子

Replying to myself, I've resolved this issue by creating the interpreter class in a separate Java Project, exporting it as a jar file, and adding it to the web server library.

Then I've created liferay-portlet-ext.xml adding it directly in ..webapps\ROOT\WEB-INF (it can also be done via ext plugin) overriding portlet 56 by adding <social-activity-interpreter-class> element.
Daniel Aschauer
RE: social activity for webcontent
2013年9月19日 上午1:15
答复

Daniel Aschauer

等级: Junior Member

帖子: 39

加入日期: 2012年10月22日

最近的帖子

Hello Sergio!

I am not familiar with your approach, but you can add a social activity interpreter class simply by adding a class that extends BaseSocialActivityInterpreter to your hook project:

 1public class SocialActivityInterpreterHook extends BaseSocialActivityInterpreter {
 2   
 3private static final String[]_CLASS_NAMES = new String[] {
 4        JournalArticle.class.getName()
 5        };
 6
 7    public String[] getClassNames() {
 8        return _CLASS_NAMES;
 9    }


This way you don't have to use a ext plugin. Note that the class then takes over ALL activity interpretations for the classes defined and returned by getClassNames().
I hope this helps you!