SAP NetWeaver '04

Package com.sapportals.wcm.repository.service.appproperties

Contains classes and interfaces to persist information related to resources on the database.

See:
          Description

Interface Summary
IApplicationProperties The application properties service is used to persist arbitrary data for a resource.
IAppProperty An application-defined and personalized property of a resource object in any repository.
IAppPropertyCollection A read-only collection of application properties Copyright (c) SAP AG 2001-2004
IAppPropertyIterator An Iterator for an application property map.
IAppPropertyMap A read-only map of application properties.
IResourceAppPropertyMap A read-only map of application properties.
 

Class Summary
AppProperty An application-defined property of a resource object in any repository.
 

Package com.sapportals.wcm.repository.service.appproperties Description

Contains classes and interfaces to persist information related to resources on the database.

Package Specification

Purpose
Detailed_Concept
Interfaces_and_Classes
Code_Samples
Implementation_Notes

Purpose

The package implements a service that enables applications to persist information related to resources as application properties on the database. These properties are different to other KM properties like system, custom or predefined properties because they are not stored with resources in a repository. They are stored directly on the database and act as a container for any type of information that is related to a resource. 

Detailed Concept

Application properties are always associated with an application and must therefore use an application-defined namespace. They are particularly useful for repository types that do not support custom properties. For example, a file system (fs) repository does not support custom properties. This means application properties are the only way in which it can persist information related to resources. 

A further advantage of application properties is that they allow the storage of user-specific information for each resource. If a property is user-specific, it is stored individually for each user with a corresponding user-specific value. Other KM property types do not allow storage of user-specific values.

The application property service responds to resource events. This means it registers itself for the events that are triggered when a resource is renamed, deleted or copied. If a resource is renamed, the service ensures that that the resource keeps its properties. If a resource is deleted, the service ensures that its properties are also deleted. When a resource is copied the behavior of the service is controlled by a parameter that is specified when an application property is created. Depending on the value of the parameter the properties are either deleted or retained during the copying process.

Interfaces and Classes

The interfaces available for the application properties service enable programs to set, manipulate and access the application properties of a resource. The central interfaces are:

IApplicationProperties
This interface represents the application properties service. It offers methods to save the application properties of a resource, to delete properties or to access them. The methods for getting and setting properties differ, depending on whether user-specific properties or general properties are involved.

IAppProperty
An IAppProperty object represents an application property that is assigned to a resource.  The interface defines methods to access the value of a property and to find out other information about the property, for example, its type, whether it is multi-valued or whether it is copied when the resource is copied. An IAppProperty object is a prerequisite for defining a property. When it is instantiated it must be assigned a name from the application namespace to ensure that it is unique and cannot be overwritten. Also, it must be assigned a specific data type like boolean, date, integer, long or  stringThe data type dictates the methods that can be used to retrieve property values.

IAppPropertyMap and IResourceAppPropertyMap
These interfaces represent application properties in the form of a read-only map. IAppPropertyMap lists IAppProperty objects with their corresponding PropertyName.
IResourceAppPropertyMap lists IAppProperty objects with their corresponding resources. For example, the method getProperty(IPropertyName propertyName,IRidList ridList,ResourceContext context) returns a map that lists  IAppProperty objects with the specified name and corresponding resources. 

Code Samples

The code samples show you how to:

      //Get a resource and the application property service    

               IResource res = ResourceFactory.getInstance().getResource(rid); 

      s = res.getRepositoryManager().getService
       (IWcmConst.APP_PROPERTIES_SERVICE);

     if (s != null) {
       ps = (IApplicationProperties) s;

       throw new Exception("Application properties service
        not available");
     }

        PropertyName pName = new PropertyName("some_namespace", "name");


// Set application property

     ps.setProperty(new AppProperty(pName, "value", null, true),
     res);

// Get property by name

     IAppProperty appp = ps.getProperty(pName, res);
     System.out.println(appp.getStringValue());

// Set personalized property

     ps.setProperty(new AppProperty(pName, "personal value",
     "some_user_id", true), res);

// Get property by name and user ID

       appp = ps.getProperty(pName, res, "some_user_id");
       System.out.println(appp.getStringValue());


Implementation Notes

The current implementation of the property service persists properties on the database. Other implementations can persist the data elsewhere, for example, on the file system. 



SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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 and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.