Show TOC Start of Content Area

Procedure documentation Getting/Setting Attributes  Locate the document in its SAP Library structure

This section describes how to get and set object attributes using the Java semantic interfaces.

For more information on getting/setting attributes using administration interfaces, see Attributes. For more information on getting/setting attributes using PCD interfaces, see Contexts and Attributes.

Procedure

In the following examples, obj is a semantic Java object. For more information on retrieving an object, see Looking Up Objects.

      Getting Attributes and Meta-Attributes

response.write(obj.getAttribute("attribute"));

 

response.write(obj.getMetaAttribute("attribute", "meta-attribute"));

Text attributes generally require an additional parameter that indicates the locale.

The following attributes require the use of the locale:

       com.sap.portal.pcm.Title

       com.sap.portal.pcm.Description

The following meta-attributes require the use of the locale:

       plainDescription

       longDescription

       category

       validValueTitle0, validValueTitle1, and so forth.

response.write (obj.getAttribute ("attribute", request.getLocale() ) );

·        Setting Attributes

obj.putAttribute("attribute","value");

obj.save();

Attribute Constants

To specify an attribute, use the designated constant for that attribute. The constants for each semantic type are located in a corresponding interface in the com.sap.portal.pcm.attributes package.

For example, the constants for iView attributes are located in the IAttriView interface. The following code checks whether the current iView allows browser caching:

response.write(
    obj.getAttribute(IAttriView.ATTRIBUTE_ALLOW_BROWSER));

 

 

End of Content Area