Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle WebCenter
11g Release 1 (11.1.1)
E10148-02
  Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

10 Integrating with Oracle WebCenter Spaces

This chapter describes how to expose Oracle WebCenter Spaces functionality in a custom WebCenter application, using WebCenter Spaces APIs. Through these APIs, you can create group spaces, manage group space membership, retrieve group space information, and more, from your custom WebCenter applications.

The chapter also describes how to expose information from other applications, such as custom WebCenter applications in WebCenter Spaces.

This chapter includes the following sections:


Note:

Custom-built task flows that implement group space APIs (described in this chapter) can be deployed on custom WebCenter applications, but you cannot deploy them to WebCenter Spaces. To find out how to build task flows for WebCenter Spaces that include calls to local group space APIs, refer to the whitepaper "Extending WebCenter Spaces" on the Oracle Technology Network.

Audience

This section is intended for developers who want to expose WebCenter Spaces functionality in their custom WebCenter applications. or who are building custom applications that will be integrated with WebCenter Spaces.

10.1 Introduction to WebCenter Spaces

WebCenter Spaces is a Web-based application, built using the Oracle WebCenter Framework, WebCenter Web 2.0 services, and Oracle Composer, that offers the very latest technology for social networking, communication, collaboration, and personal productivity. Figure 10-1 shows the WebCenter Spaces home page.

Figure 10-1 Oracle WebCenter Spaces

Description of Figure 10-1 follows
Description of "Figure 10-1 Oracle WebCenter Spaces"

Out of the box, WebCenter Spaces offers a configurable work environment that enables individuals and groups to work and collaborate more effectively. The application is a self-service solution for managing individual and group interactions. It also provides intuitive tools that allow business users to come together and share information by adding pages and resources such as documents, charts, reports, portlets, business applications, Web 2.0 services, and other ADF resources or views.

WebCenter Spaces provides two work environments within a single application: personal spaces and group spaces. Personal spaces provide each user with a private work area for storing personal content, keeping notes, viewing and responding to business process assignments, maintaining a list of online buddies, and performing many other tasks relevant to his or her unique working day. Group spaces support discrete work areas organized around an area of interest or a common goal.

In WebCenter Spaces, group spaces support the formation and collaboration of project teams and communities of interest. Group spaces bring people together in a virtual environment for ongoing interaction and information sharing—in essence, forming a social network. Figure 10-2 shows an example of a group space.

Figure 10-2 An Oracle WebCenter Group Space

Description of Figure 10-2 follows
Description of "Figure 10-2 An Oracle WebCenter Group Space"

Structurally, group spaces are comprised of pages, many of which are dedicated to a particular service. For example, a Documents page provides a central library for uploading, organizing, and managing group content. A Lists page provides the means to create and publish multicolumn lists. A Search page includes features for saving searches and managing search results. In addition to these and other default pages, a group space supports custom pages created by authorized users. Page creation is easy with a wide selection of predefined layouts. With little effort, users can provide pages neatly tailored to the unique needs of their team or community. For more information about group spaces, see the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

WebCenter provides various services that group spaces can use to offer a wide variety of functionality in support of group objectives. For example, a Documents service provides features for uploading and managing content; a Discussions service provides features for creating, managing, and participating in discussion forums. Some other examples of these services include Events, Lists, Announcements, and Search. These services are what helps to make group spaces a productive, collaborative working environment. Services expose subsets of their features and functionality through task flows. A task flow is a reusable view that may expose all or a subset of the features available from a particular service. For example, a Recent Documents task flow provides a subset of the functionality offered through the Documents service by listing documents that have recently been opened, added, or affected in some way.

To help users get group spaces up and running quickly, they can be based on out-of-the-box templates. These templates provide the optimal structure for supporting the two main types of group space. Use the Group Project template for group spaces where each member potentially comes from a different department but all members contribute toward reaching a common goal. Use the Community of Interest template to help create a group space for a community of people joining together to collaborate, create content, share ideas, and so on. Additionally, WebCenter Spaces allows users to turn any group space into a template, so they can design group spaces to suit specific audiences and offer them up as templates for others to use. For information about creating templates, see "Creating Your Own Group Space Templates" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

WebCenter Spaces can consume portlets from any WSRP or Oracle PDK-Java portlet producer if the producer is registered first. Therefore, any portlets you create for custom WebCenter applications can be used in WebCenter Spaces too. For more information, see the "Managing Portlet Producers" chapter in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

10.2 Programmatically Exposing WebCenter Functionality in Custom WebCenter Applications

While using your custom WebCenter application, users may encounter situations where a group space would be useful to help them complete a particular task. In such cases, it would be much less disruptive to remain within the context of the current application, rather than having to switch to the WebCenter Spaces application. To this end, WebCenter Spaces provides access to a subset of its group space functionality through several APIs. Using these APIs, you can integrate powerful group space functionality into your custom WebCenter application.

You can use WebCenter Spaces APIs to:

WebCenter Spaces APIs are contained within several classes. Table 10-1 lists the different classes and describes the purpose of the APIs within each class.

Table 10-1 WebCenter Spaces API Classes

Class Contains APIs for More Information

GroupSpaceWSClient

Creating and managing group spaces and templates

Managing group space membership

Retrieving group space information

Section 10.2.4, "How to Provide Group Space Functionality in Custom WebCenter Applications"


GroupSpaceWSContext

Establishing context before calling the APIs

Section 10.2.3.4, "Setting Up the Group Space Client Context"


GroupSpaceWSException

Managing exceptions raised by the APIs

Section 10.2.5, "How to Handle Exceptions Raised by WebCenter Spaces APIs"


GroupSpaceWSMembers

Retrieving information about group space members

Section 10.2.4.3, "Retrieving Group Space and Template Information"


GroupSpaceWSMetadata

Retrieving group space information

Section 10.2.4.3, "Retrieving Group Space and Template Information"



Group spaces have many different applications. From your perspective, as a custom WebCenter application developer, here are a couple of case studies describing scenarios where building and working with group spaces through the APIs might come in useful:

10.2.1 Case Study 1: Purchasing Application Uses a Group Space to Evaluate Suppliers

