You should have an idea about UI Extension Framework. If you have already worked with UI Extension Framework, it's really easy to create activity plugin. If no, you have chance to work with it now. You should have a look at UI Extension Framework.

When an activity is displayed, UIActivityFactory will look for its registered custom actvity display by activity's type. If not found, UIDefaultActivity will be called for displaying that activity.

For example, in eXo Social, there is an activity of type "exosocial:spaces" created by SpaceActivityPublisher, but now, you want to display it without own UI component instead of the default one. To do that, follow these steps.

First of all, create a sample project:

mvn archetype:generate
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking for updates from central
[INFO] snapshot org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-6-SNAPSHOT: checking for updates from central
[INFO] snapshot org.apache.maven.archetype:maven-archetype:2.0-alpha-6-SNAPSHOT: checking for updates from central
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] snapshot org.apache.maven.archetype:archetype-common:2.0-alpha-6-SNAPSHOT: checking for updates from central
[INFO] snapshot org.apache.maven.archetype:archetype-common:2.0-alpha-6-SNAPSHOT: checking for updates from apache.snapshots
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> docbkx-quickstart-archetype (null)
2: remote -> gquery-archetype (null)
3: remote -> gquery-plugin-archetype (null)
//....

285: remote -> wicket-scala-archetype (Basic setup for a project that combines Scala and Wicket, 
		depending on the Wicket-Scala project. Includes an example Specs 
		test.)
286: remote -> circumflex-archetype (null)
Choose a number: 76: 76
Choose version: 
1: 1.0
2: 1.0-alpha-1
3: 1.0-alpha-2
4: 1.0-alpha-3
5: 1.0-alpha-4
6: 1.1
Choose a number: : 1
Define value for property 'groupId': : org.exoplatform.social.samples
Define value for property 'artifactId': : exo.social.samples.activity-plugin
Define value for property 'version': 1.0-SNAPSHOT: 1.0.0-SNAPSHOT
Define value for property 'package': org.exoplatform.social.samples: org.exoplatform.social.samples.activityPlugin
Confirm properties configuration:
groupId: org.exoplatform.social.samples
artifactId: exo.social.samples.activity-plugin
version: 1.0.0-SNAPSHOT
package: org.exoplatform.social.samples.activityPlugin
Y: y

Edit the pom.xml file as following. You'll work with Social latest major release: 1.1 as follows:



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.exoplatform.social</groupId>
    <artifactId>social-project</artifactId>
    <version>1.1.0-GA</version>
  </parent>

  <groupId>org.exoplatform.social.samples</groupId>
  <artifactId>exo.social.samples.activity-plugin</artifactId>
  <packaging>jar</packaging>
  <version>1.1.0-GA</version>

  <name>exo.social.samples.activity-plugin</name>

  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <outputDirectory>target/classes</outputDirectory>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.gtmpl</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.xml</include>
        </includes>
      </resource>
    </resources>
  </build>

  <dependencies>

    <dependency>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.webui.core</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.webui.portal</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.exoplatform.social</groupId>
      <artifactId>exo.social.component.core</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.exoplatform.social</groupId>
      <artifactId>exo.social.component.webui</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.exoplatform.social</groupId>
      <artifactId>exo.social.component.service</artifactId>
      <scope>provided</scope>
    </dependency>

  </dependencies>

</project>

To use custom UI component for displaying its activity, you need a class that must be a subclass of BaseUIActivity. Let's call this UISpaceSimpleActivity:



package org.exoplatform.social.samples.activityplugin;
import org.exoplatform.social.webui.activity.BaseUIActivity;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
@ComponentConfig(
  lifecycle = UIFormLifecycle.class,
  template = "classpath:groovy/social/plugin/space/UISpaceSimpleActivity.gtmpl"
)
public class UISpaceSimpleActivity extends BaseUIActivity {
}

The template UISpaceSimpleActivity.gtmpl should be created under main/resources/groovy/social/plugin/space:

<div>This is a space activity UI component displayed for type "exosocial:spaces"</div>

An activity builder as explained later is also needed.



package org.exoplatform.social.samples.activityplugin;
import org.exoplatform.social.core.activity.model.Activity;
import org.exoplatform.social.webui.activity.BaseUIActivity;
import org.exoplatform.social.webui.activity.BaseUIActivityBuilder;
public class SimpleSpaceUIActivityBuilder extends BaseUIActivityBuilder {
  @Override
  protected void extendUIActivity(BaseUIActivity uiActivity, Activity activity) {
    // TODO Auto-generated method stub
  }
}

Now create configuration.xml under conf/portal:



<configuration xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
  <external-component-plugins>
    <target-component>org.exoplatform.webui.ext.UIExtensionManager</target-component>
    <component-plugin>
      <name>add.action</name>
      <set-method>registerUIExtensionPlugin</set-method>
      <type>org.exoplatform.webui.ext.UIExtensionPlugin</type>
      <init-params>
        <object-param>
          <name>Simple Space Activity</name>
          <object type="org.exoplatform.social.webui.activity.UIActivityExtension">
            <field name="type"><string>org.exoplatform.social.webui.activity.BaseUIActivity</string></field>
            <field name="name"><string>exosocial:spaces</string></field>
            <field name="component"><string>org.exoplatform.social.samples.activityplugin.UISpaceSimpleActivity</string></field>
            <field name="activityBuiderClass"><string>org.exoplatform.social.samples.activityplugin.SimpleSpaceUIActivityBuilder</string></field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
</configuration>

Note that exosocial:spaces must have its value matching the activity's type that you want to display with your UI component.

Assume that you have already built the Social project with version 1.1. If you don't know how to, have a look at Building from Sources with Social 1.1.0-CR01. Next, build a sample project and copy the jar file to /tomcat/lib. Then, run Social, create a space and access it, you can see

the space's activity of type "exosocial:spaces" is displayed by default in Social:

The custom UI component for displaying activity of type "exosocial:spaces" is like below:

Make the custom UI activity display have the look, feel and function like the default one.

When displaying an activity, you should make sure that the look and feel of the custom UI component is consistent and match with other activities and have the full functions of Like, Comments. You're going to create another UI component to display, let's call it: UISpaceLookAndFeelActivity:



package org.exoplatform.social.samples.activityplugin;
import org.exoplatform.social.webui.activity.BaseUIActivity;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
@ComponentConfig(
  lifecycle = UIFormLifecycle.class,
  template = "classpath:groovy/social/plugin/space/UISpaceLookAndFeelActivity.gtmpl",
  events = {
    @EventConfig(listeners = BaseUIActivity.ToggleDisplayLikesActionListener.class),
    @EventConfig(listeners = BaseUIActivity.ToggleDisplayCommentFormActionListener.class),
    @EventConfig(listeners = BaseUIActivity.LikeActivityActionListener.class),
    @EventConfig(listeners = BaseUIActivity.SetCommentListStatusActionListener.class),
    @EventConfig(listeners = BaseUIActivity.PostCommentActionListener.class),
    @EventConfig(listeners = BaseUIActivity.DeleteActivityActionListener.class, confirm = "UIActivity.msg.Are_You_Sure_To_Delete_This_Activity"),
    @EventConfig(listeners = BaseUIActivity.DeleteCommentActionListener.class, confirm = "UIActivity.msg.Are_You_Sure_To_Delete_This_Comment")
  }
)
public class UISpaceLookAndFeelActivity extends BaseUIActivity {
}

Now create UISpaceLookAndFeelActivity template. The easiest way is to copy the content of UIDefaultActivity.gtmpl to this template file:



<%
  import org.exoplatform.portal.webui.util.Util;
  import org.exoplatform.webui.form.UIFormTextAreaInput;
  def pcontext = Util.getPortalRequestContext();
  def jsManager = pcontext.getJavascriptManager();
  def labelActivityHasBeenDeleted = _ctx.appRes("UIActivity.label.Activity_Has_Been_Deleted");
  def activity = uicomponent.getActivity();
  def activityDeletable = uicomponent.isActivityDeletable();
%>
<% if (activity) { //process if not null
  jsManager.importJavascript("eXo.social.Util", "/social-resources/javascript");
  jsManager.importJavascript("eXo.social.PortalHttpRequest", "/social-resources/javascript");
  jsManager.importJavascript("eXo.social.webui.UIForm", "/social-resources/javascript");
  jsManager.importJavascript("eXo.social.webui.UIActivity", "/social-resources/javascript");
  def labelComment = _ctx.appRes("UIActivity.label.Comment");
  def labelLike = _ctx.appRes("UIActivity.label.Like");
  def labelUnlike = _ctx.appRes("UIActivity.label.Unlike");
  def labelSource = _ctx.appRes("UIActivity.label.Source");
  def inputWriteAComment = _ctx.appRes("UIActivity.input.Write_A_Comment");
  def labelShowAllComments = _ctx.appRes("UIActivity.label.Show_All_Comments");
  def labelHideAllComments = _ctx.appRes("UIActivity.label.Hide_All_Comments");
  def labelOnePersonLikeThis = _ctx.appRes("UIActivity.label.One_Person_Like_This");
  def labelPeopleLikeThis = _ctx.appRes("UIActivity.label.People_Like_This");
  def labelYouLikeThis = _ctx.appRes("UIActivity.label.You_Like_This");
  def labelYouAndOnePersonLikeThis = _ctx.appRes("UIActivity.label.You_And_One_Person_Like_This");
  def labelYouAndPeopleLikeThis = _ctx.appRes("UIActivity.label.You_And_People_Like_This");
  def likeActivityAction = uicomponent.event("LikeActivity", "true");
  def unlikeActivityAction = uicomponent.event("LikeActivity", "false");
  def commentList = uicomponent.getComments();
  def allComments = uicomponent.getAllComments();
  if (allComments) {
    labelShowAllComments = labelShowAllComments.replace("{0}", allComments.size() + "");
    labelHideAllComments = labelHideAllComments.replace("{0}", allComments.size() + "");
  }
  def displayedIdentityLikes = uicomponent.getDisplayedIdentityLikes();
  def identityLikesNum = 0;
  def labelLikes = null;
  def toggleDisplayLikesAction = uicomponent.event("ToggleDisplayLikes");
  def startTag = "<a onclick={{{"}}}$toggleDisplayLikesAction{{{"}}} id={{{"}}}ToggleDisplayListPeopleLikes${activity.id}{{{"}}} href={{{"}}}#ToggleDisplayListPeopleLikes{{{"}}}>";
  def endTag = "</a>";
  if (displayedIdentityLikes != null) {
    identityLikesNum = displayedIdentityLikes.length;
  }
  def commentListStatus = uicomponent.getCommentListStatus();
  def commentFormDisplayed = uicomponent.isCommentFormDisplayed();
  def likesDisplayed = uicomponent.isLikesDisplayed();
  //params for init UIActivity javascript object
  def params = """
    {activityId: '${activity.id}',
     inputWriteAComment: '$inputWriteAComment',
     commentMinCharactersAllowed: ${uicomponent.getCommentMinCharactersAllowed()},
     commentMaxCharactersAllowed: ${uicomponent.getCommentMaxCharactersAllowed()},
     commentFormDisplayed: $commentFormDisplayed,
     commentFormFocused: ${uicomponent.isCommentFormFocused()}
    }
  """
  jsManager.addOnLoadJavascript("initUIActivity${activity.id}");
  //make sures commentFormFocused is set to false to prevent any refresh to focus, only focus after post a comment
  uicomponent.setCommentFormFocused(false);
  def activityUserName, activityUserProfileUri, activityImageSource, activityContentBody, activityPostedTime;
  def commentFormBlockClass = "", listPeopleLikeBlockClass = "", listPeopleBGClass = "";
  if (!commentFormDisplayed) {
    commentFormBlockClass = "DisplayNone";
  }
  if (!likesDisplayed) {
    listPeopleLikeBlockClass = "DisplayNone";
  }
  if (uicomponent.isLiked()) {
    if (identityLikesNum > 1) {
      labelLikes = labelYouAndPeopleLikeThis.replace("{start}", startTag).replace("{end}", endTag).replace("{0}", identityLikesNum + "");
    } else if (identityLikesNum == 1) {
      labelLikes = labelYouAndOnePersonLikeThis.replace("{start}", startTag).replace("{end}", endTag);
    } else {
      labelLikes = labelYouLikeThis;
    }
  } else {
    if (identityLikesNum > 1) {
        labelLikes = labelPeopleLikeThis.replace("{start}", startTag).replace("{end}", endTag).replace("{0}", identityLikesNum + "");
    } else if (identityLikesNum == 1) {
        labelLikes = labelOnePersonLikeThis.replace("{start}", startTag).replace("{end}", endTag);
    }
  }
  if (!labelLikes) {
   //hides diplayPeopleBG
   listPeopleBGClass = "DisplayNone";
  }
  activityContentTitle = activity.title;
  activityPostedTime = uicomponent.getPostedTimeString(activity.postedTime);
  activityUserName = uicomponent.getUserFullName(activity.userId);
  activityUserProfileUri = uicomponent.getUserProfileUri(activity.userId);
  activityImageSource = uicomponent.getUserAvatarImageSource(activity.userId);
  if (!activityImageSource)  {
    activityImageSource = "/social-resources/skin/ShareImages/SpaceImages/SpaceLogoDefault_61x61.gif";
  }
