Example: UserProfileExtendedSample.java

/* -----------------------------------------------------------------
**
** -----------------------------------------------------------------
*/
package com.ibm.servlet.personalization.userprofile;


import com.ibm.servlet.personalization.userprofile.UserProfile;
import com.ibm.websphere.userprofile.UserProfileExtender;


//Extensions of UserProfile to add new Columns should implement UserProfileExtender
public class UserProfileExtendedSample 
   extends com.ibm.servlet.personalization.userprofile.UserProfile 
   implements UserProfileExtender {

   //New column that is being added by this
   //derived class.
   public String cellPhone;

   //Manager Class will call this  method to append new Column types.
   //If UserProfile class is extended to append new columns
   //TOTAL COLUMNS: Base Class columns + columns returned by this class

   public  String[]  getNewColumns() {
      //If variable name is "cellPhone," you need to 
      //return "cellPhone" in array format. JDBC equivalent will be
      //generated automatically. You can add muliple columns.
      //For multiple columns: String newCol={"fieldName1","fieldName2",...};
      String[] newCol={"cellPhone"};
      return newCol;
   }

   public String getCellPhone() {
      // Need to call this method to
      // get the things from persistence store.
      return(String)getByType("cellPhone");
   }
    
   public  void setCellPhone String(value) {
      cellPhone = value;
      //Call this method to store the
      //things in persistence store
      setByType("cellPhone", value); 
   }
}

 

See Also

Managing user profiles
User profile development options