Consider a purchasing application built using the Oracle WebCenter Framework. This application tracks suppliers, pricing, lead-time requirements, delivery time estimates, and performance history.

Users of the purchasing application must also be able to select and evaluate supplier candidates. Supplier evaluation is a collaborative process; it requires people from various areas of a company. For example, a design engineer and manufacturing representative must verify that an item being purchased meets the required technical specifications; a purchasing agent can negotiate prices, logistics and contractual issues; and a manager or executive has to approve the deal. How could the purchasing application initiate supplier evaluations?

Typically, the purchasing manager receives a purchase requisition from the manufacturing department. Sometimes the purchase order cannot be completed because the requisition cannot be delivered by the usual supplier in the time frame required by manufacturing. Therefore, a new supplier that can meet delivery and pricing requirements must be determined. The purchasing manager can add a candidate supplier into the system but the purchasing manager needs a way to organize and share information, and collaborate with people in and outside his team so that he can assess the supplier.

A group space would provide this collaborative environment. So the purchasing application includes a call to the createGroupSpace API, and this enables the purchasing manager to click a link (Create a New Group Space) that displays a Create Group Space dialog, directly from the purchasing application, as shown in Figure 10-3.

Figure 10-3 Purchasing Application Includes a Group Space Creation Link

Description of Figure 10-3 follows
Description of "Figure 10-3 Purchasing Application Includes a Group Space Creation Link"

When the purchasing manager clicks the link a custom dialog prompts him for some information. The purchasing manager enters a name and description for the group space, and also selects a template (Purchasing Projects) as shown in Figure 10-4. The Purchasing Projects template sets up the group space quickly so it is ready to use right away. For example, the template defines which services are required (events, a document library, and so on) and any custom pages that may be required. Because the APIs enable you to create your own Create Group Space dialog, you can apply your own look and feel and terminology.

Figure 10-4 Custom Create Group Space Dialog

Description of Figure 10-4 follows
Description of "Figure 10-4 Custom Create Group Space Dialog"

In this scenario, the purchasing manager chooses the Purchasing Projects template from the template list. Another approach would be to have the purchasing application pass in a default template value. With this additional default, there would be one less thing (determining which template to use) for the purchasing manager to think about. You could even generate the name of the group space from the Supplier ID so that the purchasing manager would not have to enter any details at all. The group space could then be created with just the click of a link.

When the purchasing manager clicks OK, WebCenter Spaces displays the new Supplier Evaluation group space in WebCenter Spaces, as shown in Figure 10-5.

Figure 10-5 Supplier Evaluation Group Space

Description of Figure 10-5 follows
Description of "Figure 10-5 Supplier Evaluation Group Space"

Figure 10-5 shows the Home page for the Supplier Evaluation group space, which includes an events calendar, documents the group may find useful, an area for announcements, and so on. Each of these areas was determined by the Purchasing Projects template. In addition a link to the purchasing application transaction instance from which the group space was created is also provided. Clicking this link (Add/Update Vendors) displays the screen Add/Update Vendor transaction for the supplier Shaker Distribution.

In WebCenter Spaces, the purchasing manager becomes the moderator of the group space automatically. The moderator can add content to the group space, initiate discussions, invite members, and collaborate with interested parties. Once consensus is reached regarding the supplier, the purchasing manager is can approve or reject the supplier concerned.

10.2.2 Case Study 2: Customer Support Center Application Uses a Group Space to Discuss Customer Escalation

Consider a Customer Support Center application built using the Oracle WebCenter Framework that tracks customer calls and issues.

A support analyst is notified that a customer has escalated the service request that the analyst has been working on. The analyst knows that she can find a quicker resolution to the issue if she can involve other people from different areas of the company. For example:

  • The project manager whose team implemented the project can provide more in depth knowledge of the project.

  • An account manager who has been in constant touch with the customer can provide specific information about the implementation of the project at the customer site.

  • Another support analyst, who has worked on a similar escalation before, can provide information about how that escalation was resolved.

This problem can be solved collaboratively using a group space. The support analyst creates a group space from within the Customer Support Center application and adds the required members. These members are then notified and use the group space to start discussing the customer situation. The support analyst views their updates to the group space inside the support application, navigating to the group space whenever necessary to obtain more specific details. Based on the information she gets from the other members of the group space, she can diagnose the problem and offer the customer a solution very quickly.

10.2.3 How to Set Up Your Custom WebCenter Application to Use the WebCenter Spaces APIs

Before you can use the WebCenter Spaces APIs you must ensure that the WebCenter Spaces application is up and running and that your project is set up correctly in JDeveloper.

This section includes the following subsections:

10.2.3.1 Verifying That WebCenter Spaces Is Up and Running

If you want to use the WebCenter SpacesAPIs, the WebCenter Spaces application must be up and running.

To verify that WebCenter Spaces is up and running:

  1. Start WebCenter Spaces. The URL is:

    http://host:port/webcenter
    

    You do not need to log in.

  2. Verify that the WebCenter Spaces Web service is up and running. The URL is:

    http://host:port/webcenter/SpacesWebService?WSDL
    

    You should see a page similar to the one shown in Figure 10-6. If you do not see this page, contact your Fusion Middleware administrator.

    Figure 10-6 SpacesWebService WSDL

    Description of Figure 10-6 follows
    Description of "Figure 10-6 SpacesWebService WSDL"

For more information about setting up WebCenter Spaces, see the "Getting WebCenter Spaces Up and Running" chapter in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

10.2.3.2 Setting Up the Custom WebCenter Application to Use WebCenter Spaces APIs

Before you can call the WebCenter Spaces APIs in your custom WebCenter application, you must ensure that your application contains the correct libraries and that there is a connection to the WebCenter Spaces Web service.

