0 Replies Latest reply: Feb 29, 2012 10:15 AM by 894552 RSS

    Profile customized attribute is not working?

    894552
      Hi,

      I downloaded ‘WCSpacesExtensions’ project from Oracle because I want to add some customize attributes to Profile. I added ‘project’ to ExtendedProfileAttributes.java, and created getter and setter methods. In a jsff, this is my EL #{wcProfileCustomAttribute['securityContext.userName'].project}. The setProject() sets up the attribute, but when getProject() is invoked, ‘project’ is returned as NULL.

      Every time the jsff page references the attributes via EL, it creates a new instance ExtendedProfileAttributes obj. because you can see it calls the constructor over and over. It saves value of ‘sip’ (=> setSip():12345), but when trying to read its value, it's NULL (=> getSip():null). So, I can't read and save the attribute per user.

      Any feedback is greatly appreciated.

      .jsff page
      <mds:insert after="oliplam3" parent="olipfl1"
      xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <af:panelLabelAndMessage xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
      label="*Sip" id="splam2">
      <af:inputText xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="sit1"
      value="#{wcProfileCustomAttribute[(pageFlowScope.userId == null ? securityContext.userName : pageFlowScope.userId)].sip}"/>
      </af:panelLabelAndMessage>
      </mds:insert>
      <mds:insert after="splam2" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <af:panelLabelAndMessage xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
      label="*Proj" id="splam3">
      <af:inputText xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="sit2"
      value="#{wcProfileCustomAttribute[(pageFlowScope.userId == null ? securityContext.userName : pageFlowScope.userId)].project}"/>
      </af:panelLabelAndMessage>
      </mds:insert>
      ExtendedProfileAttributes.java

      package custom.webcenter.spaces;

      import oracle.adf.share.logging.ADFLogger;

      /**
      * This is a sample class for profile extension
      * Add getter (and setter if you need to save)
      * for any new custom attribute.
      * New attriutes defined here can be acessed
      * via EL like
      * #{wcProfileCustomAttribute['smith'].sip}
      * in the jspx/jsff.
      */
      public class ExtendedProfileAttributes
      {
      private String sip;
      private String project;
      public ExtendedProfileAttributes(String profileID)
      {
      // Query from custom attribute source and cache them
      //project = profileID + "'s Project";
      //mSIP = profileID + "'s SIP address!!!***";
      //mStreetAddress = profileID + "'s street address";
      System.out.println("ExtendedProfileAttributes(). user:" + profileID);
      System.out.println("ExtendedProfileAttributes(). sip:" + sip + " project:" + project);
      }
      public void setSip(String s) {
      this.sip = s;
      System.out.println("=> setSip():" + this.sip);
      }

      public String getSip() {
      System.out.println("=> getSip():" + this.sip);
      return this.sip;
      }
      private static String CLASS_NAME = ExtendedProfileAttributes.class.getName();

      public void setProject(String project) {
      this.project = project;
      System.out.println("=> setProject():" + this.project);
      }

      public String getProject() {
      System.out.println("=> getProject():" + this.project);
      return project;
      }
      }

      DEBUGGING:
      ===========
      ExtendedProfileAttributes(). user:securityContext.userName
      ExtendedProfileAttributes(). sip:null project:null
      => setSip():12345
      ExtendedProfileAttributes(). user:weblogic
      ExtendedProfileAttributes(). sip:null project:null
      => setProject():333
      <Feb 24, 2012 11:24:57 AM EST> <Warning> <oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer> <ADF_FACES-60099> <The region component with id: T:wcCmdLinkGSSwit:spaceSwitcherComp:crtGS has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.>
      <Feb 24, 2012 11:24:57 AM EST> <Warning> <oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer> <ADF_FACES-60099> <The region component with id: T:spcNavPanel:dc_r3 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.>
      ExtendedProfileAttributes(). user:weblogic
      ExtendedProfileAttributes(). sip:null project:null
      ExtendedProfileAttributes(). user:weblogic
      ExtendedProfileAttributes(). sip:null project:null
      ExtendedProfileAttributes(). user:weblogic
      ExtendedProfileAttributes(). sip:null project:null
      => getSip():null

      Thank you.