Show TOC

Background documentationPersonalization Locate this document in the navigation 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 Note

If an attribute's Inheritance meta-attribute is set to Locked in target objects (FINAL), the attribute cannot be personalized.

More information: Defining Property Attributes.

End of the note.
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:

Syntax Syntax

  1. // 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());
    
End of the code.

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