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>SpaceActivityPublisher.space_created</string></value>
                </entry>
              </map>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
 
Since:
1.2.8, Feb 6, 2012.
Author:
hoatle (hoatlevan at gmail dot com)
  • Field Summary

    Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
    ActivityResourceBundlePlugin(org.exoplatform.container.xml.InitParams initParams)
    Constructor for getting activityType, activityKeyTypeMapping, and resourceBundleKeyFile from init params.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets 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.
    boolean
    hasMessageBundleKey(String activityTitleId)
    Checks if this activity resource bundle plugin contains a specific activity titleId.
    boolean
    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.
    void
    Sets the associated activity key type mapping from this activity resource bundle plugin.
    void
    setActivityType(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public String getActivityType()
      Gets the associated activity type from this activity resource bundle plugin.
      Returns:
      the associated activity type.
    • setActivityType

      public void setActivityType(String activityType)
      Sets the associated activity type from this activity resource bundle plugin.
      Parameters:
      activityType - the associated activity type.
    • getActivityKeyTypeMapping

      public Map<String,String> getActivityKeyTypeMapping()
      Gets the associated activity key type mapping from this activity resource bundle plugin.
      Returns:
    • setActivityKeyTypeMapping

      public void setActivityKeyTypeMapping(Map<String,String> mapping)
      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

      public String getResourceBundleKeyFile()
      Gets the associated resource bundle key file for getting resource bundle via ResourceBundleService.
      Returns:
      the associated resource bundle key file.
    • hasMessageBundleKey

      public boolean hasMessageBundleKey(String activityTitleId)
      Checks if this activity resource bundle plugin contains a specific activity titleId.
      Parameters:
      activityTitleId - the activity's titleId.
      Returns:
      a boolean value
    • getMessageBundleKey

      public String getMessageBundleKey(String activityTitleId)
      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.