Implementing an Extended Toolbox Application Using JSON List API

Context

To implement an extended toolbox application, you need to implement a portal component that provides the data to display in the extended toolbox. To do this, you use the JSON List API. The JSON List API, which is contained in the com.sap.portal.navigation.json.list package, enables you to create and consume portal components that expose lists of data that are represented as JSON objects. A JSON List component returns an ordered list of items and folders that contain items. The order of the list is defined by the insertion order (first in, first out).

The following example demonstrates how to use the JSON List API to implement an extended toolbox application that displays a list of documents.

The example shows how a single application can handle two scenarios, according to the content type of the request (MIME type). If the content type is application/json , then the getJSONList method is called; otherwise, the doContent method of the portal component is called. An example of such usage exists in the toolbox: if the value of the application's Mobile Perspective property is set to Toolbox Extended , a request for a JSON object attribute is made, whereas if the value is set to Toolbox , a standard call is made to the doContent method of the portal component.

Procedure

  1. In SAP NetWeaver Developer Studio, open the Enterprise Portal perspective and create a portal application project.

    For more information, see Creating a Portal Application Project .

  2. In the portalapp.xml file, set a sharing reference to com.sap.portal.navigation.json.helper.api .
  3. In the portal application project, create a portal component.
  4. Change the component inheritor class from AbstractPortalComponent to AbstractJSONListComponent .
  5. Add the following imports:
  6. Implement the AbstractJSONListComponent interface by implementing the getJSONList method. For example:
  7. To use the application as a regular portal component, you can also add an implementation in the doContent method of the portal component. For example:
  8. Build and deploy your application. For more information, see Deploying a Portal Application .
  9. Add the application to your mobile role.
  10. Set the value of the application's Mobile Perspective property to Toolbox Extended .
  11. Refresh your mobile portal and check that your application is visible in the extended toolbox.