Show TOC Start of Content Area

Background documentation Personalization  Locate the document in its SAP Library structure

The PCD can create different views of the PCD for different users.

In other words, for each attribute of an object, the PCD stores a default value and can also store different values for each user. When the PCD is queried for a specific user, the personalized value for that user is returned instead of the default value.

For example, an iView that displays the weather can have an attribute called City. Each user can set the City attribute to a different city, so that the weather for that city is displayed when that user displays the iViews.

Note

If an attribute’s inheritance meta-attribute is set to FINAL, the attribute cannot be personalized.

Getting a Personalized View of the PCD

You can obtain the personalized view of the PCD for a specific user by supplying the IPcdContext.PCD_PERSONALIZATION_PRINCIPAL variable with an IUser object for the user when creating the initial context, as follows:

// Create user for personalization

IUserFactory userFactory = UMFactory.getUserFactory();

IUser myUser = null;

 

myUser = userFactory.getUserByLogonID("userName");

 

// Create environment variables for initial context

Hashtable env = new Hashtable();

 

env.put(Context.INITIAL_CONTEXT_FACTORY,

    IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);

 

// Personalization variable

env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, request.getUser());

All PCD operations on an object will only affect the personalized view of that object.           

 

End of Content Area