To set up your application to use the WebCenter Spaces APIs:

  1. Start JDeveloper.

  2. In the Application Navigator, expand the application for which you want to provide group space functionality.

    The application should be based on the WebCenter Application template.

  3. Right-click the view-controller project and choose Project Properties.

  4. Select Libraries and Classpath.

  5. Check that the following libraries are available in your project, adding any as necessary:

    • ADF DVT Faces Runtime

    • ADF Model Generic Runtime

    • ADF Model Runtime

    • JAX-RPC Client

    • JAX-WS Client

    • JAXB

    • Oracle JEWT

    • WebCenter Spaces Client

    • JDEV_HOME/jdeveloper/modules/oracle.adf.model_11.1.1/adfm.jar

    • JDEV_HOME/jdeveloper/modules/oracle.xdk_11.1.1/xml.jar

  6. Click OK.

  7. In the Application Resources panel of the Application Navigator, right-click Connections and choose New Connection > URL.

  8. In the Name field, enter SpacesWebServiceEndpoint.

  9. In the URL Endpoint field, enter the WebCenter Spaces Web service URL:

    http://host:port/webcenter/SpacesWebService
    
  10. Click OK.

    The connection information is added to the connections.xml file in the application's META-INF directory, for example:

    C:\JDeveloper\mywork\mySpacesApplication\.adf\META-INF
    

    If the connections.xml file does not exist, it is created.

  11. Open the connections.xml file and verify that the code shown in Example 10-1 appears:

    Example 10-1 WebCenter Spaces Web Service Endpoint URL Connection

    <Reference name="SpacesWebServiceEndpoint"
    className="oracle.adf.model.connection.url.HttpURLConnection">
    <Factory className="oracle.adf.model.connection.url.URLConnectionFactory"/>
    <RefAddresses>
      <XmlRefAddr addrType="SpacesWebServiceEndpoint">
        <Contents>
          <urlconnection name="SpacesWebServiceEndpoint"
          url="http://host:port/webcenter/SpacesWebService"/>
        </Contents>
      </XmlRefAddr>
    </RefAddresses>
    </Reference>
    

    If you need to set the WebCenter Spaces Web service endpoint at runtime, you can use the setGroupSpaceWebServiceEndpoint API (Example 10-2). You can write a wrapper API that takes the endpoint as a parameter and then calls setGroupSpaceWebServiceEndpoint, passing the parameter. An exception is raised if the endpoint is already set in connections.xml.

    Example 10-2 Setting the WebCenter Spaces Web Service Endpoint at Runtime

    client.setGroupSpacesWebServiceEndpoint("http://myserver.example.com/webcenter/SpacesWebService");
    

10.2.3.3 Securing the Connection Between the Application and WebCenter Spaces

Before using the WebCenter Spaces APIs in your custom WebCenter application, you must ensure that the communication between the application (the consumer) and WebCenter Spaces (the producer) is secure. This is so that the identity of the user invoking the APIs is propagated to WebCenter Spaces in a secure manner where the integrity and confidentiality of the communication is maintained.

To do this, the WebCenter Spaces APIs use a policy of SAML based token passing with message protection. Your administrator must create a Java keystore and update the credential store so that WebCenter Spaces can verify the authenticity of the security tokens received from your application. You must then register this keystore and update the credential store using JDeveloper.

For information about the steps that the administrator must perform, see "Securing WebCenter Spaces for Applications Consuming Spaces Client APIs with WS-Security" in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

Before You Begin

Obtain the following from your administrator:

  • Consumer keystore to use to secure the connection. This is a .jks file (for example, consumer.jks).

  • Consumer public alias key stored in the keystore (for example, consumer).

  • Password of the consumer public alias key (for example, mypassword1).

  • Producer public alias key stored in the consumer keystore (for example, producer). This is the alias specified by the administrator when importing the trusted certificate of the producer.

  • Consumer keystore password (for example, mypassword2).

To secure the connection:

  1. Copy the keystore to the file system where your custom WebCenter application is running, for example:

    domain_home/config/fmwconfig
    
  2. Open the jps-config.xml file and configure the keystore created by your administrator (Example 10-3).

    Example 10-3 Keystore Instance in jps.config.xml

    <!-- KeyStore Service Instance -->
        <serviceInstance name="keystore" provider="keystore.provider"
        location="./consumer.jks">
            <description>Default JPS Keystore Service</description>
            <property name="keystore.type" value="JKS"/>
                <property name="keystore.csf.map" value="oracle.wsm.security"/>
            <property name="keystore.pass.csf.key" value="keystore-csf-key"/>
            <property name="keystore.sig.csf.key" value="enc-csf-key"/>
            <property name="keystore.enc.csf.key" value="enc-csf-key"/>
        </serviceInstance>
    

    You can use Fusion Middleware Control to specify the keystore location if you prefer. For more information see "Registering the Keystores" in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

  3. Take a backup of cwallet.sso.

  4. Open a command line prompt.

  5. Navigate to the directory where JDeveloper is installed, for example:

    C:\Jdev\jdeveloper\common\bin
    
  6. Run the following command:

    • In Windows: wlst.cmd

    • In Linux: ./wlst.sh

  7. Run:

    connect('admin_user', 'admin_password', 'host:port')
    

    Where:

    • admin_user is the user name for the administrator of the server on which the application is running (for example, weblogic)

    • admin_password is the password for the administrator (for example, weblogicpwd1)

    • host:port is the server on which the application is running

  8. Run the following commands:

    createCred(map="oracle.wsm.security", key="enc-csf-key", user="alias", password="key_password", desc="Enc Password")
    
    createCred(map="oracle.wsm.security", key="sign-csf-key", user="alias", password="key_password", desc="Enc Password")
    
    createCred(map="oracle.wsm.security", key="keystore-csf-key", user="keystore-csf-key", password="keystore_password", desc="Keystore password")
    

    Where:

    • alias is the consumer public alias key in the keystore

    • key_password is the password for the public key

    • keystore_password is the keystore password

    You can obtain this information from your administrator, as detailed in the "Before You Begin" section.

    If you need any additional help to run these commands, see the "createCred" section in the Oracle Fusion Middleware WebLogic Scripting Tool Command Reference.

    You can use Fusion Middleware Control to update the credential store if you prefer. For more information see the "Securing WebCenter Spaces for Applications Consuming Spaces Client APIs with WS-Security" section in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

  9. Restart the server on which your application is deployed, and then your default server.

