Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

java portlet for oracle portal

Posted on 2005-04-25
17
Medium Priority
?
711 Views
Last Modified: 2011-09-20
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.PortletRenderRequest
oracle.portal.provider.v2.http.HttpCommonConstants
oracle.portal.provider.v2.http.ServletProviderUser
oracle.portal.provider.v2.oid.OidManager
oracle.portal.provider.v2.ProviderContext
java.util.ResourceBundle

Work:
PortletRenderRequest pReq = (PortletRenderRequest)
request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);

ProviderContext pc = pReq.getProviderInstance().getProviderContext();

OidManager oidman = pReq.getProviderInstance().getOidManager();

String first_name = (oidman != null) ? pReq.getUser().getFirstName().toString() : pReq.getUser().getName().toString();

Thanks in advance!
Lisa
0
Comment
Question by:Lucky48390
  • 6
  • 6
  • 5
17 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 13862222
Try finding out what names are available:

System.out.println((Collections.list(pReq.getAttributeNames()));
0
 
LVL 92

Expert Comment

by:objects
ID: 13862562
is oidman null, or is it returning the wrong name?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13862946
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Expert Comment

by:objects
ID: 13863329
0
 
LVL 1

Author Comment

by:Lucky48390
ID: 13866458
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


0
 
LVL 92

Expert Comment

by:objects
ID: 13870995
Where do you initialise the provider?
0
 
LVL 1

Author Comment

by:Lucky48390
ID: 13886125
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(HttpCommonConstants.PORTLET_RENDER_REQUEST);
   ProviderContext pc = pReq.getProviderInstance().getProviderContext();
   
   ***************OidManager oidman = new OidManager(pc);***********************
   
   DirContext userContext = oidman.getUserLDAPContext(pReq.getUser().getUserDN(),pReq.getUser().getSubscriberDN());
   
   ResourceBundle bundle = ResourceBundle.getBundle("welcome_portlet.MlsResourceBundle", pReq.getLocale());
 
   String first_name = (pReq.getUser().isLDAPEnabled()) ? oidman.getUserProperty(pReq.getUser().getUserDN(),pReq.getUser().getSubscriberDN(), "givenname") : pReq.getUser().getName().toString();

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13886895
Try

OidManager oidman = pReq.getProviderInstance().getOidManager();
0
 
LVL 92

Expert Comment

by:objects
ID: 13889987
> OidManager oidman = pReq.getProviderInstance().getOidManager();

That returns null
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13890220
If it returns null, as opposed to causing NPE that may suggest that the OidManager is not configured properly
0
 
LVL 1

Author Comment

by:Lucky48390
ID: 13897563
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.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 13898100
ProviderInstance

"Returns:
    OidManager or null depending upon whether the OidManager has been configured."
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 13898421
> as opposed to causing NPE that may suggest that the OidManager is not configured properly

Already asked above whether it has been initialised correctly :)



0
 
LVL 1

Author Comment

by:Lucky48390
ID: 14116459
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...
0
 
LVL 1

Author Comment

by:Lucky48390
ID: 14243387
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!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 14243561
:-)
0
 
LVL 92

Expert Comment

by:objects
ID: 14245886
Good to hear u got it working :)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question