Class ActivityResourceBundlePlugin
java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.social.core.processor.ActivityResourceBundlePlugin
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin
public class ActivityResourceBundlePlugin
extends org.exoplatform.container.component.BaseComponentPlugin
The activity resource bundle plugin for registering external resource bundle
for I18N activity type.
Must set titleId for ExoSocialActivity model to indicate that it's i18n activity and that titleId is used to map with message
bundle key via configuration.
Sample code:
<external-component-plugins>
<target-component>org.exoplatform.social.core.processor.I18NActivityProcessor</target-component>
<component-plugin>
<name>exosocial:spaces</name> <!-- activity type -->
<set-method>addActivityResourceBundlePlugin</set-method>
<type>org.exoplatform.social.core.processor.ActivityResourceBundlePlugin</type>
<init-params>
<object-param>
<name>locale.social.Core</name> <!-- resource bundle key file -->
<description>activity key type resource bundle mapping for exosocial:spaces</description>
<object type="org.exoplatform.social.core.processor.ActivityResourceBundlePlugin">
<field name="activityKeyTypeMapping">
<map type="java.util.HashMap">
<entry>
<key><string>space_created</string></key>
<value><string>ProfileUpdatesPublisher.avatar_updated</string></value>
</entry>
</map>
</field>
</object>
</object-param>
</init-params>
</component-plugin>
</external-component-plugins>
-
Field Summary
Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorActivityResourceBundlePlugin(org.exoplatform.container.xml.InitParams initParams) Constructor for getting activityType, activityKeyTypeMapping, and resourceBundleKeyFile from init params. -
Method Summary
Modifier and TypeMethodDescriptionGets the associated activity key type mapping from this activity resource bundle plugin.Gets the associated activity type from this activity resource bundle plugin.getMessageBundleKey(String activityTitleId) Gets the registered message bundle key for a specific activity's titleId.Gets the associated resource bundle key file for getting resource bundle via ResourceBundleService.booleanhasMessageBundleKey(String activityTitleId) Checks if this activity resource bundle plugin contains a specific activity titleId.booleanisValid()Checks if this is a valid plugin which means that activityType, resourceBundleKeyFile must not be null and activityKeyTypeMapping must contain equal or more than 1 entry.voidsetActivityKeyTypeMapping(Map<String, String> mapping) Sets the associated activity key type mapping from this activity resource bundle plugin.voidsetActivityType(String activityType) Sets the associated activity type from this activity resource bundle plugin.Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
-
Constructor Details
-
ActivityResourceBundlePlugin
public ActivityResourceBundlePlugin()Default constructor -
ActivityResourceBundlePlugin
public ActivityResourceBundlePlugin(org.exoplatform.container.xml.InitParams initParams) Constructor for getting activityType, activityKeyTypeMapping, and resourceBundleKeyFile from init params.- Parameters:
initParams- the init params.
-
-
Method Details
-
getActivityType
Gets the associated activity type from this activity resource bundle plugin.- Returns:
- the associated activity type.
-
setActivityType
Sets the associated activity type from this activity resource bundle plugin.- Parameters:
activityType- the associated activity type.
-
getActivityKeyTypeMapping
Gets the associated activity key type mapping from this activity resource bundle plugin.- Returns:
-
setActivityKeyTypeMapping
Sets the associated activity key type mapping from this activity resource bundle plugin.- Parameters:
mapping- the hash map of key as titleId and value as message bundle key
-
getResourceBundleKeyFile
Gets the associated resource bundle key file for getting resource bundle via ResourceBundleService.- Returns:
- the associated resource bundle key file.
-
hasMessageBundleKey
Checks if this activity resource bundle plugin contains a specific activity titleId.- Parameters:
activityTitleId- the activity's titleId.- Returns:
- a boolean value
-
getMessageBundleKey
Gets the registered message bundle key for a specific activity's titleId.- Parameters:
activityTitleId- the activity's titleId.- Returns:
- the found registered message bundle key or null if not found.
-
isValid
public boolean isValid()Checks if this is a valid plugin which means that activityType, resourceBundleKeyFile must not be null and activityKeyTypeMapping must contain equal or more than 1 entry.- Returns:
- a boolean value.
-