10.2.3.4 Setting Up the Group Space Client Context

Before calling any of the WebCenter Spaces APIs in your application code, a few setup steps are required.

To set up the group space client context

  1. Domain-wide configuration settings are used when you call WebCenter Spaces APIs from an application deployed on WebLogic Server (WLS), unless you specifically choose to override them. To override or set security configuration parameters, use the APIs provided by the GroupSpaceWSContext class.

    In particular, you must set the SAML issuer name and the public key alias for WebCenter Spaces, which are required for data encryption. If the WebCenter Spaces Web service endpoint is not set in the connections.xml file, you can set this too.

    For example:

    GroupSpaceWSContext context = new GroupSpaceWSContext();
    
    context.setEndPoint("endPointUrl");
    context.setSamlIssuerName("samlIssuer");
    context.setRecipientKeyAlias("producer");
    
    groupSpaceWSClient = new GroupSpaceWSClient(context);
    

    Where:

    • endPointUrl is the WebCenter Spaces Web service endpoint, for example, http://server.example.com:8912/webcenter/SpacesWebService).

    • samlIssuer is the issuer URI of the SAML Authority issuing assertions for this SAML Asserting Party (for example, http://www.example.com/webcenter)

    • producer is the public key alias for WebCenter Spaces, for example, wcspaces.

      You can obtain this information from your administrator, as detailed in the "Before You Begin" section.

    For a full list of the APIs provided by the GroupSpaceWSContext class, see the Oracle Fusion Middleware WebCenter Group Spaces Java API Reference.

  2. Initialize the group space client by passing the context. For example:

    GroupSpaceWSClient client = new GroupSpaceWSClient(context);
    
  3. Once you have initialized the client, check everything is set up correctly by calling:

    getWebCenterSpacesURL();
    

    If the correct URL is returned, everything is set up correctly and you can start using the group space APIs.

10.2.4 How to Provide Group Space Functionality in Custom WebCenter Applications

The WebCenter Spaces APIs enable you to perform commonly used group space operations within a custom WebCenter application. Most of these APIs are provided by the GroupSpaceWSClient class. The APIs can be grouped into three main categories:

Table 10-2 lists the APIs in the GroupSpaceWSClient class.

Table 10-2 APIs for Performing Common Group Space Operations

Group Space API Category Description

createGroupSpace

Managing Group Spaces and Templates

Creates a new group space based on a template. See Section 10.2.4.1.1, "Creating a Group Space."

setCustomAttribute

Managing Group Spaces and Templates

Creates one or more custom attributes for a group space. See Section 10.2.4.1.2, "Creating a Custom Attribute."

deleteGroupSpace

Managing Group Spaces and Templates

Permanently removes a group space from WebCenter Spaces. See Section 10.2.4.1.4, "Deleting a Group Space."

createGroupSpaceTemplate

Managing Group Spaces and Templates

Creates a new group space template based on an existing group space. See Section 10.2.4.1.3, "Creating a Group Space Template."

addMember

Managing Group Space Membership

Adds a group space member with a specific role. See Section 10.2.4.2.1, "Adding Members to a Group Space."

inviteMember

Managing Group Space Membership

Invites a list of users to become members of a group space. See Section 10.2.4.2.2, "Inviting Users to Join a Group Space."

removeMember

Managing Group Space Membership

Revokes group space membership. See Section 10.2.4.2.3, "Removing Members from a Group Space."

getRoles

Managing Group Space Membership

Retrieves all the roles for a given group space. See Section 10.2.4.2.4, "Retrieving Role Information."

getGroupSpaces

Retrieving Group Space and Template Information

Retrieves a list of group spaces for a given query string. See Section 10.2.4.3.1, "Retrieving a List of Group Spaces."

getPublicGroupSpaces

Retrieving Group Space and Template Information

Retrieves a list of public group spaces for a given query string. See Section 10.2.4.3.2, "Retrieving a List of Public Group Spaces."

getGroupSpaceMetadata

Retrieving Group Space and Template Information

Retrieves information (metadata) about the group space. See Section 10.2.4.3.3, "Retrieving Group Space Metadata."

getGroupSpaceMetadataByGuid

Retrieving Group Space and Template Information

Retrieves information (metadata) about a group space given the group space's GUID. See Section 10.2.4.3.3, "Retrieving Group Space Metadata."

getGroupSpaceTemplates

Retrieving Group Space and Template Information

Retrieves a list of group space templates for a given query string. See Section 10.2.4.3.4, "Retrieving a List of Group Space Templates."

getGroupSpaceTemplateMetadata

Retrieving Group Space and Template Information

Retrieves information (metadata) about the group space template. See Section 10.2.4.3.5, "Retrieving Group Space Template Metadata."

getGroupSpaceTemplateMetadataByGuid

Retrieving Group Space and Template Information

Retrieves information (metadata) about the group space template given the template's GUID. See Section 10.2.4.3.5, "Retrieving Group Space Template Metadata."

getWebCenterSpacesURL

Retrieving Group Space and Template Information

Retrieves the WebCenter Spaces URL. See Section 10.2.4.3.6, "Retrieving the WebCenter Spaces URL."

getGroupSpaceURL

Retrieving Group Space and Template Information

Retrieves a group space URL. See Section 10.2.4.3.7, "Retrieving a Group Space URL."


10.2.4.1 Managing Group Spaces and Templates

Use the following WebCenter Spaces APIs to manage your group spaces:

  • createGroupSpace

  • setCustomAttribute

  • createGroupSpaceTemplate

  • deleteGroupSpace

Before you begin

Before using any of these APIs, you must complete all the steps listed in Section 10.2.3, "How to Set Up Your Custom WebCenter Application to Use the WebCenter Spaces APIs."

This section includes the following subsections

10.2.4.1.1 Creating a Group Space

Use the createGroupSpace API to create a group space that is based on an existing group space template.

To use this API, specify:

  • The internal name of the new group space. This name can contain spaces.

  • A display name for the new group space.

  • A description of the group space. Although this is not mandatory, we recommend that you provide a description to help users identify the group space's purpose.

  • The name of the group space template you want to use. This should be the internal name of the template, not the display name. For example, the internal names for the built-in templates are Basic, CommunityOfInterest, and ProjectSpace.

Optionally, you can provide a comma separated list of keywords to help users locate the group space in searches.

Example 10-4 creates a group space with the name Databases that is based on the CommunityofInterest template. The example also specifies two search keywords (databases and Oracle).

Example 10-4 Creating a Group Space

//create the group space
GroupSpaceWSMetadata gsMetadata = 
client.createGroupSpace("Databases", "Databases" "A community for people interested in databases", "databases, oracle", "CommunityofInterest");
//print the group space GUID to provide confirmation of creation
System.out.println("GUID: " + gsMetadata.getGuid());

For an example of how to provide custom attributes for a new group space, see Section 10.2.4.1.2, "Creating a Custom Attribute."

10.2.4.1.2 Creating a Custom Attribute

Every group space comes with built-in attributes such as name, description, date created, icon, and so on. In addition, you can define custom attributes that store additional information (metadata) that is unique to the group space and its characteristics.

Use the setCustomAttribute API to specify a custom attribute for a group space. To use this API, specify the name of the group space and a name, description, type, and value for the custom attribute.

Example 10-5 creates the Databases group space and then creates a custom attribute for that group space. The attribute is named Vendors, with the description List of vendors. It takes string values of Oracle and IBM.

Example 10-5 Creating a Custom Attribute

//create the group space
client.createGroupSpace("Databases", "Databases", "A community for people interested in databases", null, "CommunityofInterest");
//create the custom attribute
client.setCustomAttribute("Databases", "Vendors", "List of vendors", "java.lang.String", "Oracle, IBM");
10.2.4.1.3 Creating a Group Space Template

Use the createGroupSpaceTemplate API to create a group space template based on an existing group space. To use this API specify a name, display name, and description for the template, and the name of the group space to use to create the template.

Example 10-6 creates a group space template based on the Databases group space.

Example 10-6 Creating a Group Space Template

GroupSpaceWSMetadata templMetadata =
client.createGroupSpaceTemplate("DatabasesTemplate", "Databases Template", 
"A template based on the Databases group space", "Databases");
//print the template GUID to provide confirmation of creation
System.out.println("GUID: " + templMetadata.getGuid());
10.2.4.1.4 Deleting a Group Space

Use the deleteGroupSpace API to permanently delete a group space from WebCenter Spaces. To use this API, specify the name of the group space to delete. The API returns a boolean value to indicate whether the deletion was successful.

Example 10-7 deletes the group space with the name Databases. The example uses the boolean value returned by the API to print a message about the success or failure of the operation.

Example 10-7 Deleting a Group Space

//delete the group space
Boolean success = client.deleteGroupSpace("Databases");
//print a message depending on the result of the deletion
if(success)
{
  System.out.println("Operation Succeeded");
}
else
{
  System.out.println(Operation Failed");
}

10.2.4.2 Managing Group Space Membership

Use the following group space APIs to manage group space membership:

  • addMember

  • inviteMember

  • removeMember

  • getRoles

Before you begin

Before using any of these APIs, you must complete all the steps listed in Section 10.2.3, "How to Set Up Your Custom WebCenter Application to Use the WebCenter Spaces APIs."

This section includes the following subsections:

10.2.4.2.1 Adding Members to a Group Space

Use the addMember API to give users group space membership and assign the new members to a group space role. To use this API, specify the name of the group space, and a list of users. The list must contain objects of type GroupSpaceWSMembers that specify the user name and the role to give that user in the group space.

You must specify a valid user name that exists in the WebCenter Spaces identity store. For the role, choose one of the default roles (moderator, participant, viewer) or one of the custom group space roles (if any). To retrieve a list of the available roles for a group space, use the getRoles API. For more information, see Section 10.2.4.2.4, "Retrieving Role Information." For more information about roles, see the "What You Should Know About Group Space Roles and Permissions" section in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

Example 10-8 adds users (of type GroupSpaceWSMembers) named Pat and Vicki as members of the Databases group space with viewer and participant roles respectively.

Example 10-8 Adding Members to a Group Space

//create the list of users
List addMem = new ArrayList();
//create the GroupSpaceWSMembers objects
GroupSpaceWSMembers mem1 = new GroupSpaceWSMembers("pat", "viewer");
GroupSpaceWSMembers mem2 = new GroupSpaceWSMembers("vicki", "participant");
//add the GroupSpaceWSMembers objects to the list of users
addMem.add(mem1);
addMem.add(mem2);
//add the users to the group space
client.addMember("Databases", addMem);
//print a list of members to confirm the new members were added
GroupSpaceWSMetadata memMetData = client.getGroupSpaceMetadata("Databases");
for (GroupSpaceWSMembers mems: memMetData.getMembers())
{
  System.out.println(mems.getMember());
  System.out.println(mems.getRole());
}
10.2.4.2.2 Inviting Users to Join a Group Space

Use the inviteMember API to invite users to become members of a group space. To use this API, specify the name of the group space and a list of users to invite. The list must contain objects of type GroupSpaceWSMembers that specify the user name and the role to give that user in the group space. An invitation to join the group space is sent to each user, and each user can then accept or reject that invitation.

You must specify a valid user name that exists in the WebCenter Spaces identity store. For the role, choose one of the default roles (moderator, participant, viewer) or one of the custom group space roles (if any). To retrieve a list of the available roles for a group space, use the getRoles API. For more information, see Section 10.2.4.2.4, "Retrieving Role Information." For more information about roles, see the "What You Should Know About Group Space Roles and Permissions" section in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

Example 10-9 invites users (of type GroupSpaceWSMembers) named Pat and Vicki to become members of the Databases group space with viewer and participant roles respectively.

Example 10-9 Inviting Users to Join a Group Space

//create the list of users
List inviteMem = new ArrayList();
//create the GroupSpaceWSMembers objects
GroupSpaceWSMembers mem1 = new GroupSpaceWSMembers("pat", "viewer");
GroupSpaceWSMembers mem2 = new GroupSpaceWSMembers("vicki", "participant");
//add the GroupSpaceWSMembers objects to the list of users
inviteMem.add(mem1);
inviteMem.add(mem2);
//invite the list of users to join the group space
client.inviteMember("Databases", inviteMem);
10.2.4.2.3 Removing Members from a Group Space

Use the removeMember API to revoke group space membership. To use this API, specify the name of the group space, and a list of users. The list must contain objects of type GroupSpaceWSMembers that specify the user name. To obtain a list of current group space members, use the getGroupSpaceMetadata API. For more information, see Section 10.2.4.3.3, "Retrieving Group Space Metadata."

Example 10-10 removes users (of type GroupSpaceWSMembers) Pat and Vicki from the membership of the Databases group space.

Example 10-10 Removing Members from a Group Space

//create the list of users
List remMem = new ArrayList();
//create the GroupSpaceWSMembers objects
GroupSpaceWSMembers mem1 = new GroupSpaceWSMembers("pat");
GroupSpaceWSMembers mem2 = new GroupSpaceWSMembers("vicki");
//add the GroupSpaceWSMembers objects to the list of users
remMem.add(mem1);
remMem.add(mem2);
//remove the users from the group space
client.removeMember("Databases", remMem);
//print a list of members to confirm the members were removed
GroupSpaceWSMetadata memMetData = client.getGroupSpaceMetadata("Databases");
for (GroupSpaceWSMembers mems: memMetData.getMembers())
{
  System.out.println(mems.getMember());
  System.out.println(mems.getRole());
}
10.2.4.2.4 Retrieving Role Information

Use the getRoles API to retrieve all the roles for a given group space. This is useful for determining which roles are available when adding or inviting members to a group space. Roles include the default roles (moderator, participant, viewer) as well as custom group space roles (if any). To use this API, specify the name of the group space.

Example 10-11 retrieves and displays role information for the Databases group space.

Example 10-11 Retrieving Role Information

//retrieve the list of roles
List<String> roles = client.getRoles("Databases");
//print the list of roles
for (String role: roles)
{
  System.out.println(role);
}

10.2.4.3 Retrieving Group Space and Template Information

Use the following group space APIs to retrieve group space information:

  • getGroupSpaces

  • getPublicGroupSpaces

  • getGroupSpaceMetadata

  • getGroupSpaceMetadataByGuid

  • getGroupSpaceTemplates

  • getGroupSpaceTemplateMetadata

  • getGroupSpaceTemplateMetadataByGuid

  • getWebCenterSpacesURL

  • getGroupSpaceURL

Before you begin

Before using any of these APIs, you must complete all the steps listed in Section 10.2.3, "How to Set Up Your Custom WebCenter Application to Use the WebCenter Spaces APIs."

This section includes the following subsections

10.2.4.3.1 Retrieving a List of Group Spaces

Use the getGroupSpaces API to obtain a list of group spaces that match a given query string. To use this API, specify a query string. A null value query string returns a list of all group spaces that are accessible to the current user.

The API returns group spaces that are accessible to the current user, up to a maximum of 500.

Example 10-12 returns a list of group spaces containing the string Database.

Example 10-12 Retrieving a List of Specific Group Spaces

List<String> allGroupSpaces = client.getGroupSpaces("Database");

Example 10-13 returns a list of all group spaces to which the current user has access. This is achieved by specifying a null query string.

Example 10-13 Retrieving a List of All Group Spaces

List<String> allGroupSpaces = client.getGroupSpaces(null)
10.2.4.3.2 Retrieving a List of Public Group Spaces

Use the getPublicGroupSpaces API to obtain a list of public group spaces that match a given query string. To use this API, specify a query string. A null value query string returns a list of all public group spaces.

The API returns group spaces that are accessible to all users, even those who are not logged in to WebCenter Spaces, up to a maximum of 500.

Example 10-14 returns a list of public group spaces containing the string Database.

Example 10-14 Retrieving a List of Specific Public Group Spaces

List<String> allPublicGroupSpaces = client.getPublicGroupSpaces("Database");

Example 10-15 returns a list of all public group spaces. This is achieved by specifying a null query string.

Example 10-15 Retrieving a List of All Public Group Spaces

List<String> allPublicGroupSpaces = client.getPublicGroupSpaces(null)
10.2.4.3.3 Retrieving Group Space Metadata

Use the getGroupSpaceMetadata or getGroupSpaceMetadataByGuid APIs to obtain information (metadata) about a particular group space. This includes information such as the description of the group space, the name of the user who created it, the date on which it was last updated, and so on.

To use the getGroupSpaceMetadata API, specify the name of the group space. To use the getGroupSpaceMetadataByGuid API, specify the GUID of the group space. Note that while the group space name may be changed during the existence of the group space, the GUID always remains the same. You can obtain the GUID of a group space as follows:

getGroupSpaceMetadata("spaceName").getGuid();

Both APIs return a bean object that contains more APIs that you can then use for retrieving the group space metadata. These APIs are provided by the GroupSpaceWSMetadata class. Table 10-3 lists the APIs returned by the bean object:

Table 10-3 APIs for Retrieving Group Space Metadata

Group Space API Description

getCreatedBy

Returns the name of the person who created the group space.

getCustomAttributes

Returns the custom attributes for a group space.

getDescription

Returns the description of the group space.

getDisplayName

Returns the display name of the group space.

getGroupSpaceState

Returns the state of the group space: active, offline, deleted.

getGuid

Returns the GUID of the group space.

getIconURL

Returns the location of the group space icon.

getKeywords

Returns a comma separated list of keywords used to describe the group space.

getLastUpdated

Returns the date the group space was last updated.

getLogoURL

Returns the location of the group space logo.

getMailingList

Returns the mailing list for the group space.

getMembers

Returns the current list of group space members.

getName

Returns the internal name of the group space.

isDiscoverable

Returns if the group space is returned in searches made by users who are not members of the group space.

isPublic

Returns if the group space is available to users who are not logged in.


Example 10-16 retrieves the Description, Keywords, and Last Updated Date information for the Databases group space given the group space name.

Example 10-16 Retrieving Group Space Metadata Using the Group Space Name

//get the exact name of the group space
List<String> myGroupSpace = client.getGroupSpaces("Databases");
//check that the API returns a single result
if(myGroupSpace.size() == 1)
{
  //retrieve the metadata
  GroupSpaceWSMetadata metadata = client.getGroupSpaceMetadata(myGroupSpace);
  //get group space description
  System.out.println("Description: " + metadata.getDescription());
  //get group space keywords
  System.out.println("Keywords: " + metadata.getKeywords());
  //get the date the group space was last updated
  System.out.println("Last Updated Date: "+ metadata.getLastUpdated().toString());
}

Example 10-17 retrieves the Display Name, Creator, and Last Updated Date information for the Databases group space given the group space GUID.

Example 10-17 Retrieving Group Space Metadata Using Group Space GUID

GroupSpaceWSMetadata metadata = client.getGroupSpaceMetadataByGuid("Guid");
//get group space display name
System.out.println("Display Name: " + metadata.getDisplayName());
//get the name of the user who created the group space
System.out.println("Created By: " + metadata.getCreatedBy());
//get the date the group space was last updated
System.out.println("Last Updated Date: " + metadata.getLastUpdated().toString());

Example 10-18 retrieves the Name, Description, Type, and Value for every custom attribute associated with the Databases group space.

Example 10-18 Retrieving Custom Attribute Metadata

//get the exact name of the group space
List<String> myGroupSpace = client.getGroupSpaces("Databases");
//check that the API returns a single result
if(myGroupSpace.size() == 1)
{
  //retrieve the metadata
  GroupSpaceWSMetadata metadata = client.getGroupSpaceMetadata(myGroupSpace);
  //get list of custom attributes
  List<CustomMetadata.Attribute> attributes = metadata.getCustomAttributes();
  //get name, description, type, and value for each custom attribute
  for(CustomMetadata.Attribute attribute: attributes)
  {
    System.out.println("Name :" + attribute.getName());
    System.out.println("Description :" + attribute.getDescription());
    System.out.println("Type :" + attribute.getType());
    System.out.println("value.toString() :" + attribute.getValue().toString());
  }
}

Example 10-19 retrieves a list of members of the Databases group space.

Example 10-19 Retrieving Membership Information

//get the exact name of the group space
List<String> myGroupSpace = client.getGroupSpaces("Databases");
//check that the API returns a single result
if(myGroupSpace.size() == 1)
{
  //retrieve the metadata
  GroupSpaceWSMetadata metadata = client.getGroupSpaceMetadata(myGroupSpace);
  //get the list of members
  for(String member: metadata.getMembers())
  {
    System.out.println("Member UID: " + member);
  }
}
10.2.4.3.4 Retrieving a List of Group Space Templates

Use the getGroupSpaceTemplates API to obtain a list of group space templates that match a given query string. To use this API, specify a query string. A null value query string returns a list of all templates that are accessible to the current user.

The API returns templates that are accessible to the current user, up to a maximum of 500.

Example 10-20 returns a list of group space templates containing the string Interest.

Example 10-20 Retrieving a List of Specific Group Space Templates

List<String> allGroupSpaceTemplates = client.getGroupSpaceTemplates("Interest");

Example 10-21 returns a list of all group space templates to which the current user has access. This is achieved by specifying a null query string.

Example 10-21 Retrieving a List of All Group Space Templates

List<String> allGroupSpaceTemplates = client.getGroupSpaceTemplates(null);
10.2.4.3.5 Retrieving Group Space Template Metadata

Use the getGroupSpaceTemplateMetadata and getGroupSpaceTemplateMetadataByGuid APIs to obtain information (metadata) about a particular group space template. This includes information such as the description of the template, the name of the user who created it, and so on.

To use the getGroupSpaceTemplateMetadata API, specify the name of the template. To use the getGroupSpaceTemplateMetadataByGuid API, specify the GUID of the template. Note that while the group space template name may be changed during the existence of the template, the GUID always remains the same.

Both APIs return a bean object that contains more APIs that you can then use for retrieving the group space template metadata. These APIs are provided by the GroupSpaceWSMetadata class. Table 10-4 lists the APIs returned by the bean object:

Table 10-4 APIs for Retrieving Group Space Template Metadata

Group Space API Description

getCreatedBy

Returns the name of the person who created the template.

getDescription

Returns the description of the template.

getDisplayName

Returns the display name of the template.

getGuid

Returns the GUID of the template.

getIconURL

Returns the location of the template icon.

getKeywords

Returns a comma separated list of keywords used to describe the template.

getLogoURL

Returns the location of the template logo.

getName

Returns the internal name of the template.


Example 10-22 retrieves the GUID, Description, and Created By information for the CommunityofInterest group space template given the template name.

Example 10-22 Retrieving Template Metadata Using the Template Name

GroupSpaceWSMetadata metadata = client.getGroupSpaceTemplateMetadata(myGroupSpaceTemplate);
//get the exact name of the group space template
List<String> myGroupSpaceTemplate = client.getGroupSpaceTemplates("CommunityofInterest");
//check that the API returns a single result
if(myGroupSpaceTemplate.size() == 1)
{
  //retrieve the metadata -- get GUID
  System.out.println("GUID: " + metadata.getGuid());
  //get template description
  System.out.println("Description: " + metadata.getDescription());
  //get name of user who created the template
  System.out.println("Keywords: " + metadata.getCreatedBy());
}

Example 10-23 retrieves the name of a group space template given the template GUID.

Example 10-23 Retrieving Template Metadata Given the Template GUID

GroupSpaceWSMetadata templGuidMetadata = client.getGroupSpaceTemplateMetadataByGuid("Guid");
System.out.println("Template Name: " + templGuidMetadata.getName());
10.2.4.3.6 Retrieving the WebCenter Spaces URL

Use the getWebCenterSpacesURL API to obtain the URL of WebCenter Spaces.

Example 10-24 retrieves the URL of the currently running instance of WebCenter Spaces.

Example 10-24 Retrieving the WebCenter Spaces URL

String myWebCenterSpacesURL = client.getWebCenterSpacesURL();
10.2.4.3.7 Retrieving a Group Space URL

Use the getGroupSpaceURL API to obtain the URL of a specific group space. This is useful for when you want to construct a hyperlink for a group space or you have a relative URL that you need to make into an absolute URL. To use this API, specify the name of the group space.

Example 10-25 retrieves the URL of the Databases group space.

Example 10-25 Retrieving a Group Space URL

String myGroupSpaceURL = client.getGroupSpaceURL("Databases");

Example 10-26 prints a list of group spaces as hyperlinks.

Example 10-26 Printing a List of Group Spaces as Hyperlinks

//get the list of group spaces
List<String> spaces = client.getGroupSpaces("");
//print the list of group spaces as hyperlinks
for (String spaceName : spaces)
{
  print("<a href =""" + client.getGroupSpaceURL(spaceName) + "">" + spaceName + "</a><br>");
}

To construct the URL of a particular group space page, retrieve the group space URL and then add the page information. For information about how to create pretty URLs for group space pages, see "Using Pretty URLs for WebCenter Spaces Pages" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

10.2.5 How to Handle Exceptions Raised by WebCenter Spaces APIs

The GroupSpaceWSException class provides APIs for handling exceptions raised by the group space APIs.

Table 10-5 Group Space APIs in the GroupSpaceWSException Class

API Class Description

getLocalizedMessage

GroupSpaceWSException

Composes the localized error message.

printStackTrace

GroupSpaceWSException

Prints the exception and its back trace to the standard error stream.


This section includes the following subsections:

10.2.5.1 Providing Localized Error Messages

Sometimes you may find that the default error messages provided by the APIs are not specific enough for your particular application. In these cases you can provide your own error messages.

Use the getLocalizedMessage API to compose application-specific error messages.

Example 10-27 shows a servlet that includes code to create a group space. If any exceptions are raised during the creation process, a localized message is printed.

Example 10-27 Printing a Localized Error Message

servlet1.java

doGet()
{
...
  print("<b>Output</b>");
  try
    {
      GroupSpaceWSClient client = new GroupSpaceWSClient(context);
      client.createGroupSpace("Databases", "Databases, "A community for people interested in databases", "databases, oracle", "CommunityofInterest");
      print("Successfully created group space");
    }
  catch(GroupSpaceWSException ex)
    {
      if(ex instanceof GroupSpaceNameNullException)
        print(ex.getLocalizedMessage());
      else if (ex instanceof GroupSpaceDescNullException)
        print(ex.getLocalizedMessage());
    }
...
}

10.2.5.2 Listing the Error Stack

For debugging purposes, it is often useful to see which errors ultimately led to the failure of a particular operation to discover the underlying cause of the problem. Use the printStackTrace API to list all the errors that caused a particular exception.

Example 10-28 prints the exception and all the errors leading up to it.

Example 10-28 Listing the Error Stack

servlet1.java

doGet()
{
...
  print("<b>Output</b>");
  try
    {
      GroupSpaceWSClient client = new GroupSpaceWSClient(context);
      client.createGroupSpace("Databases", "Databases", "A community for people interested in databases", "databases, oracle", "CommunityofInterest");
      print("Successfully created group space");
    }
  catch(GroupSpaceWSException ex)
    {
      ex.printStackTrace();
    }
...
}

10.2.6 Finding Further Information

API Reference Documentation
For detailed syntax information for each API, see the Oracle Fusion Middleware WebCenter Group Spaces Java API Reference.

10.3 Exposing Enterprise Applications in WebCenter Spaces

You can expose various enterprise applications inside WebCenter Spaces, including:

Technologies such as WSRP, Oracle JSF Portlet Bridge, ADF task flows, and WebCenter support for external applications, enable WebCenter Spaces to consume and present application data in a unified way. The following sections tell you how.

This section includes the following subsections:

10.3.1 Exposing Custom WebCenter Applications in WebCenter Spaces

You can expose custom WebCenter applications, built using the WebCenter Framework, as portlets and task flows in WebCenter Spaces:

  • Portlets: Web components that are deployed inside a container and generate dynamic content. For more information, see Chapter 27, "Overview of Portlets."

  • Oracle JSF Portlet Bridge: A technology that enables you to easily expose existing ADF applications and task flows as JSR 168 portlets. For more information, see Chapter 28, "Creating Portlets with the Oracle JSF Portlet Bridge."

  • Task flows: ADF navigational components that define the transition between states and activities using call methods on managed beans, evaluating an EL expression, and so on. For more information see, "Getting Started with ADF Task Flows" in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

10.3.2 Exposing Oracle Applications in WebCenter Spaces

You can expose Oracle Applications Unlimited products, for example, E-Business Suite, Siebel, PeopleSoft, and JDEdwards, in WebCenter Spaces, using:

  • Web services and ADF: Enterprise applications like Siebel expose various web service interfaces. You can leverage these web service interfaces to build data controls, ADF task flows, and portlets that can be consumed in WebCenter Spaces.

  • Prebuilt portlets: Enterprise applications such as Oracle E-Business Suite ship portlets out of the box that you can register with WebCenter Spaces and consume in the same way as any other portlet.

10.3.3 Exposing Non-Oracle Applications in WebCenter Spaces

You can expose web applications developed using non-Oracle platforms in WebCenter Spaces, as follows:

  • WebCenter support for external applications: External applications enable credential stores to pass mapped user identities to web applications that require their own authentication. For more information, see "Registering External Applications" in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter and "Working with External Applications" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

  • Oracle Composer iframe-level integration: The Oracle Composer Web Page page style and component display any web page content, including pages from applications built using a different web technology. For more information, see "Working with Page Layouts, Styles, and Schemes" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

  • Raw HTML markup injection in Oracle Composer: The Oracle Composer HTML Markup layout component injects HTML or JavaScript snippets into WebCenter Spaces pages. You can use this component to display content from an external source. For more information see "Working with HTML Markup Layout Component Properties" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

  • OmniPortlet: A portlet that publishes data from various data sources using a variety of layouts. For more information, see Chapter 31, "Creating Portlets with OmniPortlet."