Introduction to the Application Properties Service of KM

SAP Developer Network

Applies To:

Knowledge Management 6.0


This article describes the application properties service. The purpose of this service is to persist properties of resources in the KM database independent of a specific repository. Coding examples are provided to demonstrate how you can store and retrieve properties.

By Markus Breitenfelder

21 Nov 2005



This repository service is available in Knowledge Management 6.0 and later releases. As of NW04 SPS13, it is also available as a global service. It is contained in the jar file:

Concepts and API

The application properties service can be used by any KM or portal component in the system to persist arbitrary data in the database using a resource identifier (RID) as the key (unique identifier). The service uses the notion of a “property” for the data, which is very similar to the one used by the repository framework: A property consists of a name and a data type and can have a value or a list of values. The IAppProperty interface defines a property of this type, which you can store and retrieve using the methods in IApplicationPropertiesService.

You may ask yourself why such a service was invented when the repository framework already offers resource properties. First of all, the application properties are independent of a repository. A certain repository might have special restrictions for the property names or values – or it might not support properties at all (for example, the file-system repository). Secondly, the service offers some features that are not available for resource properties.

The API provides a method to store, retrieve, and remove properties and a method to search for RIDs using property values as search criteria. The service supports user-specific properties. In the Javadoc, the term “personalized” property is used. This means that a property of this type is associated with a user name (more precisely, the unique identifier of a user as defined by the UME), which has to be given as an argument when the property is created. The API also provides methods to retrieve or delete all properties associated with a particular user ID.

To sum up things to this point, we could characterize the service as a persistency for simple objects such as integers, dates, and strings using the RID, property name, and user ID as keys. But the service has a few more useful features because it is integrated in the repository framework as an event receiver. This means it handles the Delete, Rename/Move, and Copy events that are created by the repository framework for all repository operations. If a resource is deleted, the service removes all the properties from the database. Rename and move operations are handled in such a way that all properties are related to the new RID. If a resource is copied, you can choose whether all properties are also copied – you have to make that choice when creating a property.

Finally, I want to emphasize the fact that application properties are not resource properties – neither at the API level (different interface) nor at the user interface level, which means they cannot be retrieved using the IResource.getProperty/getProperties methods and therefore do not show up on the KM user interface.



IApplicationPropertiesService (NW04)

IApplicationProperties (KM 6.0)

The main service interface.

IAppProperty, AppProperty

Defines the property data: name, data type, value(s), and copy flag.

IAppPropertyCollection, IAppPropertyIterator, IAppPropertyMap, IResourceAppPropertyMap

These are returned by the various methods in IApplicationPropertiesService that retrieve properties.

Coding Examples

Storing and Retrieving Properties

This example demonstrates how to create instances of properties and insert them in the database.

// Get a reference to the service from the RF
IApplicationPropertiesService apService =
// This is the resource we are going the associate the property with
IResource resource = ...
// Create the property object.
IPropertyName name = new PropertyName("test", "test");
IAppProperty prop = new AppProperty(name, "value", null, false);
// Set property – an existing property with the same RID and name will be
apService.setProperty(prop, resource);

Now we are going to retrieve the property from the database.

IAppProperty prop = apService.getProperty(name, resource);
if (prop != null {

With the following method we can retrieve all properties for a resource:

IAppPropertyMap properties = apService.getProperties(resource);

User-Specific Properties

To create a user-specific property, the third argument of the constructor must specify the user ID. This should be the unique ID of the IPrincipal object in the UME.

IAppProperty prop = new AppProperty(name, "value", principal.getUniqueID(),

If we want to retrieve a user-specific property associated with a resource, we can use the following method:

IAppProperty prop = apService.getProperty(name, resource,

Executing Queries

The API offers a method to search for resources (RIDs) using the property values as search criteria. Note that the result might contain resources in many repositories. You cannot restrict the results to a single repository. The RIDs in the result list are guaranteed to be unique (no duplicates). In the following code example, we search for all resources that contain a user-specific property where the Boolean value equals "true".

IPropertyName name = new PropertyName("test", "test");
String userID = principal.getUniqueID();
IRidList result =, userID, Boolean.TRUE,
if (result.size() > 0) {
  IResourceList rl = ResourceFactory.getInstance()
                                    .getResources(result, context);

Table of Contents

Content Options

Copyright © 2005 SAP AG, Inc. All Rights Reserved. SAP, mySAP,, xApps, xApp, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product, service names, trademarks and registered trademarks mentioned are the trademarks of their respective owners.

SAP Developer Network