Package com.ibm.portal.services.contentmapping

This package provides the Content Mapping Service APIs.

See:
          Description

Interface Summary
Committable An interface to commit modifications done via a controller.
ContentMapping Objects of this class describe a mapping between a portal resource and a content resource.
ContentMappingDelegationService Individual content mappings can be flagged to activate access control delegation.
ContentMappingFilter This interface defines a filter for Content Mappings.
ContentMappingInfo This interface provides access to all content mappings assigned to a specific portal resource.
ContentMappingInfoController This interface provides write access to content mapping information
ContentMappingInfoHome This interface is the home of all APIs providing access to content mapping information.
ContentMappingInfoProvider This interface provides access to avialable content mapping information in scope of a given portal resource.
ContentMappingLocator This interface can be used for searching specific content mappings based on various filter criteria.
GlobalContentMappingDelegationService Individual content mappings can be flagged to activate access control delegation.
LongestPathMatch This interface represents the result of a longest path match.
ModifiableContentMappingInfo This interface allows to modify the content mapping information associated to a given portal resource.
ResourceLocator This interface can be used for searching portal resources based on existing content mappings.
ScopeProvider This interface describes an individual content mapping scope provider.
 

Package com.ibm.portal.services.contentmapping Description

This package provides the Content Mapping Service APIs.

Overview

The Content Mapping Service allows management of individual content mappings represented by the com.ibm.portal.services.contentmapping.ContentMapping interface. Objects implementing this interface describe a mapping between a portal resource and a content resource. The content resource is identified either by its unique string identifier (e.g. JCR guid) or its absolute content path. Portal resources are identified via their ObjectID.

Lotus Web Content Management (LWCM) uses such mapping for retrieving the best suited portal page for a given LWCM content item or LWCM component and for determining the default content to be rendered on a given LWCM portal page.

Code Sampels

Service Lookup

Context ctx = new InitialContext();
ContentMappingInfoHome myHome = (ContentMappingInfoHome) ctx.lookup(ContentMappingInfoHome.JNDI_NAME);

Retrieve content mappings for a given portal resource

ContentMappingInfo cmi = myHome.getContentMappingInfo(somePortalResourceID);

System.out.println("ContentMappingInfo is empty: " + cmi.isEmpty());
System.out.println("Available scopes: " + cmi.getScopes());
for (String scope : cmi.getScopes()) {
    System.out.println("Default mapping for scope " + scope + " is " + cmi.getDefaultContentMapping(scope));
}
System.out.println("Default mapping for the default scope is " + cmi.getDefaultContentMapping());


List contentMappings = cmi.getContentMappings();
for (ContentMapping mapping : contentMappings) {
    System.out.println("Mapped content id: " + mapping.getContentID());
    System.out.println("Mapped content path: " + mapping.getContentPath());
    System.out.println("Mapping scope: " + mapping.getScope());
    System.out.println("Mapped is the default mapping in its scope: " + mapping.isDefault());
    System.out.println("Mapped is activated for delegation: " + mapping.isDefault());
    System.out.println();
}

Add a new content mappings to a given portal resource

ContentMappingInfoController ctrl = myHome.getContentMappingInfoController();
ModifiableContentMappingInfo mcmi = ctrl.createModifiableContentMappingInfo(somePortalResourceID);
// or ModifiableContentMappingInfo mcmi = ctrl.createModifiableContentMappingInfo(someContentMappingInfoObject);

// add a non default mapping to a content id in the default scope
mcmi.addContentID("someContentID", false, null);

// add a default mapping to a content id within the default scope
mcmi.addContentID("someContentID2", true, null);

// add a default mapping to a content id with delegation enabled
mcmi.addContentID("someContentID4", false, null, true);

// add a non default mapping to a content path in the default scope
mcmi.addContentPath("/some/path", false, null);

// add a default mapping to a content path in the default scope
mcmi.addContentPath("/some/path/1", false, null);

// add a default mapping to a content path in a specific scope with delegation enabled:
mcmi.addContentPath("/some/path/3", false, "scope1", true);

ctrl.commit();

Remove content mappings from a given portal resource

ContentMappingInfoController ctrl = myHome.getContentMappingInfoController();
ModifiableContentMappingInfo mcmi = ctrl.createModifiableContentMappingInfo(somePortalResourceID);
// or ModifiableContentMappingInfo mcmi = ctrl.createModifiableContentMappingInfo(someContentMappingInfoObject);

// remove a mapping to a content id
mcmi.removeContentID("someContentID");

// remove a mapping to a content path
// it is save to use null for the content resource proxy param since we the change does not affect delegation
mcmi.removeContentPath("/some/path");

ctrl.commit();

Modify a content mapping

ContentMappingInfoController ctrl = myHome.getContentMappingInfoController();
ModifiableContentMappingInfo mcmi = ctrl.createModifiableContentMappingInfo(somePortalResourceID);
// or ModifiableContentMappingInfo mcmi = ctrl.createModifiableContentMappingInfo(someContentMappingInfoObject);

// modify scope by content ID
mcmi.setScopeByContentID("someContentID", someScope);

// modify scope by content path
mcmi.setScopeByContentPath("/some/path", someScope);

// set the default flag by content ID
mcmi.setDefaultByContentID("someContentID", true);

// unset the default flag by content path
mcmi.setDefaultByContentPath("/some/path", false);

// modify delegation flag by content ID
mcmi.setDelegatingByContentID("someContentID", false);

// modify delegation flag by content path
mcmi.setDelegatingByContentPath("/some/path", true);

ctrl.commit();