Lucky48390
asked on
java portlet for oracle portal
Hi All,
This seems like such a simple question, but nobody on Oracle's site seems to be able to come up with a response to it, so I thought I would give it a go here.
This is driving me nuts for a while now! Can somebody please please help me figure out what is wrong? I wish to get the user's First Name as it is stored in OID.
The code below seems as if it should work, but it only gives me the username, instead of the user's first name. Can anyone see if they know why?
imports:
oracle.portal.provider.v2. render.Por tletRender Request
oracle.portal.provider.v2. http.HttpC ommonConst ants
oracle.portal.provider.v2. http.Servl etProvider User
oracle.portal.provider.v2. oid.OidMan ager
oracle.portal.provider.v2. ProviderCo ntext
java.util.ResourceBundle
Work:
PortletRenderRequest pReq = (PortletRenderRequest)
request.getAttribute(HttpC ommonConst ants.PORTL ET_RENDER_ REQUEST);
ProviderContext pc = pReq.getProviderInstance() .getProvid erContext( );
OidManager oidman = pReq.getProviderInstance() .getOidMan ager();
String first_name = (oidman != null) ? pReq.getUser().getFirstNam e().toStri ng() : pReq.getUser().getName().t oString();
Thanks in advance!
Lisa
This seems like such a simple question, but nobody on Oracle's site seems to be able to come up with a response to it, so I thought I would give it a go here.
This is driving me nuts for a while now! Can somebody please please help me figure out what is wrong? I wish to get the user's First Name as it is stored in OID.
The code below seems as if it should work, but it only gives me the username, instead of the user's first name. Can anyone see if they know why?
imports:
oracle.portal.provider.v2.
oracle.portal.provider.v2.
oracle.portal.provider.v2.
oracle.portal.provider.v2.
oracle.portal.provider.v2.
java.util.ResourceBundle
Work:
PortletRenderRequest pReq = (PortletRenderRequest)
request.getAttribute(HttpC
ProviderContext pc = pReq.getProviderInstance()
OidManager oidman = pReq.getProviderInstance()
String first_name = (oidman != null) ? pReq.getUser().getFirstNam
Thanks in advance!
Lisa
is oidman null, or is it returning the wrong name?
This discusses how to use the OidManager:
http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/jpdk/v2/doc/oid/installing.oid.portlets.htm
http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/jpdk/v2/doc/oid/installing.oid.portlets.htm
Are you setting the manager
http://www.phaos.com/resources/docs/Phaos_Crypto_2.2.3/apidoc/com/phaos/utils/OIDManager.html#setOIDManager(com.phaos.utils.OIDManager)
Or using the default manager?
http://www.phaos.com/resources/docs/Phaos_Crypto_2.2.3/apidoc/com/phaos/utils/OIDManager.html#setOIDManager(com.phaos.utils.OIDManager)
Or using the default manager?
ASKER
Hi Objects, oidman is returning null. So I am left with LMMXP instead of Lisa. Also, I am using an Oracle API and there is no setOidManager() class in it. There are classes to set LDAP information. Do you think i would need to do all of that?
CEHJ, the OidManager has been configured properly
Thanks for all your input - i really appreciate it
CEHJ, the OidManager has been configured properly
Thanks for all your input - i really appreciate it
Where do you initialise the provider?
ASKER
I thought that the object would be out there waiting for me to grab in the portal instance. So, I tried a different approach, and am now receiving a "Listener returned the following message: 500 Internal Server Error" at the line of code containing the asterisks...
PortletRenderRequest pReq = (PortletRenderRequest)
request.getAttribute(HttpC ommonConst ants.PORTL ET_RENDER_ REQUEST);
ProviderContext pc = pReq.getProviderInstance() .getProvid erContext( );
***************OidManager oidman = new OidManager(pc);*********** ********** **
DirContext userContext = oidman.getUserLDAPContext( pReq.getUs er().getUs erDN(),pRe q.getUser( ).getSubsc riberDN()) ;
ResourceBundle bundle = ResourceBundle.getBundle(" welcome_po rtlet.MlsR esourceBun dle", pReq.getLocale());
String first_name = (pReq.getUser().isLDAPEnab led()) ? oidman.getUserProperty(pRe q.getUser( ).getUserD N(),pReq.g etUser().g etSubscrib erDN(), "givenname") : pReq.getUser().getName().t oString();
PortletRenderRequest pReq = (PortletRenderRequest)
request.getAttribute(HttpC
ProviderContext pc = pReq.getProviderInstance()
***************OidManager oidman = new OidManager(pc);***********
DirContext userContext = oidman.getUserLDAPContext(
ResourceBundle bundle = ResourceBundle.getBundle("
String first_name = (pReq.getUser().isLDAPEnab
Try
OidManager oidman = pReq.getProviderInstance() .getOidMan ager();
OidManager oidman = pReq.getProviderInstance()
> OidManager oidman = pReq.getProviderInstance() .getOidMan ager();
That returns null
That returns null
If it returns null, as opposed to causing NPE that may suggest that the OidManager is not configured properly
ASKER
It returns null. That is how it was programmed originally. It does not throw an exception. I will verify again that it is configured properly.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok - i'm back... Sorry it took so long. DBA's have tripple verified that the OidManager is configured properly... :( This is so irritating, I might consider calling the pl/sql api...
ASKER
Ok - it didn't matter how i did it the Oracle JPDK API would not work! So i said forget it and used the JNDI java api - and it worked on the first try!
I'm going to split the points b/w the two of you anyways because you have both helped me out so much in the past. :)
Thanks for your efforts!
I'm going to split the points b/w the two of you anyways because you have both helped me out so much in the past. :)
Thanks for your efforts!
:-)
Good to hear u got it working :)
System.out.println((Collec