aspose file tools*
The moose likes Portals and Portlets and the fly likes Using Puma service in web application at WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Using Puma service in web application at WAS" Watch "Using Puma service in web application at WAS" New topic
Author

Using Puma service in web application at WAS

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
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


Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"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.


SCJP, SCWCD.
|Asking Good Questions|
Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 382
    
    2
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


SCEA part I,TOGAF Foundation
Dipankar KumarGhosal
Greenhorn

Joined: Nov 25, 2008
Posts: 9
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;
}

Deboshree Roy
Greenhorn

Joined: Oct 03, 2007
Posts: 21
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.
Sunil D Patil
Greenhorn

Joined: Mar 30, 2009
Posts: 5
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


IBM Certified WPS Developer 5.0,5.1,6.0,6.1
SCJP,SCWD,SCBD
Manish Chhabra
Greenhorn

Joined: Feb 24, 2010
Posts: 15

You can read the blog IBM Portal User Management Architecture (PUMA)


Manish Chhabra
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Puma service in web application at WAS