%>
<div class="UIActivity">
  <script type="text/javascript">
    function initUIActivity${activity.id}() {
      new eXo.social.webui.UIActivity($params);
    }
  </script>
  <% uiform.begin() %>
  <div class="NormalBox clearfix">
    <class="Avatar" title="$activityUserName" href="$activityUserProfileUri">
      <img title="$activityUserName" src="$activityImageSource" alt="$activityUserName" height="54px" width="56px">
    </a>
    <div class="ContentBox" id="ContextBox${activity.id}">
      <div class="TitleContent clearfix">
        <div class="Text">
          <a title="$activityUserName" href="$activityUserProfileUri">$activityUserName</a>
        </div>
      <% if (activityDeletable) {%>
        <div onclick="<%= uicomponent.event("DeleteActivity", uicomponent.getId(), ""); %>" class="CloseContentBoxNormal" id="DeleteActivityButton${activity.id}"><span></span></div>
      <%}%>
      </div>
      <div class="Content">
        $activityContentTitle (from custom UI component)<br>
      </div>
      <div class="LinkCM">
        <span class="DateTime">$activityPostedTime *</span>
      <% def toggleDisplayCommentAction = uicomponent.event('ToggleDisplayCommentForm', null, false);
         def commentLink = "";
      %>
        <class="LinkCM $commentLink" onclick="$toggleDisplayCommentAction" id="CommentLink${activity.id}" href="#comment">
          $labelComment
        </a> |
      <% if (uicomponent.isLiked()) { %>
        <a onclick="$unlikeActivityAction" class="LinkCM" id="UnLikeLink${activity.id}" href="#unlike">
          $labelUnlike
        </a>
      <% } else { %>
        <a onclick="$likeActivityAction" class="LinkCM" id="LikeLink${activity.id}" href="#like">
          $labelLike
        </a>
      <% }%>
      </div>
    </div>
    <div class="ListPeopleLikeBG $listPeopleBGClass">
      <div class="ListPeopleLike">
        <div class="ListPeopleContent">
        <% if (!labelLikes) labelLikes = ""; %>
          <div class="Title">$labelLikes</div>
          <div class="$listPeopleLikeBlockClass">
          <%
          //def personLikeFullName, personLikeProfileUri, personLikeAvatarImageSource;
          displayedIdentityLikes.each({
            personLikeFullName = uicomponent.getUserFullName(it);
            personLikeProfileUri = uicomponent.getUserProfileUri(it);
            personLikeAvatarImageSource = uicomponent.getUserAvatarImageSource(it);
            if (!personLikeAvatarImageSource) {
              personLikeAvatarImageSource = "/social-resources/skin/ShareImages/activity/AvatarPeople.gif";
            }
            %>
              <class="AvatarPeopleBG" title="$personLikeFullName" href="$personLikeProfileUri">
                <img width="47px" height="47px" src="$personLikeAvatarImageSource" alt="$personLikeFullName" title="$personLikeFullName" />
              </a>
           <% })%>
          </div>
          <div class="ClearLeft">
            <span></span>
          </div>
        </div>
      </div>
    </div>
    <div class="CommentListInfo">
    <% if (uicomponent.commentListToggleable()) {
    def showAllCommentsAction = uicomponent.event("SetCommentListStatus", "all");
    def hideAllCommentsAction = uicomponent.event("SetCommentListStatus", "none");
    %>
      <div class="CommentBlock">
        <div class="CommentContent">
          <div class="CommentBorder">
          <% if (commentListStatus.getStatus().equals("latest") || commentListStatus.getStatus().equals("none")) { %>
            <a onclick="$showAllCommentsAction" href="#show-all-comments">
              $labelShowAllComments
            </a>
          <% } else if (commentListStatus.getStatus().equals("all")) { %>
            <a onclick="$hideAllCommentsAction" href="#hide-all-comments">
              $labelHideAllComments
            </a>
          <% } %>
          </div>
        </div>
      </div>
    <% } %>
    </div>
  <% if (allComments.size() > 0) { %>
    <div class="DownIconCM"><span></span></div>
  <% }%>
  <%
  def commenterFullName, commenterProfileUri, commenterImageSource, commentMessage, commentPostedTime;
  def first = true, commentContentClass;
  commentList.each({
    if (first & !uicomponent.commentListToggleable()) {
      commentContentClass = "CommentContent";
      first = false;
    } else {
      commentContentClass = "";
    }
    commenterFullName = uicomponent.getUserFullName(it.userId);
    commenterProfileUri = uicomponent.getUserProfileUri(it.userId);
    commenterImageSource = uicomponent.getUserAvatarImageSource(it.userId);
    if (!commenterImageSource) {
      commenterImageSource = "/social-resources/skin/ShareImages/activity/AvatarPeople.gif";
    }
    commentMessage = it.title;
    commentPostedTime = uicomponent.getPostedTimeString(it.postedTime);
  %>
    <div id="CommentBlock${activity.id}" class="CommentBox clearfix">
      <class="AvatarCM" title="$commenterFullName" href="$commenterProfileUri">
        <img src="$commenterImageSource" alt="$commenterFullName" height="36px" width="38px">
      </a>
      <div class="ContentBox">
        <div class="Content">
          <a href="$commenterProfileUri"><span class="Commenter">$commenterFullName<span></a><br />
            $commentMessage
          <br/>
        </div>
        <div class="LinkCM">
          <span class="DateTime">$commentPostedTime</span>
        </div>
      </div>
    <%
      if (uicomponent.isCommentDeletable(it.userId)) {
    %>
      <div onclick="<%= uicomponent.event("DeleteComment", uicomponent.id, it.id); %>" class="CloseCMContentHilight"><span></span></div>
    <% } %>
    </div>
  <% }) %>
    <div class="CommentBox $commentFormBlockClass clearfix" id="CommentFormBlock${activity.id}">
      <% uicomponent.renderChild(UIFormTextAreaInput.class); %>
      <input type="button" onclick="<%= uicomponent.event("PostComment") %>" value="$labelComment" class="CommentButton DisplayNone" id="CommentButton${activity.id}" />
    </div>
  </div>
  <% uiform.end() %>
</div>
<% } else { %> <!-- activity deleted -->
<div class="UIActivity Deleted">$labelActivityHasBeenDeleted</div>
<% }%>

And you should make needed modifications for this template:



<div class="Content">
  $activityContentTitle (from custom UI component)<br>
</div>

Now, you need to reconfigure the configuration.xml file:



<configuration xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
  <external-component-plugins>
    <target-component>org.exoplatform.webui.ext.UIExtensionManager</target-component>
    <component-plugin>
      <name>add.action</name>
      <set-method>registerUIExtensionPlugin</set-method>
      <type>org.exoplatform.webui.ext.UIExtensionPlugin</type>
      <init-params>
        <object-param>
          <name>Look And Feel Space Activity</name>
          <object type="org.exoplatform.social.webui.activity.UIActivityExtension">
            <field name="type"><string>org.exoplatform.social.webui.activity.BaseUIActivity</string></field>
            <field name="name"><string>exosocial:spaces</string></field>
            <field name="component"><string>org.exoplatform.social.samples.activityplugin.UISpaceLookAndFeelActivity</string></field>
            <field name="activityBuiderClass"><string>org.exoplatform.social.samples.activityplugin.SimpleSpaceUIActivityBuilder</string></field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
</configuration>

Rebuild the sample project, copy jar to tomcat/lib. Re-run server and see the result:

Note

Currently, you have to copy and paste in template file. By this way, you have full control of the UI but it is not a good way when there are changes in UIDefaultActivity. This will be improved soon so that no copy and paste needed.

The UIActivityComposer is an extended class of UIContainer that is used to display inputs for users to create their own activities. To write your own activity composer, it is recommended that you use the UIActivityComposer available in eXo Social.

For example, to create an input component for inserting video links into your activity, do the following steps:

1. Write UIVideoActivityComposer which extends UIActivityComposer. The UIActivityComposer allows you to input extended activities (for example, adding videos, links or documents) on the UI composer.



package org.exoplatform.social.plugin.videolink;
import org.exoplatform.social.plugin.videolink.util.VideoEmbedTool;
@ComponentConfig(
        template = "classpath:groovy/social/plugin/videolink/UIVideoActivityComposer.gtmpl",
        events = {
                @EventConfig(listeners = UIVideoActivityComposer.SearchVideo.class),
                @EventConfig(listeners = UIVideoActivityComposer.SelectVideoFromResultList.class),
                @EventConfig(listeners = UIVideoActivityComposer.AttachActionListener.class),
                @EventConfig(listeners = UIVideoActivityComposer.ChangeLinkContentActionListener.class),
                @EventConfig(listeners = UIActivityComposer.CloseActionListener.class),
                @EventConfig(listeners = UIActivityComposer.SubmitContentActionListener.class),
                @EventConfig(listeners = UIActivityComposer.ActivateActionListener.class)
        }
)
public class UIVideoActivityComposer extends UIActivityComposer {
  public static final String LINK_PARAM = "link";
  public static final String IMAGE_PARAM = "image";
  public static final String TITLE_PARAM = "title";
  public static final String HTML_PARAM = "htmlembed";
  public static final String COMMENT_PARAM = "comment";
  private static final String HTTP = "http://";
  private static final String HTTPS = "https://";
  private JSONObject videoJson;
  private boolean linkInfoDisplayed_ = false;
  private Map<String, String> templateParams;
  /**
   * The constructor.
   */
  public UIVideoActivityComposer() {
    setReadyForPostingActivity(false);
    addChild(new UIFormStringInput("InputLink", "InputLink", null));
  }
  /**
   * Set the link info to be displayed.
   *
   * @param displayed
   */
  public void setLinkInfoDisplayed(boolean displayed) {
    linkInfoDisplayed_ = displayed;
  }
  
  /**
   * Set the template params.
   *
   * @param templateParams
   */
  public void setTemplateParams(Map<String, String> templateParams) {
    this.templateParams = templateParams;
  }
  /**
   * Get the template params.
   */
  public Map<String, String> getTemplateParams() {
    return templateParams;
  }
  
  /**
   * Clear the video json.
   */
  public void clearVideoJson() {
    videoJson = null;
  }
  /**
   * Get the video json.
   */
  public JSONObject getVideoJson() {
    return videoJson;
  }
  /**
   * Set the link.
   
   * @param url
   * @throws Exception
   */
  private void setLink(String url) throws Exception {
    if (!(url.contains(HTTP) || url.contains(HTTPS))) {
      url = HTTP + url;
    }
    videoJson = VideoEmbedTool.getoembedData(url);
    templateParams = new HashMap<String, String>();
    templateParams.put(LINK_PARAM, url);
    templateParams.put(TITLE_PARAM, videoJson.getString(VideoEmbedTool.OEMBED_TITLE));
    templateParams.put(HTML_PARAM, videoJson.getString(VideoEmbedTool.OEMBED_HTML));
    setLinkInfoDisplayed(true);
  }
  static public class AttachActionListener extends EventListener<UIVideoActivityComposer> {
    @Override
    public void execute(Event<UIVideoActivityComposer> event) throws Exception {
      WebuiRequestContext requestContext = event.getRequestContext();
      UIVideoActivityComposer uiComposerLinkExtension = event.getSource();
      String url = requestContext.getRequestParameter(OBJECTID);
      try {
        uiComposerLinkExtension.setLink(url.trim());
      } catch (Exception e) {
        uiComposerLinkExtension.setReadyForPostingActivity(false);
        return;
      }
      requestContext.addUIComponentToUpdateByAjax(uiComposerLinkExtension);
      event.getSource().setReadyForPostingActivity(true);
    }
  }
  static public class ChangeLinkContentActionListener extends EventListener<UIVideoActivityComposer> {
    @Override
    public void execute(Event<UIVideoActivityComposer> event) throws Exception {
      WebuiRequestContext requestContext = event.getRequestContext();
      UIVideoActivityComposer uiComposerLinkExtension = event.getSource();
      
      Map<String, String> tempParams = new HashMap<String, String>();
      
      uiComposerLinkExtension.setTemplateParams(tempParams);
      requestContext.addUIComponentToUpdateByAjax(uiComposerLinkExtension);
      UIComponent uiParent = uiComposerLinkExtension.getParent();
      if (uiParent != null) {
        uiParent.broadcast(event, event.getExecutionPhase());
      }
    }
  }
  public static class SelectVideoFromResultList extends EventListener<UIVideoActivityComposer>{
    @Override
    public void execute(Event<UIVideoActivityComposer> event) throws Exception {
      WebuiRequestContext requestContext = event.getRequestContext();
      UIVideoActivityComposer uiComposerLinkExtension = event.getSource();
    }
  }
  public static class SearchVideo extends EventListener<UIVideoActivityComposer>{
    @Override
    public void execute(Event<UIVideoActivityComposer> event) throws Exception {
      WebuiRequestContext requestContext = event.getRequestContext();
      UIVideoActivityComposer uiComposerLinkExtension = event.getSource();
    }
  }
  @Override
  public void onPostActivity(PostContext postContext, UIComponent source,
                             WebuiRequestContext requestContext, String postedMessage) throws Exception {
                             
    templateParams.put(COMMENT_PARAM, postedMessage);
    setTemplateParams(templateParams);
    if (templateParams.size() == 0) {
      uiApplication.addMessage(new ApplicationMessage("UIComposer.msg.error.Empty_Message",
              null,
              ApplicationMessage.WARNING));
      return;
    }
    String title = "Shared a video: <a href={{{"}}}${" + LINK_PARAM + "}{{{"}}}>${" + TITLE_PARAM + "} </a>";
    ExoSocialActivity activity = new ExoSocialActivityImpl(userIdentity.getId(),
            UIVideoActivity.ACTIVITY_TYPE,
            title,
            null);
    activity.setTemplateParams(templateParams);
    if (postContext == UIComposer.PostContext.SPACE) {
    
      UIActivitiesContainer activitiesContainer = uiDisplaySpaceActivities.getActivitiesLoader().getActivitiesContainer();
      activitiesContainer.addActivity(activity);
      requestContext.addUIComponentToUpdateByAjax(activitiesContainer);
      requestContext.addUIComponentToUpdateByAjax(uiComposer);
    } else if (postContext == PostContext.USER) {
      UIUserActivitiesDisplay uiUserActivitiesDisplay = (UIUserActivitiesDisplay) getActivityDisplay();
      String ownerName = uiUserActivitiesDisplay.getOwnerName();
      Identity ownerIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,
              ownerName, false);
      activityManager.saveActivity(ownerIdentity, activity);
      if (uiUserActivitiesDisplay.getSelectedDisplayMode() == UIUserActivitiesDisplay.DisplayMode.MY_STATUS) {
        UIActivitiesContainer activitiesContainer = uiUserActivitiesDisplay.getActivitiesLoader().getActivitiesContainer();
        if (activitiesContainer.getChildren().size() == 1) {
          uiUserActivitiesDisplay.setSelectedDisplayMode(UIUserActivitiesDisplay.DisplayMode.MY_STATUS);
        } else {
          activitiesContainer.addActivity(activity);
          requestContext.addUIComponentToUpdateByAjax(activitiesContainer);
          requestContext.addUIComponentToUpdateByAjax(uiComposer);
        }
      } else{
        uiUserActivitiesDisplay.setSelectedDisplayMode(UIUserActivitiesDisplay.DisplayMode.MY_STATUS);
      }
    }
  }
}

