• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Using Puma service in web application at WAS

 
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can I use the PUMA service for getting the logged in user information(portal) in the web application which is developed at Websphere Application Server?

Regards,

Ravi


 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ravi Kumar R.S " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.
 
Ranch Hand
Posts: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can check the below link for details on using PUMA service:

http://www.ibm.com/developerworks/websphere/zones/portal/proddoc/dw-w-pumascenarios/index.html
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you cannot use PUMA API to retrieve user info.

That is exactly where Servlets and Portlets differ.

Portlets provide us a way to retrieve the User info. Portal User Management Archictecture(PUMA) has been specifically there to provide you with features to access Logged in User Profile.

Here is an example :

private PumaUtil() {
try {
Context ctx = new InitialContext();
Object puma = ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
pumaService = (PortletServiceHome)puma;
pumaHome = (PumaHome)pumaService.getPortletService(PumaHome.class);
pumalocator = pumaHome.getLocator();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PortletServiceUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* This method returns the PumaProfile
*
* @return a PumaProfile object.
*/
private PumaProfile getPumaProfile() {

return pumaHome.getProfile();
}

/**
* This method will return the PumaController Objects
* @return
*/
public PumaController getPumaController(){
return pumaHome.getController();
}

/**
* This method will return the list of user attributes.
* @return list of User attributes
*/
public List getLoggedInUserAttributes(){
List userAttr = new ArrayList();
try {
userAttr = getPumaProfile().getDefinedUserAttributeNames();
} catch (Exception e) {
logger.logError("Error while fetching the User Attribute Map from Portal Database:::" +
" Message:::" + e.getMessage());
}
return userAttr;
}

/**
* This method will return the Map of user attributes.
* This map can be modified to update the attribute values for the user
* @return list of User attributes
*/
public Map getLoggedInUserAttributeMap(){
Map userMap = new HashMap();
try {
userMap = getPumaProfile().getAttributes(getPumaProfile().getCurrentUser(), getLoggedInUserAttributes());
}catch (Exception e) {
logger.logError("Error while fetching the User from Portal Database:::" +
" Message:::" + e.getMessage());
}
return userMap;
}

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a related problem in my application. I'm implementing the following code in jsp file to display the logged in user id on the top right in the application. But lately I have discovered that it displays the entire loginid inconsistently. Ex. if the login id is Deboshree Roy - LntInfotech, the application displays only Deboshree Roy only.But for id's which I have migrated into the application for them it displays the complete login id (Ex. Jon Tim - British Airways).
This is the code in my JSP file:

<%@ taglib uri="/WEB-INF/tld/portal.tld" prefix="wps" %>
<%@ taglib uri="/WEB-INF/tld/portal-internal.tld" prefix="wps-internal" %>
<%@ include file="../extension/TagLibInclude.jsp" %> <%-- This includes Extend/Express specific tag libraries. --%>
<%@page import="java.util.StringTokenizer"%>
<%@page import="com.ibm.portal.portlet.service.PortletServiceHome"%>
<%@page import="com.ibm.portal.puma.User"%>
<%@page import="com.ibm.portal.um.PumaHome"%>
<%@page import="com.ibm.portal.um.PumaProfile"%>

<wps-internal:adminNavHelper/>
<wps:constants/>
<wps:defineObjects/>
<html>

<%@ include file="./Head.jsp" %>
<%
String user_objid = "";
String strUser = null;
com.ibm.portal.puma.User portalUser= (com.ibm.portal.puma.User)request.getAttribute(com.ibm.portal.RequestConstants.REQUEST_USER_OBJECT);
if (portalUser != null) {
strUser=portalUser.getFullName();
}
%>

If anyone has successfully displayed loginid in a JSr 168 application on Portal 6.1 please do let me know.The application is integrated with LDAP to obtain the login details.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at this http://wpcertification.blogspot.com/2009/03/sample-puma-code.html sample code that demonstrate how to use PUMA code in portal.

Starting from WPS 6.1 you can use JavaScript to access and modify (If your user repository is writable) User profile information. Take a look at http://wpcertification.blogspot.com/2009/02/sample-code-for-working-with-user.html for sample on how to do that.

Sunil
http://wpcertification.blogspot.com
 
Greenhorn
Posts: 15
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can read the blog IBM Portal User Management Architecture (PUMA)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic