Community articleRendering the data model
Added by IBM contributorIBM on July 7, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Shows the relationship between the Data model and the user interface used to represent it.
Overview

The goal of this page is to show the relationship between the Data model and the user interface used to represent it.

Adding a Title


entry.title - is used to provide a plain text rendering of the title. You can also choose to provide a template in the title which is substituted as appropriate (See use of templates in separate section)

entry.content is used if present to provide a rich text rendering of the event title and is always created from the title above. This typically will contain the markup necessary for showing linkable names for example (adding ther vcard surrounds).


Showing the actor details

For any user recognised by IBM Connections, the id of the actor is sufficient (i.e. in entry.actor.id). IBM Connections will automatically retrieve the appropriate thumbnail photo corresponding to the user specified by that id. In the case where the actor is not a recognised IBM Connections user but a representative photo is available, this can be achieved by including the displayName and image properties.

Showing the application details

The entry.generator property can be used in order to show specific generator information. You can specify the image (generator.image.url), link (generator.url) and the hover text (generator.displayName) to be used. Once a generator has been supplied initially, it can be referenced by id on POST from that point on and the extra details will be added by IBM Connections. To specify a third party generator for our Top App example below we use.

"generator": {
            "image": {
                "url": "http://www.example.org/topapp/images/icon.png"
            },
            "id": "topapp",
            "displayName": "Top Application",
            "url": "http://www.example.org/topapp"
        },



Showing an objects details

Summary text can be provided which is displayed directly under the following conditions.

  • Summary text may be cropped and processed in order to ensure it is suitable for display in the Stream (most events will not render content and the IBM Connections stream makes no guarantee regarding any content that is displayed directly here due to space restrictions).
  • Wherever an embedded experience is not provided, the object summary information will be chosen for rendering within the event details window if present
  • All provided content will have 'Active Content' removed (e.g. JavaScript) on event submission

 

Showing an attached image

Instead of showing a rich text summary, it is possible to reference a file attachment. In this case the summary is assumed to be less relevant and a representation of the file attached is shown instead. This can be done in a standard manner by including the following information -

  • object.type=file | image
  • object.displayName=the file name
  • object.url=link to the file in question (displayName above is given the appropriate anchor)
  • object.image = image for the file if one is available

 

Complete Example



{
    "startIndex": 0,
    "totalResults": 1,
    "entry": [
        {
        "published": "2011-11-21T15:14:06.508Z",
        "url": "http://www.example.org/connections/opensocial/rest/activitystreams/@me/@all/@all/86c62a05-61de-4658-97a7-16e7ccf72e78",
        "target": {
            "summary": "Top App Entry",
            "replies": {
                "items": [{
                    "content": "This was my first comment",
                    "author": {
                        "objectType": "person",
                        "id": "12345678-8f0a-1028-xxxz-db07163b51b2",
                        "displayName": "Joe Blogs"
                    },
                    "updated": "2011-11-21T15:13:59.999Z",
                    "id": "f8f0e93f-e462-4ede-92cc-f6e8a1b7eb36"
                 },
                 {
                    "content": "This was another comment",
                    "author": {
                        "objectType": "person",
                        "id": "12345678-8f0a-1028-xxxy-db07163b51b2",
                        "displayName": "Jane Doe"
                    },
                    "updated": "2011-11-21T15:14:06.508Z",
                    "id": "5369ea82-d791-46cb-a87a-3696ff90d8f3"
                 }],
                "totalItems": 0
            },
            "embed": {
                "gadget": "http://www.example.org/greatgadgets/TopApp.xml",
                "context": {
                    "summary": "Test ",
                    "topAppUrl": "http://www.example.org/topapp/atom/1028-xxxx-db07163b51b2",
                }
            },
            "objectType": "note",
            "author": {
                "id": "12345678-8f0a-1028-xxxx-db07163b51b2",
                "displayName": "Joseph Bloggs"
            },
            "updated": "2011-11-21T15:08:44.321Z",
            "id": "87d7a7fb-af22-403b-ab0d-d101d9caac4f",
            "displayName": "Joseph Bloggs",
            "published": "2011-11-21T15:08:44.321Z",
            "url": "http://www.example.org/topapp/1028-xxxx-db07163b51b2"
        },
        "provider": {
            "id": "http://www.ibm.com/xmlns/prod/sn",
            "displayName": "IBM Connections - News Service",
            "url": "http://www.example.org/news"
        },
        "generator": {
            "image": {
                "url": "http://www.example.org/topapp/images/icon.png"
            },
            "id": "topapp",
            "displayName": "Top Application",
            "url": "http://www.example.org/topapp"
        },
        "actor": {
            "id": "12345678-8f0a-1028-xxxx-db07163b51b2",
            "displayName": "Joseph Bloggs"
        },
        "connections": {
            "actionable": "false",
            "broadcast": "true",
            "rollupid": "87d7a7fb-af22-403b-ab0d-d101d9caac4f",
            "saved": "false",
            "canUnFollow": "true"
        },
        "title": "Joseph Bloggs commented on their own Top App entry.",
        "content": "<span class=\"vcard\"><a class=\"fn url\" title=\"This is a link to the profile of Joseph Bloggs.\" href=\"http://www.example.org/profiles/html/profileView.do?userid=12345678-8f0a-1028-xxxx-db07163b51b2\"><span class=\"photo\" src=\"http://www.example.org/profiles/photo.do?userid=12345678-8f0a-1028-xxxx-db07163b51b2\" alt=\"This is a photo of Joseph Bloggs.\" style=\"display : none\"></span>Joseph Bloggs</a><span class=\"x-lconn-userid\" style=\"display : none\">12345678-8f0a-1028-xxxx-db07163b51b2</span></span> commented on their own Top App entry.",
        "id": "urn:lsid:ibm.com:activitystreams:86c62a05-61de-4658-97a7-16e7ccf72e78",
        "updated": "2011-11-21T15:14:07.024Z",
        "object": {
            "summary": "This was my first comment",
            "objectType": "comment",
            "author": {
                "id": "12345678-8f0a-1028-xxxx-db07163b51b2",
                "displayName": "Joseph Bloggs"
            },
            "id": "5369ea82-d791-46cb-a87a-3696ff90d8f3",
            "url": "http://www.example.org/topapp/1028-xxxx-db07163b51b2/comments/1"
        },
        "verb": "post"
    }],
    "itemsPerPage": 1
}