2. Use the BaseUIActivity class to write and customize the UIActivity display as below:



package org.exoplatform.social.plugin.videolink;
import org.exoplatform.social.webui.activity.BaseUIActivity;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.config.annotation.EventConfig;
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "classpath:groovy/social/plugin/videolink/UIVideoActivity.gtmpl", events = {
  @EventConfig(listeners = BaseUIActivity.ToggleDisplayLikesActionListener.class),
  @EventConfig(listeners = BaseUIActivity.ToggleDisplayCommentFormActionListener.class),
  @EventConfig(listeners = BaseUIActivity.LikeActivityActionListener.class),
  @EventConfig(listeners = BaseUIActivity.SetCommentListStatusActionListener.class),
  @EventConfig(listeners = BaseUIActivity.PostCommentActionListener.class),
  @EventConfig(listeners = BaseUIActivity.DeleteActivityActionListener.class, confirm = "UIActivity.msg.Are_You_Sure_To_Delete_This_Activity"),
  @EventConfig(listeners = BaseUIActivity.DeleteCommentActionListener.class, confirm = "UIActivity.msg.Are_You_Sure_To_Delete_This_Comment")
 }
)
public class UIVideoActivity extends BaseUIActivity {
  public static final String ACTIVITY_TYPE = "VIDEO_ACTIVITY";
  private String linkSource = "";
  private String linkTitle = "";
  private String linkHTML = "";
  private String linkComment = "";
  
  /**
   * Get the link comment.
   */
  public String getLinkComment() {
    return linkComment;
  }
  
  /**
   * Set the link comment.
   *
   * @param linkComment
   */
  public void setLinkComment(String linkComment) {
    this.linkComment = linkComment;
  }
  
  /**
   * Get the link html.
   */
  public String getLinkHTML() {
    return linkHTML;
  }
  
  /**
   * Set the link html.
   *
   * @param linkHTML
   */
  public void setLinkHTML(String linkHTML) {
    this.linkHTML = linkHTML;
  }
  
  /**
   * Get the link source.
   */
  public String getLinkSource() {
    return linkSource;
  }
  
  /**
   * Set the link source.
   *
   * @param linkSource
   */
  public void setLinkSource(String linkSource) {
    this.linkSource = linkSource;
  }
  
  /**
   * Get the link title.
   */
  public String getLinkTitle() {
    return linkTitle;
  }
  
  /**
   * Set the link title.
   *
   * @param linkTitle
   */
  public void setLinkTitle(String linkTitle) {
    this.linkTitle = linkTitle;
  }
}

3. Use the UIVideoActivityBuilder class to get values of ExoSocialActivity that are set to UIVideoActivity for displaying.

Method Param Return Description
saveActivity(Identity owner, ExoSocialActivity activity) throws ActivityStorageException owner - the owner of activity stream, activity - the activity which needs to be saved ExoSocialActivity Save an activity to the stream of an owner. Note that the Activity.userId will be set to the owner's identity if it has not been already set.
getActivity(String activityId) throws ActivityStorageException activityId - the id of activity ExoSocialActivity Get an activity by its id.
deleteActivity(String activityId) throws ActivityStorageException activityId - the id of activity void Delete an activity by its id.
deleteActivity(ExoSocialActivity activity) throws ActivityStorageException activity void Delete a stored activity (id != null). (Since 1.1.1).
deleteComment(String activityId, String commentId) throws ActivityStorageException activityId - the id of activity, commentId - the id of comment void Delete a comment by its id.
getActivities(Identity identity) throws ActivityStorageException identity List<ExoSocialActivity> Get the latest activities by an identity with the default limit of 20 latest activities.
getActivities(Identity identity, long start, long limit) throws ActivityStorageException identity, start , limit List<ExoSocialActivity> Get the latest activities by an identity, specifying start that is an offset index and limit.
getActivitiesOfConnections(Identity ownerIdentity) throws ActivityStorageException ownerIdentity List<ExoSocialActivity> Get activities of connections from an identity. The activities are returned as a list that is sorted descending by activity posted time. (Since 1.1.1).
getActivitiesOfConnections(Identity ownerIdentity, int offset, int limit) throws ActivityStorageException; ownerIdentity, offset, limit List<ExoSocialActivity>Get the activities of connections from an identity by specifying offset and limit. The activities are returned as a list that is sorted starting from the most recent activity.(Since 1.2.0-GA).
getActivitiesOfUserSpaces(Identity ownerIdentity) ownerIdentity List<ExoSocialActivity> Get the activities from all spaces of a user. By default, the activity list is composed of all spaces' activities. Each activity list of the space contains maximum 20 activities and are sorted by time. (Since 1.1.1).
getActivityFeed(Identity identity) throws ActivityStorageException identity List<ExoSocialActivity> Get the activity feed of an identity. This feed is the combination of all the activities of his own activities, his connections' activities and spaces' activities which are returned as a list that is sorted starting from the most recent activity.(Since 1.1.2).
saveActivity(ExoSocialActivity activity) throws ActivityStorageException activity - the activity to saveExoSocialActivity Save an activity into the stream for the activity's userId. The userId must be set and this field is used to indicate the owner stream.
saveComment(ExoSocialActivity activity, ExoSocialActivity comment) throws ActivityStorageException activity, comment void Save a new comment or updates an existing comment that is an instance of activity with mandatory fields: userId, title.
saveLike(ExoSocialActivity activity, Identity identity) throws ActivityStorageException activity, identity voidSave an identity who likes an activity.
removeLike(ExoSocialActivity activity, Identity identity) throws ActivityStorageException activity, identity - a user who dislikes an activity voidRemove an indentity who likes an activity, if this activity is liked, it will be removed.
getComments(ExoSocialActivity activity) throws ActivityStorageException activity List<ExoSocialActivity> Get the comment list of an activity.
recordActivity(Identity owner, String type, String title) throws ActivityStorageException owner, type, title ExoSocialActivity Record an activity. (Since 1.2.0-GA).
recordActivity(Identity owner, ExoSocialActivity activity) throws Exception owner, activity ExoSocialActivity Save an activity. You should use ActivityManager#saveActivity(org.exoplatform.social.core.identity.model.Identity, org.exoplatform.social.core.activity.model.ExoSocialActivity) instead. It will be removed in eXo Social 1.3.x.
recordActivity(Identity owner, String type, String title, String body) throws ActivityStorageException owner - the owner of the target stream for this activity, type - the type of an activity which will be used to render a custom UI, title - the title, body - the body ExoSocialActivity Records an activity.
addProcessor(ActivityProcessor processor) processor voidAdd a new processor.
addProcessorPlugin(BaseActivityProcessorPlugin plugin) plugin voidAdd a new processor plugin.
getActivitiesCount(Identity owner) throws ActivityStorageException owner intGet the number of activities from a stream owner.
processActivitiy(ExoSocialActivity activity) activity voidPass an activity through the chain of processors.
Method Param Return Description
registerIdentityProviders(IdentityProviderPlugin plugin) plugin void Register one or more IdentityProvider through an IdentityProviderPlugin.
getIdentity(String id) id can be a social GlobalId or a raw identity such as in Identity.getId() Identity - null if nothing is found, or the Identity object Get the identity by ID and loads his profile.
getIdentity(String id, boolean loadProfile) id can be a social GlobalId or a raw identity such as in Identity.getId(), loadProfile - the value is true if the profile is loaded and false if not loaded null if nothing is found, or the Identity object Get the identity by loading id of the profile optionally.
deleteIdentity(Identity identity) identiy voidDelete an identity.
addIdentityProvider(IdentityProvider<?> idProvider) idProvider - the id of provider void Add the identity provider.
getOrCreateIdentity(String providerId, String remoteId) providerId - the id of provider, remoteId - the remote id Identity Get the identity by remoteId. If the provider can not find any identity by remoteId, the return value is null. If no identity found by identity provider and that identity is still stored on JCR, that stored identity will be deleted and the return value is null.
getOrCreateIdentity(String providerId, String remoteId, boolean loadProfile) providerId - referring to the name of the Identity provider, remoteId - the identifier that identify the identity in the specific identity provider, loadProfile - true when the profile is loaded null if nothing is found, or the Identity object improves the performance by specifying what needs to be loaded This function returns an Identity object that is specific to a special type. For example, if the type is Linked'In, the identifier will be the URL of profile or if it is a CS contact manager, it will be the UID of the contact. A new identity is created if it does not exist.
getIdentitiesByProfileFilter(String providerId, ProfileFilter profileFilter) throws Exception providerId - the id of provider, profileFilter - the filter of provider Identity Get the identities by a profile filter.
getIdentitiesByProfileFilter(String providerId, ProfileFilter profileFilter, long offset, long limit) throws Exception providerId, profileFilter, offset, limit List<Identity> Get the identities by a profile filter.
getIdentitiesByProfileFilter(ProfileFilter profileFilter) throws Exception profileFilter - the profile filter List<Identity> Get the identities by profile filter.
getIdentitiesByProfileFilter(ProfileFilter profileFilter, long offset, long limit) throws Exception providerId, profileFilter, offset, limit List<Identity> Get the identities by a profile filter.
getIdentitiesFilterByAlphaBet(String providerId, ProfileFilter profileFilter) throws Exception providerId - the id of provider, profileFilter - the profile filter List<Identity> Get the identities filter by alphabet.
getIdentitiesFilterByAlphaBet(String providerId, ProfileFilter profileFilter, long offset,long limit) throws Exception providerId, profileFilter, offset, limit List<Identity> Get the identities fileter by alphabet with offset and limit.
getIdentitiesFilterByAlphaBet(ProfileFilter profileFilter) throws Exception profileFilter - the profile filter List<Identity> Get the identities filter by alphabet.
getIdentity(String providerId, String remoteId, boolean loadProfile) providerId, remoteId, loadProfile Identity Get the identity.
getIdentitiesCount(String providerId) providerId long Get the number of indentities.
identityExisted(String providerId, String remoteId) providerId, remoteId boolean Check if the identity is already existed or not.
saveIdentity(Identity identity) identity - the identity void Save the identity.
saveProfile(Profile profile) profile void Save a profile.
addOrModifyProfileProperties(Profile profile) throws Exception profile void Add or modifies properties of profile. Profile parameter is a lightweight that contains only the property that you want to add or modify. NOTE: The method will not delete the properties of an old profile when the param profile does not have those keys.
updateAvatar(Profile p) profile void Update the avatar.
updateBasicInfo(Profile p) throws Exception profile void Update the basic infomation.
updateContactSection(Profile p) throws Exception profile void Update the contact section of the profile.
updateExperienceSection(Profile p)throws Exception profile void Update the experience section of the profile.
updateHeaderSection(Profile p) throws Exception profile void Update the header section of the profile.
getIdentities(String providerId) throws Exception providerId - the id of provider List<Identity> Get the identities by the provider id.
getIdentities(String providerId, boolean loadProfile) providerId - the id of provider, loadProfile - the loaded profile. List<Identity> Get the identities by the provider id. If loadProvider is true, loading the profie will be perfomed.
getConnections(Identity ownerIdentity) throws Exception ownerIdentity List<Identity> Get connections of an identity. (Since 1.1.1).
getIdentityStorage() N/A IdentityStorage Get the identity storage.
getStorage() N/A IdentityStorage Get the storage. Deprecated: should use method getIdentityStorage().
registerProfileListener(ProfileListener listener) listener void Register the profile listener.
unregisterProfileListener(ProfileListener listener) listener void Unregister the profile listener.
addProfileListener(ProfileListenerPlugin plugin) plugin void Register a profile listener component plug-in.
Method Param Return Description
getRelationshipById(String id) throws Exception id Relationship Get relationship the by id. You should use get(String) instead. It will be removed at 1.2.x
invite(Identity sender, Identity receiver) throws RelationshipStorageException sender receiver Relationship Create a connection invitation between two identities.
saveRelationship(Relationship relationship) throws RelationshipStorageException relationship - a relationship void Save a relationship.
confirm(Relationship relationship) throws RelationshipStorageException relationship - a pending relationship void Mark a relationship as confirmed.
deny(Relationship relationship) throws RelationshipStorageException relationship - a pending relationship void Deny a relationship.
remove(Relationship relationship) throws RelationshipStorageException relationship - a pending relationship void Remove a relationship.
ignore(Relationship relationship) throws RelationshipStorageException relationship - a pending relationship void Mark a relationship as ignored
getPendingRelationships(Identity sender) throws Exception sender - an identity List<Relationship> Get all the pending relationship of sender.
getPendingRelationships(Identity sender, List<Identity> identities) throws Exception sender - an identity, identities - a list of identity List<Relationship> Get pending relationships of sender that match with identities.
getRequireValidationRelationships(Identity receiver) throws Exception receiver - an identity List<Relationship> Get list of required validation relationship of receiver.
getRequireValidationRelationships(Identity receiver, List<Identity> identities) receiver - an identity, identities - a list of identity List<Relationship> Get list of required validation relationship of receiver that match with identities.
getConfirmedRelationships(Identity identity) identity - an identity List<Relationship> Get list of confirmed relationship of identity.
getConfirmedRelationships(Identity identity, List<Identity> identities) identity - an identity, identities - a list of identity List<Relationship> Get list of confirmed relationship of identity that match with identities.
getAllRelationships(Identity identity) identity - an identity List<Relationship> Return all the relationship of a given identity with other identity.
getAllRelationships(Identity identity, List<Identity> identities) identity - an identity, identities - a list of identity List<Relationship> Return all the relationship of a given identity with other identity in identities.
getAllRelationships(Identity identity) identity - an identity List<Relationship> Return all the relationship of a given identity with other identity.
getAllRelationships(Identity identity, Relationship.Type type, List<Identity> identities) identity - an identity, type - a Relationship.Type, identities - a list of identity <Relationship> Return all the relationship of a given identity with other identity in identities in type.  
getRelationship(Identity identity1, Identity identity2) identity1 and identity2 - identities Relationship Get the relationship of two identities.
Method Param Return Description
getSpaceByDisplayName(String spaceDisplayName) spaceDisplayName Space Get a space whose display name matches the string input. (Since 1.2.0-GA).
getSpaceByPrettyName(String spaceName) spaceName Space Get a space whose pretty name matches the string input. (Since 1.2.0-GA).
getSpaceByGroupId(String groupId) groupId Space Get a space that has group Id matching the string input.
getSpaceById(String spaceId) spaceId Space Get a space by its Id.
getSpaceByUrl(String spaceUrl) spaceUrl SpaceGet a space whose URL matches the string input.
getAllSpaces() N/A ListAccess<Space> Get a list of spaces with the type of a space list access. (Since 1.3.0-GA).
getAllSpacesWithListAccess() N/A ListAccess<Space>Get a list of spaces with the type of a space list access. (Since 1.2.0-GA).
getAllSpacesByFilter(SpaceFilter spaceFilter) spaceFilter ListAccess<Space> Get a list of spaces with the type of a space list access. These spaces matches the space filter. (Since 1.2.0-GA).
getMemberSpaces(String userId) userId ListAccess<Space> Get a list of spaces with the type of list access that contains all the spaces in which a user has the "member" role. (Since 1.2.0-GA).
getMemberSpacesByFilter(String userId, SpaceFilter spaceFilter) userId, spaceFilter ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains the spaces which a user has the "member" role and match the provided space filter. (Since 1.2.0-GA).
getAccessibleSpaces(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user has the access permission.(Since 1.3.0-GA).
getAccessibleSpacesWithListAccess(String userId) userId ListAccess<Space> Get a list of spaces with a space list access. The list contains all the spaces that a user has the access permission. (Since 1.2.0-GA).
getAccessibleSpacesByFilter(String userId, SpaceFilter spaceFilter) userId, spaceFilter ListAccess<Space>Get a list of spaces with the type of a space list access. The list contains all the spaces that a user has the access permission and match the provided space filter. (Since 1.2.0-GA).
getSettingableSpaces(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user has the setting permission. (Since 1.2.0-GA).
getSettingabledSpacesByFilter(String userId, SpaceFilter spaceFilter) userId, spaceFilter ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user has the setting permission and match the provided space filter. (Since 1.2.0-GA).
getInvitedSpaces(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user is invited to join. (Since 1.3.0-GA).
getInvitedSpacesWithListAccess(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user is invited to join. (Since 1.2.0-GA).
getInvitedSpacesByFilter(String userId, SpaceFilter spaceFilter) userId, spaceFilter ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user is invited to join and match the provided space filter. (Since 1.2.0-GA).
getPublicSpaces(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user can request to join. (Since 1.3.0-GA).
getPublicSpacesWithListAccess(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user can request to join. (Since 1.2.0-GA).
getPublicSpacesByFilter(String userId, SpaceFilter spaceFilter) userId, spaceFilter ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user can request to join and match the provided space filter. (Since 1.2.0-GA).
getPendingSpaces(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user sent join-request to a space. (Since 1.3.0-GA).
getPendingSpacesWithListAccess(String userId) userId ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user sent a request for joining a space. (Since 1.2.0-GA).
getPendingSpacesByFilter(String userId, SpaceFilter spaceFilter) userId, spaceFilter ListAccess<Space> Get a list of spaces with the type of a space list access. The list contains all the spaces that a user sent join-request to a space and match the provided space filter. (Since 1.2.0-GA).
createSpace(Space space, String creatorUserId) space, creatorUserId Space Create a new space: create a group, its group navigation with pages for installing space applications.
updateSpace(Space existingSpace) existingSpace Space Update a space's information. (Since 1.2.0-GA).
deleteSpace(Space space) space voidDelete a space. When deleting a space, all of its page navigation bars and its group will be deleted.
addPendingUser(Space space, String userId) space, userId voidAdd a user to the pending list to request to join a space. (Since 1.2.0-GA).
removePendingUser(Space space, String userId) space, userId voidRemove a user from the pending list to request to join a space. (Since 1.2.0-GA).
isPendingUser(Space space, String userId) space, userId voidCheck if a user is in the pending list to request to join a space or not. (Since 1.2.0-GA).
addInvitedUser(Space space, String userId) space, userId voidAdd a user, who is invited to a space, to the invited list. (Since 1.2.0-GA).
removeInvitedUser(Space space, String userId) space, userId voidRemove a user, who is invited to a space, from the invited list. (Since 1.2.0-GA).
isInvitedUser(Space space, String userId) space, userId voidCheck if a user invited to join a space is in the invited list or not. (Since 1.2.0-GA).
addMember(Space space, String userId) space, userId voidAdd a user to a space. The user will get the "member" role in that space.
removeMember(Space space, String userId) space, userId voidRemove a member from a space.
isMember(Space space, String userId) space, userId booleanCheck whether a user is a space's member or not.
setManager(Space space, String userId, boolean isManager) space, userId, isManager voidAdd a user to have the "manager" role in a space. If isManager is set true, a user will get the "manager" role. If false, that user will get the "member" role. (Since 1.2.0-GA).
isManager(Space space, String userId) space, userId voidCheck if a user has the "manager" role in a space or not. (Since 1.2.0-GA).
isOnlyManager(Space space, String userId) space, userId booleanCheck if a user is the only one who has the "manager" role in a space. True if the user Id is the only one who has "manager" role in a space. Otherwise, return false. (Since 1.2.0-GA).
hasAccessPermission(Space space, String userId) space, userId booleanCheck if a user can access a space or not. If the user is root or the space's member, return true.
hasSettingPermission(Space space, String userId) space, userId booleanCheck if a user can have the setting permission to a space or not. If the user is root or the space's member, return true. (Since 1.2.0-GA).
registerSpaceListenerPlugin(SpaceListenerPlugin spaceListenerPlugin) spaceListenerPlugin voidRegister a space listener plugin to listen to space lifecyle events: creating, removing space, activating, deactiving, adding, removing application, promoting, joining, leaving, and revoking. (Since 1.2.0-GA).
unregisterSpaceListenerPlugin(SpaceListenerPlugin spaceListenerPlugin) spaceListenerPlugin voidUnregister an existing space listener plugin. (Since 1.2.0-GA).
setSpaceApplicationConfigPlugin(SpaceApplicationConfigPlugin spaceApplicationConfigPlugin) spaceApplicationConfigPlugin voidSet a space application configuration plugin to configure the home and space applications. By configuring this, the space service will know how to create a new page node with title, URL, and portlet to use. (Since 1.2.0-GA).
getSpaceApplicationConfigPlugin() N/A SpaceApplicationConfigPluginGet the configuration of applications to be initialized when creating a new space. (Since 1.2.0-GA).
getAllSpaces() throws SpaceException N/A List<Space>Get all spaces in eXo Social. You should use method getAllSpaceWithListAccess instead of getAllSpaces. It will be removed in eXo Social 1.3.x.
getSpaceByName(String spaceName) throws SpaceException spaceName SpaceGet a space by its name. You should use SpaceService#getSpaceByPrettyName instead. It will be removed version 1.3.x.
getSpacesByFirstCharacterOfName(String firstCharacterOfName) throws SpaceException firstCharacterOfName List<Space> Get all spaces whose name starting with the input character.
getSpacesBySearchCondition(String condition) throws Exception condition List<Space> Get all spaces which has the name or the description that matches the input condition.
getSpaces(String userId) throws SpaceException userId List<Space>Get spaces of a user in which that user is a member. You should use getMemberSpaces(String) instead. It will be removed in eXo Social 1.3.x
getAccessibleSpaces(String userId) throws SpaceException userId List<Space>Get spaces of a user which that user has the access permission. You should use getAccessibleSpacesWithListAccess(String) instead. It will be removed in eXo Social 1.3.x.
getEditableSpaces(String userId) throws SpaceException userId List<Space>Get spaces of a user which that user has the edit permission. You should use getSettingableSpaces(String) instead. It will be removed in eXo Social 1.3.x.
getInvitedSpaces(String userId) throws SpaceException userId List<Space> Get a user's invited spaces and that user can accept or deny the request. You should use getInvitedSpacesWithListAccess(String) instead. It will be removed in eXo Social 1.3.x.
getPublicSpaces(String userId) throws SpaceException userId - Id of user List<Space> Get invited spaces of a user that can be accepted or denied by the user. You should use getPublicSpacesWithListAccess(String) instead. It will be removed in eXo Social 1.3.x.
getPendingSpaces(String userId) throws SpaceException userId List<Space> Get a user's pending spaces and that the user can revoke that request. You should use getPendingSpacesWithListAccess(String) instead. It will be removed in eXo Social 1.3.x.
createSpace(Space space, String creator, String invitedGroupId) throws SpaceException space, creator, invitedGroupId SpaceCreate a new space and invites all users from invitedGroupId to join this newly created space.
saveSpace(Space space, boolean isNew) throws SpaceException space, isNew voidSave a new space or updates a space. You should use updateSpace(org.exoplatform.social.core.space.model.Space) instead. It will be removed in eXo Social 1.3.x.
deleteSpace(String spaceId) throws SpaceException spaceId voidDelete a space by its id. You should use deleteSpace(org.exoplatform.social.core.space.model.Space) instead. It will be removed in eXo Social 1.3.x.
initApp(Space space) throws SpaceException space voidDo nothing, just for compatibility. Deprecated: it will be removed in eXo Social 1.3.x.
initApps(Space space) throws SpaceException space voidDo nothing, just for compatibility. Deprecated: it will be removed in eXo Social 1.3.x.
deInitApps(Space space) throws SpaceException space void Do nothing, just for compatibility. Deprecated: it will be removed in eXo Social 1.3.x.
addMember(String spaceId, String userId) throws SpaceException spaceId, userId voidAdd a user to a space, the user will get the "member" role in a space. You should use addMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
removeMember(String spaceId, String userId) throws SpaceException spaceId, userId voidRemove a member from a space. You should use removeMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
getMembers(Space space) throws SpaceException space List<String>Get a list of the space members from a space. You should use Space#getMembers() instead. It will be removed in eXo Social 1.3.x.
getMembers(String spaceId) throws SpaceException spaceId List<String>Get a list of the space members from a space. You should use Space#getMembers() instead. It will be removed in eXo Social 1.3.x.
setLeader(Space space, String userId, boolean isLeader) throws SpaceException space, userId, isLeader voidSet a member of a space as a manager. You should use setManager(org.exoplatform.social.core.space.model.Space, String, boolean) instead. It will be removed in eXo Social 1.3.x.
setLeader(String spaceId, String userId, boolean isLeader) throws SpaceException spaceId, userId, isLeader voidSet a member of a space as a manager. You should use setManager(org.exoplatform.social.core.space.model.Space, String, boolean) instead. It will be removed in eXo Social 1.3.x.
isLeader(Space space, String userId) throws SpaceException space, userId boolean Check whether a user is a space's leader or not. You should use isManager(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isLeader(String spaceId, String userId) throws SpaceException spaceId, userId boolean Check whether a user is a space's leader or not. You should use isManager(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isOnlyLeader(Space space, String userId) throws SpaceException space, userId booleanCheck whether a user is the only leader of a space or not. You should use isOnlyManager(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isOnlyLeader(String spaceId, String userId) throws SpaceException spaceId, userId booleanCheck whether a user is the only leader of a space or not. You should use isOnlyManager(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isMember(String spaceId, String userId) throws SpaceException spaceId, userId, boolean Check whether a user is a space's member or not. You should use isMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
hasAccessPermission(String spaceId, String userId) throws SpaceException spaceId, userId boolean Check if a user can access a space or not. You should use hasAccessPermission(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
hasEditPermission(Space space, String userId) throws SpaceException space, userId Boolean Check if a user can have the edit permission of a space or not. You should use hasSettingPermission(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
hasEditPermission(String spaceId, String userId) throws SpaceException spaceId, userId Boolean Check if a user can have the edit permission of a space or not. You should use hasSettingPermission(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isInvited(Space space, String userId) throws SpaceException space, userId Boolean Check if a user is in the invited list of a space or not. You should use isInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isInvited(String spaceId, String userId) throws SpaceException spaceId, userId Boolean Check if a user is in the invited list of a space or not. You should use isInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isPending(Space space, String userId) throws SpaceException space, userId Boolean Check if a user is in the pending list of a space or not.You should use isPendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
isPending(String spaceId, String userId) throws SpaceException spaceId, userId Boolean Check if a user is in the pending list of a space or not. You should use isPendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
installApplication(String spaceId, String appId) throws SpaceException spaceId, appId voidInstall an application to a space.
installApplication(Space space, String appId) throws SpaceException space, appId void Install an application to a space.
activateApplication(Space space, String appId) throws SpaceException space, appId voidActivate an installed application in a space.
activateApplication(String spaceId, String appId) throws SpaceException spaceId, appId voidActivate an installed application in a space.
deactivateApplication(Space space, String appId) throws SpaceException space, appId void Deactivate an installed application in a space.
deactivateApplication(String spaceId, String appId) throws SpaceException spaceId, appId voidDeactivate an installed application in a space.
removeApplication(Space space, String appId, String appName) throws SpaceException space, appId, appName voidRemove an installed application from a space.
removeApplication(String spaceId, String appId, String appName) throws SpaceException space, appId, appName voidRemove an installed application from a space.
requestJoin(Space space, String userId) throws SpaceException space, userId void Request users to join a space. The invited users are then added to the pending list of the space. You should use addPendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
requestJoin(String spaceId, String userId) throws SpaceException spaceId, userId voidRequest users to join a space. The invited users are then added to the pending list of the space.. You should use addPendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
revokeRequestJoin(Space space, String userId) throws SpaceException space, userId voidRevoke a join request after users request to join a group and is in the pending status. You should use removePendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
revokeRequestJoin(String spaceId, String userId) throws SpaceException spaceId, userId voidRevoke a request to join a space. You should use removePendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
inviteMember(Space space, String userId) throws SpaceException space, userId void Invite a userId to become a member of a space. You should use addInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
inviteMember(String spaceId, String userId) throws SpaceException spaceId, userId voidInvite a userId to a be member of a space. You should use addInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
revokeInvitation(Space space, String userId) throws SpaceException space, userId voidRevoke an invitation. Remove a user from the invited member list of the space. You should use removeInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
revokeInvitation(String spaceId, String userId) throws SpaceException spaceId, userId voidRevoke an invitation. Remove a user from the invited member list of the space. You should use removeInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
acceptInvitation(Space space, String userId) throws SpaceException space, userId voidAccept an invitation and move a user from the invited list to the member list. You should use addMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
acceptInvitation(String spaceId, String userId) throws SpaceException spaceId, userId voidAccept an invitation and move a user from the invited list to the member list. You should use addMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
denyInvitation(Space space, String userId) throws SpaceException space, userId voidDeny an invitation and remove a user from the invited list. You should use removeInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
denyInvitation(String spaceId, String userId) throws SpaceException spaceId, userId voidDeny an invitation and remove a user from the invited list. You should use removeInvitedUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
validateRequest(Space space, String userId) throws SpaceException space, userId voidValidate a request and move a user from the pending list to the member list. You should use addMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
validateRequest(String spaceId, String userId) throws SpaceException spaceId, userId voidValidate a request and move a user from the pending list to the member list. You should use addMember(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
declineRequest(Space space, String userId) throws SpaceException space, userId voidDecline a request and remove a user from the pending list. You should use removePendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
declineRequest(String spaceId, String userId) throws SpaceException spaceId, userId voidDecline a request and remove a user from the pending list. You should use removePendingUser(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
registerSpaceLifeCycleListener(SpaceLifeCycleListener listener listener voidRegister a space lifecycle listener. Deprecated: it will be removed in eXo Social 1.3.x.
unregisterSpaceLifeCycleListener(SpaceLifeCycleListener listener) listener voidUnregister a space lifecycle listener. Deprecated: it will be removed in eXo Social 1.3.x.
setPortletsPrefsRequired(PortletPreferenceRequiredPlugin portletPrefsRequiredPlugin) portletPrefsRequiredPlugin void Set the portlet preferences got from the plug-in configuration. You should use SpaceApplicationConfigPlugin(org.exoplatform.social.core.space.model.Space, String) instead. It will be removed in eXo Social 1.3.x.
getPortletsPrefsRequired() N/A StringGet the portlet preferences required to use in creating the portlet application. Deprecated: it will be removed in eXo Social 1.3.x.

eXo Social provides users with a way to share their activity information (also known as Activity Stream) and collaborate in spaces (also known as group work). With the API, you can customize the way to display activities or publish new ones. To manipulate activities, you need to use the AtivityManager service.

There are two types of activities: activities for a user and activities for a space. The following examples will show you how to publish an activity for each type.




package org.exoplatform.publish.user;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.social.core.manager.ActivityManager;
import org.exoplatform.social.core.manager.IdentityManager;
import org.exoplatform.social.core.identity.model.Identity;
import org.exoplatform.social.core.activity.model.ExoSocialActivity;
import org.exoplatform.social.core.activity.model.ExoSocialActivityImpl;
import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider;
public class PublishActivityForUser {
  // Exo Log.
  private final Log LOG = ExoLogger.getLogger(PublishActivityForUser.class);
  
  // Portal container.
  private PortalContainer container;
  
  // identityManager manages identities.
  private IdentityManager identityManager;
  
  // activityManager manages activities.
  private ActivityManager activityManager;
  
  private final static String DEFAULT_USER_NAME = "zun";
  private final static String DEFAULT_ACTIVITY_TITLE = "Hello World!";
  
  /**
   * Constructor.
   */
  public PublishActivityForUser() {
    // Gets the current container.
    container = PortalContainer.getInstance();
    
    // Gets identityManager to handle an identity operation.
    identityManager = (IdentityManager) container.getComponentInstance(IdentityManager.class);
    // Gets activityManager to handle an activity operation.
    activityManager = (ActivityManager) container.getComponentInstanceOfType(ActivityManager.class);
  }
  
  public void createActivityForUser() {
    try {
      // Gets an existing identity or creates a new one.
      Identity userIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, DEFAULT_USER_NAME, false);
      // Creates a new activity for this user.
      ExoSocialActivity activity = new ExoSocialActivityImpl();
      activity.setUserId(userIdentity.getId());
      activity.setTitle(DEFAULT_ACTIVITY_TITLE);
      // Saves an activity into JCR by using ActivityManager.
      activityManager.saveActivity(activity);
    } catch (Exception e) {
      LOG.error("can not save activity.", e);
    }
  }  
}



package org.exoplatform.publish.space;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.social.core.manager.ActivityManager;
import org.exoplatform.social.core.manager.IdentityManager;
import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider;
import org.exoplatform.social.core.identity.model.Identity;
import org.exoplatform.social.core.activity.model.ExoSocialActivity;
import org.exoplatform.social.core.activity.model.ExoSocialActivityImpl;
import org.exoplatform.social.core.space.model.Space;
import org.exoplatform.social.core.space.SpaceException;
import org.exoplatform.social.core.space.spi.SpaceService;
import org.exoplatform.social.core.identity.provider.SpaceIdentityProvider;
public class PublishActivityForSpace {
  // Exo Log.
  private final Log LOG = ExoLogger.getLogger(PublishActivityForSpace.class);
  
  // Portal container.
  private PortalContainer container;
  
  // identityManager manages identities.
  private IdentityManager identityManager;
  
  // activityManager manages activities.
  private ActivityManager activityManager;
  
  // spaceService manages spaces.
  private SpaceService spaceService;
  
  private final static String DEFAULT_NAME_SPACE = "mySpace";
  private final static String DEFAULT_USER_NAME = "zun";
  private final static String DEFAULT_ACTIVITY_TITLE = "An activity for space";
  
  /**
   * Constructor method.
   */
  public PublishActivityForSpace() {
    // Gets the current container.
    container = PortalContainer.getInstance();
    // Gets identityManager to manage identities.
    identityManager = (IdentityManager) container.getComponentInstance(IdentityManager.class);
    // Gets activityManager to manage activities.
    activityManager = (ActivityManager) container.getComponentInstanceOfType(ActivityManager.class);
    // Gets spaceService to handle the operation of a space.
    spaceService = (SpaceService) container.getComponentInstanceOfType(SpaceService.class);
  }
  
  public void createActivityForSpace() {
    try {
      // make sure that a space with the name "mySpace" is created.
      Space space = spaceService.getSpaceByDisplayName(DEFAULT_NAME_SPACE);
      if (space != null) {
        // Gets spaceIdentity if it already exists. If not, a new one is created.
        Identity spaceIdentity = identityManager.getOrCreateIdentity(SpaceIdentityProvider.NAME, DEFAULT_NAME_SPACE, false);
        // Gets an identity if it already exists. If not, a new one is created.
        Identity userIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, DEFAULT_USER_NAME, false);
        // Creates a new activity for this space.
        ExoSocialActivity activity =  new ExoSocialActivityImpl();
        activity.setUserId(userIdentity.getId());
        activity.setTitle(DEFAULT_ACTIVITY_TITLE);
        activityManager.saveActivity(spaceIdentity, activity);
      }
    } catch (SpaceException e) {
      LOG.error("Can not save activity.", e);
    } catch (Exception e) {
      LOG.error("Can not save activity.", e);
    }
  }
}

An activity processor is used to modify the content of activities before they are returned from activity manager. For example, create an activity processor to replace all the texts representing the smile face ":-)" in the activity title by the smiley icons, do as follows:

Firstly, create the SmileyProcessor class by extending the BaseActivityProcessorPlugin.

Then, register this processor by editing the configuration.xml file:

"init-params" contains all the key-value data which a processor will use to initialize. In the above configuration, the priority value indicates the order in which this processor is executed. If the value is 1, this processor will be used before all the remaining processors with the lower priority.

It is really easy to publish an RSS feed to a space's activity stream. eXo Social provides FeedmashJobPlugin to publish RSS feeds. As you can see in the project "exo.social.extras.feedmash", there are the JiraFeedConsumer and HudsonFeedConsumer samples to post eXo Social project's feeds (jira and hudson) to a pre-defined space named exosocial in a specific portal container namedsocialdemo as in the configuration file:



<external-component-plugins>
   <target-component>org.exoplatform.services.scheduler.JobSchedulerService</target-component>
    <component-plugin>
      <name>RepubSocialJiraActivityJob</name>
      <set-method>addPeriodJob</set-method>
      <type>org.exoplatform.social.extras.feedmash.FeedmashJobPlugin</type>
      <description/>
      <init-params>
        <properties-param>
          <name>mash.info</name>
          <property name="feedURL" value="http://jira.exoplatform.org/plugins/servlet/streams?key=SOC"/>
          <property name="categoryMatch" value="resolved|created"/>
          <property name="targetActivityStream" value="space:exosocial"/>
          <property name="portalContainer" value="socialdemo"/>
        </properties-param>
        <properties-param>
          <name>job.info</name>
          <description>save the monitor data  periodically</description>
          <property name="jobName" value="JIRAFeedConsumer"/>
          <property name="groupName" value="Feedmash"/>
          <property name="job" value="org.exoplatform.social.feedmash.JiraFeedConsumer"/>
          <property name="repeatCount" value="0"/>
          <property name="period" value="60000"/>
          <property name="startTime" value="+45"/>
          <property name="endTime" value=""/>
        </properties-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <name>WatchSocialBuildStatus</name>
      <set-method>addPeriodJob</set-method>
      <type>org.exoplatform.social.extras.feedmash.FeedmashJobPlugin</type>
      <description/>
      <init-params>
        <properties-param>
          <name>mash.info</name>
           <property name="feedURL" value="http://builder.exoplatform.org/hudson/view/social/job/social-trunk-ci/rssAll"/>
           <property name="targetActivityStream" value="space:exosocial"/>
           <property name="portalContainer" value="socialdemo"/>
        </properties-param>
        <properties-param>
          <name>job.info</name>
          <description>save the monitor data  periodically</description>
          <property name="jobName" value="HudsonFeedConsumer"/>
          <property name="groupName" value="Feedmash"/>
          <property name="job" value="org.exoplatform.social.feedmash.HudsonFeedConsumer"/>
          <property name="repeatCount" value="0"/>
          <property name="period" value="60000"/>
          <property name="startTime" value="+100"/>
          <property name="endTime" value=""/>
        </properties-param>
      </init-params>
    </component-plugin>
 </external-component-plugins>

Run eXo Social with the URL: http://localhost:8080/socialdemo, then log in and create a space named "exosocial". After creating the "exosocial" space, all the feeds of the eXo Social project on Jira and Hudson will be automatically published to the exosocial space.

See the following code snippet to know more details how to publish an activity and add comments to an activity:



package org.exoplatform.social.introduction.activitystreamandexosocialactivity;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.social.core.activity.model.ActivityStream;
import org.exoplatform.social.core.activity.model.ExoSocialActivity;
import org.exoplatform.social.core.activity.model.ExoSocialActivityImpl;
import org.exoplatform.social.core.manager.ActivityManager;
import org.exoplatform.social.core.manager.IdentityManager;
import org.exoplatform.social.core.identity.model.Identity;
import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider;
public class IntroduceActivityStreamAndExoSocialActivity {
  // Exo Log.
  private final Log LOG = ExoLogger.getLogger(IntroduceActivityStreamAndExoSocialActivity.class);
  
  // Demo identity.
  private Identity demoIdentity;
  
  // John identity.
  private Identity johnIdentity;
  
  // identityManager manages identities.
  private IdentityManager identityManager;
  
  // activityManager manages activities.
  private ActivityManager activityManager;
  
  // Portal container.
  private PortalContainer container;
  
  private final static String DEMO_NAME = "demo";
  private final static String JOHN_NAME = "john";
  private final static String DEFAULT_ACTIVITY_TITLE = "blabla";
  private final static String DEFAULT_COMMENT_TITLE = "comment blah blah";
  
  /** 
   * Constructor.
   */
  public IntroduceActivityStreamAndExoSocialActivity() {
    // Gets the current container.
    container = PortalContainer.getInstance();
    
    // Gets IdentityManager to handle an identity operation.
    identityManager = (IdentityManager) container.getComponentInstanceOfType(IdentityManager.class);
    
    // Gets ActivityManager to handle activity operation.
    ActivityManager activityManager = (ActivityManager) container.getComponentInstanceOfType(ActivityManager.class);
    
   // Gets or create demo's identity
   demoIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, DEMO_NAME, false);
    
    // Gets or creates the identity "john".
    johnIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, JOHN_NAME, false);
  }
 
   /**
   * Posts activity to activity stream
   */
   public void introduceActivityStreamAndExoSocialActivity {
    
    // Sets a string that specifies the primary text of an activity. This field is REQUIRED by ActivityManager. The title field may only have the following HTML tags: <b> <i>, <a>, <span>.
    activity.setTitle(DEFAULT_ACTIVITY_TITLE);
    
    // Sets this activity for demo.
   activity.setUserId(demoIdentity.getId());
    // Saves the activity.
    activityManager.saveActivity(johnIdentity, activity);
    
    // Gets activity stream.
    ActivityStream activityStream = activity.getActivityStream();
    
    // Type of the activity stream. It can be organization or space.
    LOG.info("activity stream type: " + activityStream.getType());
    
    LOG.info("activity stream id: " + activityStream.getId());
    LOG.info("activity stream pretty id: " + activityStream.getPrettyId());
    LOG.info("activity stream perma link: " + activityStream.getPermaLink());
    
    LOG.info("activity stream id: " + activity.getStreamId());
    LOG.info("activity stream owner: " + activity.getStreamOwner());
    
    // Comment in Social
    ExoSocialActivity demoActivity = new ExoSocialActivityImpl();;
    activity.setTitle(DEFAULT_ACTIVITY_TITLE);
    activityManager.saveActivity(demoIdentity, demoActivity);
    ExoSocialActivity comment = new ExoSocialActivityImpl();;
    comment.setTitle(DEFAULT_COMMENT_TITLE);
    
    //Sets comment of demo
   comment.setUserId(demoIdentity.getId());
  
    //Saves a comment.
    activityManager.saveComment(activity, comment);
  }
}

eXo Social supports the OpenSocial standard. So you can integrate OpenSocial gadgets in your dashboard and use the RPC or REST service to view or publish the social data. With the support for the OpenSocial standard, eXo Social provides a framework for developers to build gadgets that can display and mashup activity information for contacts, social networks, applications and services.

Gadgets are web-based software components based on HTML, CSS, JavaScript; defined by using an XML declaration syntax. They allow developers to easily write social applications that work on the social networks supporting OpenSocial APIs without modification. See the following links for detailed information:

To know how to create an OpenSocial gadget, see here.

Note

Gadgets will work out of the box on Dashboard. In eXo, gadgets are wrapped by GadgetWrapperPortlet so they can work as any other portlet applications. At present, eXo Social supports OpenSocial version 0.8.

eXo Social leverages Apache Shindig - an OpenSocial reference implementation to provide and extend OpenSocial APIs which is compatible with the common OpenSocial APIs which is supported by other big social networks like Ning, Hi5, Orkut and more.

To get more details about Supported APIs, refer to Opensocial Specs.

Suppose that you are running local host at port 8080 (http://localhost:8080/), then the path of the API will be:

  • REST API:

http://localhost:8080/social/social/rest

  • RPC API:

http://localhost:8080/social/social/rpc

To learn what you can do with this APIs, have a look at the specification. If you are developing in Java, you can use the opensocial-java-client.

eXo Social provides a way to manage profile information, and connections between users. With APIs provided, you can easily add, manage and customize information and relationships of users.

The identity allows identifying a unique social object. Social objects can be person, group, application, or whatever related to social interactions like connecting, publishing an activity stream or holding a user profile.

The APIs provides notification interfaces which you can implement to create your own handlers for notification when having profile modifications by extending the ProfileListenerPlugin class, or relationship changes by extending RelationshipListenerPlugin.

  • Firstly, create the ProfileLoggerListener class to log all profile modifications of the systems. The abstract class ProfileListenerPlugin provides the interface to implement this method.



import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.social.core.identity.lifecycle.ProfileListenerPlugin;
import org.exoplatform.social.core.identity.spi.ProfileLifeCycleEvent;
public class ProfileLoggerListener extends ProfileListenerPlugin{
  private static final Log logger = ExoLogger.getExoLogger(ProfileLoggerListener.class);
  @Override
  public void avatarUpdated(ProfileLifeCycleEvent event) {
    logger.info("@" + event.getUsername() + " profile has updated his basic profile info.");
  }
  @Override
  public void basicInfoUpdated(ProfileLifeCycleEvent event) {
    logger.info("@" + event.getUsername() + " profile has updated his basic profile info.");
  }
  @Override
  public void contactSectionUpdated(ProfileLifeCycleEvent event) {
    logger.info("@" + event.getUsername() + " profile has updated his contact info.");
  }
  @Override
  public void experienceSectionUpdated(ProfileLifeCycleEvent event) {
    logger.info("@" + event.getUsername() + " profile has an updated experience section.");
  }
  @Override
  public void headerSectionUpdated(ProfileLifeCycleEvent event) {
    logger.info("@" + event.getUsername() + " has updated his header info.");
  }
}
  • Then, add some configurations to this class to the configuration.xml:



<external-component-plugins>
  <target-component>org.exoplatform.social.core.identity.IdentityManager</target-component>
  <component-plugin>
    <name>ProfileLoggerListener</name>
    <set-method>addProfileListener</set-method>
    <type>path.to.ProfileLoggerListener</type>
  </component-plugin>
</external-component-plugins>

Similarly, you can apply the above steps to implement the RelationshipListenerPlugin for relationship notifications.

Relationship is the bridge between two identities in eXo Social. There are many types of relationships defined in the Relationship class. With these types, a user can invite another user, confirm invitations or remove relationship.

The following example will show you how to implement one of these interfaces and how to configure this plugin. The following step is similar to the Profile notifications implementation.

eXo Social provides a way to create groups and to share data and applications by spaces. A space has its own activity stream in which applications or members can publish information. In each space, members use applications together with shared data.

To manipulate the spaces, you will use the SpaceService. To get an instance of this class, you need to get the current PortalContainer instance.

The following example will show how to create a space:



package org.exoplatform.social.sample;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.social.application.impl.DefaultSpaceApplicationHandler;
import org.exoplatform.social.space.Space;
import org.exoplatform.social.space.SpaceException;
import org.exoplatform.social.space.SpaceService;
public class SpaceCreationSample {
  public void createSpace() throws SpaceException {
    String spaceName = "mySpace";
    String creator = "jeremi";
    PortalContainer container = PortalContainer.getInstance();
    SpaceService spaceService = (SpaceService) container.getComponentInstanceOfType(SpaceService.class);
    // verify if there is no space already created
    Space space = spaceService.getSpaceByDisplayName(spaceName);
    if (space == null) {
      space = new Space();
      space.setDisplayName(spaceName);
      space.setRegistration(Space.OPEN);
      space.setDescription("space description"); 
      //DefaultSpaceApplicationHander is the default implementation of SpaceApplicationHandler. You can create your own by extending SpaceApplicationHandler. The default type is "classic" (DefaultSpaceApplicationHandler.NAME = clasic)
      space.setType(DefaultSpaceApplicationHandler.NAME);
      //create the space
      space = spaceService.createSpace(space, creator);
      //initialize the applications
      spaceService.initApps(space);
      
    }
  }
}

To receive notifications of what are happening in spaces, you need to extend the SpaceListenerPlugin and register it. Every method takes a SpaceLifeCycleEvent object as a parameter that contains the information about the event and its context.

The available events are:

As an example, see the SpaceActivityPublisher that publishes an activity based on an event that happened in a space.

To register your listener, configure it as a plugin to the SpaceService like this:



<external-component-plugins>
  <target-component>org.exoplatform.social.core.space.spi.SpaceService</target-component>
  <component-plugin>
    <name>SpaceActivityPublisher</name>
    <set-method>addSpaceListener</set-method>
    <type>org.mycompany.MySpaceListenerPlugin</type>
  </component-plugin>
</external-component-plugins>

The eXo Social widget enables developers to add capabilities of eXo Social to external applications. Since the widget is hosted on your eXo Social server, it can display personalized information. An activity stream of the most recent user actions will display to the group's members.

There are two options of the eXo Social widget that provide different levels of integration and information.

The basic version of this widget is an iFrame. The more advanced version is a button you can insert in a page; this will display a small pop-up with information about the space.

  • serverURL (Default: "http://127.0.0.1:8080"): The address of your eXo installation. To change it, use spaces.setServerURL(...).

  • spaceServicePath (Default: "/rest/private/spaces/"): The path to the spaces service. It is rare you have to change it; but if needed, use spaces.setSpaceServicePath(...).

  • portalName (Default: "socialdemo"): The name of portal you are using. To change it, use spaces.setPortalName(...).

If you want to change any part of this configuration, the best way is to change before creating the pop-up. For example:

<div class="exoSpacesContainer"><a href="#" id="exoSpacesLink" class="exoSpacesLink" target="_blank">Space</a></div>
<script src="/socialWidgetResources/javascript/space.js"></script>
<script>
  spaces.setServerURL("http://192.168.2.100:8080");
  spaces.createPopup("exoSpacesLink", "My cool new space", "my cool description");
</script>

You can see an example of integration at: http://localhost:8080/socialWidgetResources/test.html

An simple activity is made of simple text. We have created an extension point at the level of activities rendering for two cases:

But you may want to support a special syntax like:

You can have more sophisticated cases to process, such as parsing the link that include in the activity's content. Because a process actually has full the access to the Activity, so you can very well process based on the owner, the app, media item.

Now that you have a nice procesor you need to hook it to the system. At runtime, the processors can be attached to ActivityManager via addProcessor(ActivityProcessor) method..

But there is also a component plugin hooked for it: public void addProcessorPlugin(BaseActivityProcessorPlugin plugin)

So, to make your processor easy to hook, you simply need to let him extend the BaseActivityProcessorPlugin.

It will have the additional benefit to make the priority field configurable, so you don't need to implement getPriorty().

Then your processor can be configured as a component plugin like this:

Restart then place the smiley imagesu on the server and you should see something like that:

Name Service URL Location Description
ActivitiesRestService {restContextName}/{portalName}/social/activities

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.component.service

Provides REST services for activity applications: like/unlike; comment; delete activity.
Name Service URL Endpoint Parameters Expected Values Description
destroyActivity {restContextName}/{portalName}/social/activities/destroy/{activityId}.{format}

portalName

activityId

format

String

String

String: json or xml

Destroys activity and gets the json/xml format.
showLikes {restContextName}/{portalName}/social/activities/{activityId}/likes/show.{format}

portalName

activityId

format

String

String

String: json or xml

Shows the list of likes by activityId and returns the json/xml format.
updateLike {restContextName}/{portalName}/social/activities/{activityId}/likes/update.{format}

portalName

activityId

format

String

String

String: json or xml

Updates the list of likes by the json/xml format.
destroyLike {restContextName}/{portalName}/social/activities/{activityId}/likes/destroy/{identity}.{format}

portalName

activityId

identityId

format

String

String

String

String: json or xml

Destroys like by identityId and get the json/xml return format.
showComments {restContextName}/{portalName}/social/activities/{activityId}/likes/show.{format}

portalName

activityId

format

String

String

String: json or xml

Shows the comment list by the json/xml format.
updateComment {restContextName}/{portalName}/social/activities/{activityId}/likes/update.{format}

portalName

activityId

format

String

String

String: json or xml

Updates the comment by the json/xml format.
destroyComment {restContextName}/{portalName}/social/activities/{activityId}/comments/destroy/{commentId}.{format}

portalName

activityId

commentId

format

String

String

String

String: json or xml

Destroys comments and returns the json/xml format.

Example:

http://localhost:8080/rest-socialdemo/socialdemo/social/activities/s08d397dg6/likes/destroy/abc.json

Name Service URL Location Description
AppsRestService {restContextName}/social/apps/

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.component.service

Provides REST services for the application registry gadget: shows application list
Name Service URL Endpoint Parameters Expected Values Description
showApps {restContextName}/social/apps/show.{format} format String: json or xml Shows applications by the json/xml format.

Example:

http://localhost:8080/rest-socialdemo/social/apps/show.json

Name Serive URL Location Description
IdentityRestService restContextName}/{portalName}/social/identity/{username}/id

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.component.service

Gets identityId by the username.
Name Service URL Endpoint Parameters Expected Values Description
UserId getId {restContextName}/{portalName}/social/identity/{username}/id/show.json

username

portalName

String

String

Gets the identity by username and returns by the json format.

Example:

http://localhost:8080/rest-socialdemo/socialdemo/social/identity/john/id/show.json

Name Service URL Location Description
LinkshareRestService {restContextName}/social/linkshare

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.component.service

Gets information from a provided link.
Name Service URL Endpoint Parameters Expected Values Description
getLink {restContextName}/social/linkshare/show.{format} format String: json or xml Gets the link content by posting a linkShare request.

Example:

http://localhost:8080/rest-socialdemo/social/linkshare/show.json

Name Service URL Location Description
PeopleRestService {restContextName}/social/people

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.component.service

Provides REST services for manipulating jobs related to people.
Name Service URL Endpoint Parameters Expected Values Description
suggestUsernames {restContextName}/social/people/suggest.{format}

nameToSearch

currentUser

typeOfRelation

spaceURL

format

String

String

String

String

String: json or xml

Gets and returns a list of users's name that matches the input string for suggesting.

Example: http://localhost:8080/rest-socialdemo/social/people/suggest.json

Name Service URL Location Description
SpacesRestService {restContextName}/{portalName}/social/spaces

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.component.service

Provides REST services for space gadget to display users' spaces and pending spaces.
Name Service URL Endpoint Parameters Expected Values Description  
showMySpaceList {restContextName}/social/spaces/mySpaces/show.{format}

portalName

format

String

String: json or xml

Shows mySpaceList by the json/xml format.  
showPendingSpaceList {restContextName}/social/spaces/pendingSpaces/show.{format}

portalName

format

String

String: json or xml

Shows pendingSpaceList by the json/xml format. 
suggestSpacenames {restContextName}/social/spaces/spaceNames/suggest.{format}

portalName

conditionToSearch

typeOfRelation

currentUser

format

String

String

String

String

String: json or xml

Gets and returns space's names that match the input string for suggesting.

Example:

http://localhost:8080/rest-socialdemo/social/spaces/mySpaces/show.xml

Name Service URL Location Description
WidgetRestService {restContextName}/spaces/{containerName}

Maven groupId: org.exoplatform.social

ArtifactId: exo.social.extras.widget.rest

Provides REST services for creating spaces or getting spaces'information.
Name Service URL Endpoint Parameters Expected Values Description
spaceInfo {restContextName}/spaces/{containerName}/space_info

containerName

portalName

spacePrettyName

description

String

String (default value: classic)

String

String

Returns the HTML page for displaying the information of the space. Two query parameters needed: spaceName and description

Example:

http://localhost:8080/rest-socialdemo/spaces/socialdemo/space_info?name=Social&description=Social

Objectives:

The 3rd parties want to integrate and extend eXo Social capability and features and eXo Social REST Services APIs are dedicated for them to complete that. By using these REST APIs, the 3rd parties can write any applications (desktop apps, mobile apps, web apps) to integrate with eXo Social services and business.

Conventions:

The entry point for Social Rest service must be: /{rest_context_name}/private/api/social/{version}/{portalContainerName}/{social_resources}/. An example of activities resources: /rest/private/api/social/v1-alpha1/portal/activity/.

There are 3 types of parameters on each URL:

Notes:

Currently, only the basic authentication is supported. Please see more details at http://en.wikipedia.org/wiki/Basic_access_authentication.

JSON support is mandatory. Others format SHOULD be supported, too (XML, RSS, ATOM). The supported formats will be specified by the detailed documentation for REST resources.

The rest_context_name and portal_container_name parameters are used as follows:

  • On eXo Social standalone: rest_context_name: rest-socialdemo; portal_container_name: socialdemo.

  • On eXo Platform: rest_context_name: rest; portal_container_name: portal.

Description: Creates an activity to an identity's activity stream. If no identity_id is specified, the activity will be created to the authenticated identity's activity stream.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity.json

Body Data: The data for an activity

For example:

{
"title": "Hello World", //required
"type": "exosocial:core", //optional
"priority": 0.5, //optional
"titleId": "", //optional
"templateParams": {
} //optional hashmap
}

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • identity_id: The identity who posts activities to his stream, to the stream of his connection or the space stream where he is a manager or a member.

Examples

  • JSON

    • Request

POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity.json
BODY: {"title": "Hello World!!!"}
    • Response: A list of activity objects in the JSON format.

{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011",
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi" //the identity id of the user who created this activity
}

Description: Gets an activity object from a specified activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4d5e6f7g8h9i.json

Supported Format: json

Requires Authentication: true

Parameters:

  • Required

    • id: the Id of the existing activity.

  • Optional

    • poster_identity: When setting this parameter to true, t or 1, the returned activity will provide more information for the user who posted this activity.

    • number_of_comments: Specifies the number of comments to be displayed along with this activity. By default, number_of_comments=0. If number_of_comments is a positive number, this number is considered as a limit number that must be equal or less than 100. If the actual number of comments is less than the provided positive number, the number of actual comments must be returned. If the total number of comments is more than 100, it is recommended to use activity/:id/comments.format instead.

    • activity_stream: When setting this parameter to true, t or 1, the returned activity will provide more information for the activity stream that this activity belongs to.

Examples:

  • JSON

    • Request

GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json
    • Response

{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011", //The Date follows ISO 8601
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi", //the identity id of the user who created this activity
"liked": true, //is liked (favorites) by this authenticated identity
"likedByIdentities": ["identityId1", "identityId2"],
"posterIdentity": {}, //optional
"comments": [{}, {}, {}], //optional
"totalNumberOfComments": 1234,
"activityStream": {
"type": "user", // or "space"
"prettyId": "root", // or space_abcde
"faviconURL": "http://demo3.exoplatform.org/favicons/exo-default.jpg",
"title": "Activity Stream of Root Root",
"permaLink": "http://platform35.demo.exoplatform.org/profile/root"
} //optional
}

Description: Deletes an existing activity by its Id using the DELETE method. The deleted activity information will be returned in the JSON format.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4d5e6f7g8h9i.json

Supported Format: json

Requires Authentication: true

Parameters:

  • Required

    • id: The Id of the existing activity.

Examples

  • JSON

    • Request

DELETE: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e6f7g8h9i.json
    • Response

{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011", //The Date follows ISO 8601
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi", //the identity id of the user who created this activity
"liked": true, //is liked (favorites) by this authenticated identity
"likedByIdentities": ["identityId1", "identityId2"],
"posterIdentity": {}, //optional
"comments": [{}, {}, {}], //optional
"totalNumberOfComments": 1234,
"activityStream": {
  "type": "user", // or "space"
  "prettyId": "root", // or space_abcde
  "faviconURL": "http://demo3.exoplatform.org/favicons/exo-default.jpg",
  "title": "Activity Stream of Root Root",
  "permaLink": "http://platform35.demo.exoplatform.org/profile/root"
} //optional
}

Description: Deletes an existing activity by its Id using the POST method. The deleted activity information will be returned in the JSON format. It is recommended to use the DELETE method, except the case that clients cannot make request via this method.

URL:

For example: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/destroy/1a2b3c4d5e6f7g8h9i.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/destroy/1a2b3c4d5e6f7g8h9i.json

Supported Format: json

Requires Authentication: true

Parameters:

  • Required

    • id: The Id of the existing activity.

Examples:

  • JSON

    • Request

POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/destroy/1a2b3c4d5e6f7g8h9i.json
    • Response

{
"id": "1a2b3c4d5e6f7g8h9j",
"title": "Hello World!!!",
"appId": "",
"type": "exosocial:core",
"postedTime": 123456789, //timestamp
"createdAt": "Fri Jun 17 06:42:26 +0000 2011", //The Date follows ISO 8601
"priority": 0.5, //between 0.0 and 1.0, higher value => higher priority.
"templateParams": {},
"titleId": "",
"identityId": "123456789abcdefghi", //the identity id of the user who created this activity
"liked": true, //is liked (favorites) by this authenticated identity
"likedByIdentities": ["identityId1", "identityId2"],
"posterIdentity": {}, //optional
"comments": [{}, {}, {}], //optional
"totalNumberOfComments": 1234, //if comments is required, the total number of comments
"activityStream": {
  "type": "user", // or "space"
  "prettyId": "root", // or space_abcde
  "faviconURL": "http://demo3.exoplatform.org/favicons/exo-default.jpg",
  "title": "Activity Stream of Root Root",
  "permaLink": "http://platform35.demo.exoplatform.org/profile/root"
} //optional
}

Description: Gets the comments on an activity.

URL:

For example: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comments.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comments.json

Supported Format: json

Requires Authentication: true

Parameters: No

Examples:

  • JSON

    • Request

GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comments.json
    • Response: A list of comment objects in the JSON format.

{
  total: 10,
  comments: [
  {
    "id": "123456"
    "identityId": "12345abcde",
    "text": "Comment there!",
    "postedTime": 123456789,
    "createdAt": "Fri Jun 17 06:42:26 +0000 2011"
  },
  {
    "id" : "234567"
    "identityId": "12345abcde",
    "text": "Comment there 2!",
    "postedTime": 123456789,
    "createdAt": "Fri Jun 17 06:42:26 +0000 2011"
  }
  ]
}

Description: Posts a new comment on an existing activity. The poster of this comment is an authenticated identity.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comment.json

Body data:

{
  "text": "My comment here!!!"
}

Supported Format:json

Requires Authentication: true

Parameters: No

Examples:

  • JSON

    • Request

POST: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment.json
BODY: {"text": "My comment here!!!"}
    • Response: The created comment.

{
"id": "123456"
"identityId": "12345abcde",
"text": "My comment here!!!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
}

Description: Deletes an existing comment by its Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment/123456.json

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity/1a2b3c4e5e/comment/123456.json

Supported Format: json

Requires Authentication: true

Parameters: No

Examples:

  • JSON

    • Request

DELETE: http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity/1a2b3c4d5e/comment/123456.json
    • Response: The deleted comment.

{
"id": "123456"
"identityId": "12345abcde",
"text": "My comment here!!!",
"postedTime": 123456789,
"createdAt": "Fri Jun 17 06:42:26 +0000 2011"
}

Description: Gets activities of a defined identity which can be an user identity or a space identity.

Url: s

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/user/default.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/user/default.json?limit=20

http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/user/default.json

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

    • Response

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/user/default.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856902483,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e2d55c0a8013737dc8eabde05e7f7",
      "title":"Hello World 3",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:22 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856896732,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e16dec0a801377bfea51ee20d8b66",
      "title":"Hello World 2",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:16 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856884889,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98de8aec0a801372dde36ca1cf69c6b",
      "title":"Hello World!!!",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:04 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets newer activities of a defined identity based on an activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/user/newer/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/user/newer/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/user/newer/f98de8aec0a801372dde36ca1cf69c6b.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856902483,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e2d55c0a8013737dc8eabde05e7f7",
      "title":"Hello World 3",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:22 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856896732,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e16dec0a801377bfea51ee20d8b66",
      "title":"Hello World 2",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:16 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets older activities of a defined identity based on an activity Id.

Url:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/user/older/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/user/older/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/user/older/f98e16dec0a801377bfea51ee20d8b66.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856884889,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98de8aec0a801372dde36ca1cf69c6b",
      "title":"Hello World!!!",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:04 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets the latest activity stream feed of a defined user identity.

URL

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/feed/default.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/feed/default.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: Specifies the number of activities to be retrieved. This number must be less than or equal to 100. The value you pass to limit is a maximum number of activities to be returned. The actual number of activities you receive maybe less than limit. If limit is not specified, the default value will be 100.

Examples

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/feed/default.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f98f1197c0a80137528356921f2948c7",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856997920,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98fa222c0a801373d2b094dcc48bf9b",
      "title":"<a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> has joined the space.",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:57 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f98f1197c0a80137528356921f2948c7",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{
      },
      "postedTime":1309856961044,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98f121dc0a80137294aeb29d84f202e",
      "title":"john space was created by <a href={{{"}}}/socialdemo/private/classic/profile/john{{{"}}} target={{{"}}}_parent{{{"}}}>John Anthony</a> .",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:21 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f98ed67ec0a801370fc7afc98400df35",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856945880,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98ed6f1c0a80137086908621ded6fe3",
      "title":"demo space was created by <a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> .",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:05 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856902483,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e2d55c0a8013737dc8eabde05e7f7",
      "title":"Hello World 3",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:22 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856896732,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e16dec0a801377bfea51ee20d8b66",
      "title":"Hello World 2",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:16 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856884889,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98de8aec0a801372dde36ca1cf69c6b",
      "title":"Hello World!!!",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:04 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets the newer activity stream feed of an identity based on an activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/feed/newer/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/feed/newer/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/feed/newer/f98ed6f1c0a80137086908621ded6fe3.json
    • Response

{
   "activities":[
      {
         "appId":null,
         "identityId":"f98f1197c0a80137528356921f2948c7",
         "totalNumberOfComments":0,
         "liked":false,
         "templateParams":{

         },
         "postedTime":1309856997920,
         "type":"exosocial:spaces",
         "posterIdentity":null,
         "activityStream":null,
         "id":"f98fa222c0a801373d2b094dcc48bf9b",
         "title":"<a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> has joined the space.",
"priority":null,
"createdAt":"Tue Jul 5 16:09:57 +0700 2011",
"likedByIdentities":null,
"titleId":null,
"comments":null
},
{
"appId":null,
"identityId":"f98f1197c0a80137528356921f2948c7",
"totalNumberOfComments":0,
"liked":false,
"templateParams":{
},
"postedTime":1309856961044,
"type":"exosocial:spaces",
"posterIdentity":null,
"activityStream":null,
"id":"f98f121dc0a80137294aeb29d84f202e",
"title":"john space was created by <a href={{{"}}}/socialdemo/private/classic/profile/john{{{"}}} target={{{"}}}_parent{{{"}}}>John Anthony</a> .",
         "priority":null,
         "createdAt":"Tue Jul 5 16:09:21 +0700 2011",
         "likedByIdentities":null,
         "titleId":null,
         "comments":null
      }
   ]
}

Description: Gets the older activity stream feed on an identity based on an activity Id.

URL

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/feed/older/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/feed/older/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/feed/older/f98e16dec0a801377bfea51ee20d8b66.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd6f0c0a80137102696ac26430766",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856884889,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98de8aec0a801372dde36ca1cf69c6b",
      "title":"Hello World!!!",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:04 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets activities of a defined identity's connections based on an activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/connections/default.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/connections/default.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional:

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/connections/default.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd31ac0a801373fbb2043e05d3312",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{
        "SENDER":"demo",
        "RECEIVER":"john",
        "RELATIONSHIP_UUID":"f9cff1ecc0a8013742f758cfaee8db70"
      },
      "postedTime":1309861232904,
      "type":"exosocial:relationship",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f9d0410ac0a8013731e419f08bea9993",
      "title":"I am now connected with <a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a>",
"priority":null,
"createdAt":"Tue Jul 5 17:20:32 +0700 2011",
"likedByIdentities":null,
"titleId":"CONNECTION_CONFIRMED",
"comments":null
},
{
"appId":null,
"identityId":"f92cd31ac0a801373fbb2043e05d3312",
"totalNumberOfComments":0,
"liked":false,
"templateParams":{
"SENDER":"demo",
"RECEIVER":"john",
"RELATIONSHIP_UUID":"f9cff1ecc0a8013742f758cfaee8db70"
},
"postedTime":1309861213060,
"type":"exosocial:relationship",
"posterIdentity":null,
"activityStream":null,
"id":"f9cff39fc0a8013716a77b1ce66864d7",
"title":"<a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> has invited <a href={{{"}}}/socialdemo/private/classic/profile/john{{{"}}} target={{{"}}}_parent{{{"}}}>John Anthony</a> to connect",
      "priority":null,
      "createdAt":"Tue Jul 5 17:20:13 +0700 2011",
      "likedByIdentities":null,
      "titleId":"CONNECTION_REQUESTED",
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd31ac0a801373fbb2043e05d3312",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856926090,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e898cc0a801372c958fbfe847e2d3",
      "title":"john activity 2",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:46 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f92cd31ac0a801373fbb2043e05d3312",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856921353,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e770fc0a8013762a63bbd2c426726",
      "title":"john activity 1",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:41 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets newer activities of a defined identity's connections based on an activity Id.

URL

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/connections/newer/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/connections/newer/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/connections/newer/f9cff39fc0a8013716a77b1ce66864d7.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd31ac0a801373fbb2043e05d3312",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{
        "SENDER":"demo",
        "RECEIVER":"john",
        "RELATIONSHIP_UUID":"f9cff1ecc0a8013742f758cfaee8db70"
      },
      "postedTime":1309861232904,
      "type":"exosocial:relationship",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f9d0410ac0a8013731e419f08bea9993",
      "title":"I am now connected with <a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a>",
"priority":null,
"createdAt":"Tue Jul 5 17:20:32 +0700 2011",
"likedByIdentities":null,
"titleId":"CONNECTION_CONFIRMED",
"comments":null
}
]
}

Description: Gets older activities of a defined user identity's connections based on an activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/connections/older/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/connections/older/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/connections/older/f98e898cc0a801372c958fbfe847e2d3.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f92cd31ac0a801373fbb2043e05d3312",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856921353,
      "type":"DEFAULT_ACTIVITY",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98e770fc0a8013762a63bbd2c426726",
      "title":"john activity 1",
      "priority":null,
      "createdAt":"Tue Jul 5 16:08:41 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets activities of spaces that the defined identity is the member or the manager.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/spaces/default.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/spaces/default.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/spaces/default.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f98f1197c0a80137528356921f2948c7",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856997920,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98fa222c0a801373d2b094dcc48bf9b",
      "title":"<a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> has joined the space.",
"priority":null,
"createdAt":"Tue Jul 5 16:09:57 +0700 2011",
"likedByIdentities":null,
"titleId":null,
"comments":null
},
{
"appId":null,
"identityId":"f98f1197c0a80137528356921f2948c7",
"totalNumberOfComments":0,
"liked":false,
"templateParams":{
},
"postedTime":1309856961044,
"type":"exosocial:spaces",
"posterIdentity":null,
"activityStream":null,
"id":"f98f121dc0a80137294aeb29d84f202e",
"title":"john space was created by <a href={{{"}}}/socialdemo/private/classic/profile/john{{{"}}} target={{{"}}}_parent{{{"}}}>John Anthony</a> .",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:21 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f98ed67ec0a801370fc7afc98400df35",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856945880,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98ed6f1c0a80137086908621ded6fe3",
      "title":"demo space was created by <a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> .",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:05 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets newer activities from all spaces that the defined user identity is the member or the manager based on a specified activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/spaces/newer/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1-alpha1/portal/activity_stream/1234567890/spaces/newer/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/spaces/newer/f98f121dc0a80137294aeb29d84f202e.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f98f1197c0a80137528356921f2948c7",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856997920,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98fa222c0a801373d2b094dcc48bf9b",
      "title":"<a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> has joined the space.",
"priority":null,
"createdAt":"Tue Jul 5 16:09:57 +0700 2011",
"likedByIdentities":null,
"titleId":null,
"comments":null
}
]
}

Description: Gets the older activities of spaces that the defined user identity is the member or the manager based on a specified activity Id.

URL:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity_stream/1234567890/spaces/older/0987654321.json

http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/activity_stream/1234567890/spaces/older/0987654321.json?limit=20

Supported Format: json

Requires Authentication: true

Parameters:

  • Optional

    • limit: The number of activities retrieved with the default value of 100. This input value must be less than or equal to its default value (100). The number of the returned results is actually less than or equal to the limit value.

Examples:

  • JSON

    • Request

GET: http://localhost:8080/rest-socialdemo/private/api/social/v1-alpha1/socialdemo/activity_stream/f92cd6f0c0a80137102696ac26430766/spaces/older/f98fa222c0a801373d2b094dcc48bf9b.json
    • Response

{
  "activities":[
    {
      "appId":null,
      "identityId":"f98f1197c0a80137528356921f2948c7",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856961044,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98f121dc0a80137294aeb29d84f202e",
      "title":"john space was created by <a href={{{"}}}/socialdemo/private/classic/profile/john{{{"}}} target={{{"}}}_parent{{{"}}}>John Anthony</a> .",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:21 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    },
    {
      "appId":null,
      "identityId":"f98ed67ec0a801370fc7afc98400df35",
      "totalNumberOfComments":0,
      "liked":false,
      "templateParams":{

      },
      "postedTime":1309856945880,
      "type":"exosocial:spaces",
      "posterIdentity":null,
      "activityStream":null,
      "id":"f98ed6f1c0a80137086908621ded6fe3",
      "title":"demo space was created by <a href={{{"}}}/socialdemo/private/classic/profile/demo{{{"}}} target={{{"}}}_parent{{{"}}}>Demo gtn</a> .",
      "priority":null,
      "createdAt":"Tue Jul 5 16:09:05 +0700 2011",
      "likedByIdentities":null,
      "titleId":null,
      "comments":null
    }
  ]
}

Description: Gets the identity and its associated profile by the activity Id. Url:

For example:

http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/identity/123456789.json

http://localhost:8080/rest-socialdemo/private/api/social/v1/socialdemo/identity/123456789.json

Supported Format: json

Requires Authentication: true

Parameters: No

Examples:

  • JSON

    • Request

GET: http://platform35.demo.exoplatform.org/rest/private/api/social/v1/portal/identity/123456789.json
    • Response

{
  "id" : "123456789",
  "providerId": "organization",
  "remoteId": "demo",
  "profile": {
    "fullName": "Demo Gtn",
    "avatarUrl": "http://platform35.demo.exoplatform.org/profile/avatar/demo.jpg"
  }
}

Description: Gets the latest eXo Social REST services version. This version number should be used as the latest and stable version that is considered to include all new features and updates of eXo Social REST services.

Url:

For example:

http://platform35.demo.exoplatform.org/rest/api/social/version/latest.json http://localhost:8080/rest-socialdemo/api/social/version/latest.json

Supported Format: json

Requires Authentication: false

Parameters: No

Examples:

  • JSON

    • Request

GET: http://platform35.demo.exoplatform.org/rest/api/social/version/latest.json
    • Response

{"version": "v1-alpha1"}
  • XML

    • Request

GET: http://platform35.demo.exoplatform.org/rest/api/social/version/latest.xml
    • Response




<version>v1-alpha1</version>

Social_Space/Space is used to store data of eXo Social spaces. It includes nodes of the exo:space type. This node type is defined as follows:



  <nodeType hasOrderableChildNodes="false" isMixin="false" name="exo:space" primaryItemName="">
    <supertypes>
      <supertype>nt:base</supertype>
    </supertypes>
    <propertyDefinitions>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:name" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:groupId" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="true" name="exo:pendingUsers" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="true" name="exo:invitedUsers" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:app" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:parent" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:description" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:tag" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:type" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:url" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:visibility" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:registration" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:priority" onParentVersion="COPY" protected="false" requiredType="String">
         <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:prettyName" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:avatarUrl" onParentVersion="COPY" protected="false" requiredType="String">
         <valueConstraints/>
      </propertyDefinition>
    </propertyDefinitions>
    <childNodeDefinitions>
      <childNodeDefinition autoCreated="false" defaultPrimaryType="nt:file" mandatory="false" name="*" onParentVersion="COPY" protected="false" sameNameSiblings="false">
        <requiredPrimaryTypes>
          <requiredPrimaryType>nt:file</requiredPrimaryType>
        </requiredPrimaryTypes>
      </childNodeDefinition>
    </childNodeDefinitions>
  </nodeType>

The exo:space node type has the following properties:

Properties requiredTypeDescription
exo:name String The space name.
exo:groupIdString The group associated with a corresponding space.
exo:pendingUsersString The string contains a list of usernames which are pending for validation to join a space.
exo:invitedUsersStringThe string contains a list of usernames which are invited to join a space.
exo:appStringThe string contains a list of applications with portlet id, application name, and its state (installed, active, deactive).
exo:parentStringThe parent group of a space.
exo:descriptionString The description of a space.
exo:tagStringThe string contains a list of keywords to tag a space.
exo:typeStringThe type of space is used to run in the classic or webOS mode.
exo:urlStringThe link to access a space.
exo:visibilityStringThe string contains three values: public, private, and hidden.
exo:registrationString The string contains three values: open, validation, and close.
exo:priorityStringThe string is used to sort spaces in a spaces list. It contains three values: 1, 2 and 3. The smaller value has the higher priority.
exo:prettyNameString The pretty name of a space.
exo:avatarUrlStringThe link to the avatar of a space.

Social_Activity contains all the child nodes with the path name of the identity provider name. The identity provider name contains all the child nodes that have the path name of the remote id. The remote id path has one node with the path name as "published" that includes all the nodes of the exo:activity type. This node type stores data about the activity associated with a remote id. It is defined as follows:



<nodeType hasOrderableChildNodes="false" isMixin="false" name="exo:activity" primaryItemName="">
    <supertypes>
      <supertype>nt:unstructured</supertype>
    </supertypes>
    <propertyDefinitions>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:body" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:bodyTemplate" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:externalId" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="exo:title" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:titleTemplate" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="exo:updatedTimestamp" onParentVersion="COPY" protected="false" requiredType="Long">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="exo:postedTime" onParentVersion="COPY" protected="false" requiredType="Long">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:priority" onParentVersion="COPY" protected="false" requiredType="Long">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:url" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:userId" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:type" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:replyToId" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="exo:hidden" onParentVersion="COPY" protected="false" requiredType="Boolean">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="true" name="exo:like" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
      <propertyDefinition autoCreated="false" mandatory="false" multiple="true" name="exo:params" onParentVersion="COPY" protected="false" requiredType="String">
        <valueConstraints/>
      </propertyDefinition>
    </propertyDefinitions>
  </nodeType>

The exo:activity node type has the following properties:

Properties requiredType Description
exo:bodyStringThe string specifies the body template message ID in the gadget spec. The body is an optional extended version of an activity.
exo:bodyTemplateString The body template is used to replace the parameters in the body.
exo:externalIdStringAn optional string ID is generated by the posting application.
exo:titleStringThe string specifies the primary text of an activity.
exo:titleTemplateStringThe template for the activity title.
exo:updatedTimeLongThe string specifies the time at which this activity is updated in milliseconds since the epoch.
exo:postedTimeLongThe string specifies the time at which this activity took place in milliseconds since the epoch.
exo:priorityLongA number between 0 and 1 represents the relative priority of this activity in relation to other activities from the same source.
exo:urlStringThe string specifies the stream's URL.
exo:userIdStringThe string ID of the user who this activity is for.
exo:typeStringThe application id which creates an activity.
exo:replyToIdStringThe string contains the identity id which the activity uses.
exo:hiddenBoolenThe boolen denotes the activity display. If "true", the activity is not displayed.
exo:likeString The list of identity ids who like the activity.
exo:paramsStringA map of custom key/value pairs is associated with this activity.

The Social_Relationshipincludes nodes of the exo:relationship type. This node type stores information about the connection type between identities. It is defined as follows:

This node type has the following properties:

Properties requiredType Description
exo:senderREFERENCE The sender identity. Its value is exo:identiy
exo:receiverREFERENCE The receiver identity. Its value is exo:identity
exo:statusString The string has three values: PENDING, CONFIRMED, and IGNORED.
exo:isSymetricboolean Denotes if the connection is one way or two way.