<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" prefix="portlet-client-model" %>
<%
ArrayList GROUP_ATTRS = null;
ArrayList EDIT_USER_ATTRS = null;
ArrayList USER_ATTRS = null;
GROUP_ATTRS = new ArrayList();
USER_ATTRS = new ArrayList();
EDIT_USER_ATTRS = new ArrayList();
USER_ATTRS.add("givenName");
USER_ATTRS.add("sn");
USER_ATTRS.add("uid");
GROUP_ATTRS = new ArrayList();
GROUP_ATTRS.add("cn");
GROUP_ATTRS.add("description");
EDIT_USER_ATTRS = new ArrayList();
EDIT_USER_ATTRS.add("uid");
// EDIT_USER_ATTRS.add("userPassword");
EDIT_USER_ATTRS.add("givenName");
EDIT_USER_ATTRS.add("sn");
// EDIT_USER_ATTRS.add("ibm-primaryEmail");
//EDIT_USER_ATTRS.add("preferredLanguage");
EDIT_USER_ATTRS.add("extensionattribute1");
EDIT_USER_ATTRS.add("extensionattribute2");
EDIT_USER_ATTRS.add("extensionattribute3");
com.ibm.jsr168.Jsr168PortletSessionBean sessionBean = (com.ibm.jsr168.Jsr168PortletSessionBean)renderRequest.getPortletSession().getAttribute(com.ibm.jsr168.Jsr168Portlet.SESSION_BEAN);
try{
PortletServiceHome psh;
javax.naming.Context ctx = new javax.naming.InitialContext();
psh = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
com.ibm.portal.um.portletservice.PumaHome service = (com.ibm.portal.um.portletservice.PumaHome) psh.getPortletService(com.ibm.portal.um.portletservice.PumaHome.class);
PumaProfile pp = service.getProfile(renderRequest);
PumaLocator pl = service.getLocator(renderRequest);
List userList = pl.findUsersByAttribute("uid", "idtsso1");
System.out.println("Test1"+userList);
User editUser = (User)userList.get(0);
Map userMap = pp.getAttributes(editUser, EDIT_USER_ATTRS);
Object attrObj = userMap.get("givenName");
ArrayList attrArray = null;
if (attrObj instanceof java.util.List) {
attrArray = (ArrayList)attrObj;
System.out.println("Test1givenName"+(String)attrArray.get(0));
} else {
System.out.println("Test1givenName"+(String) attrObj);
}
attrObj = userMap.get("sn");
if (attrObj instanceof java.util.List) {
attrArray = (ArrayList)attrObj;
System.out.println("Test1sn 1"+(String)attrArray.get(0));
} else {
System.out.println("Test1sn 1"+(String) attrObj);
}
attrObj = userMap.get("uid");
if (attrObj instanceof java.util.List) {
attrArray = (ArrayList)attrObj;
System.out.println("Harishuid"+(String)attrArray.get(0));
} else {
System.out.println("Test1uid"+(String) attrObj);
}
attrObj = userMap.get("extensionattribute1");
if (attrObj instanceof java.util.List) {
attrArray = (ArrayList)attrObj;
System.out.println("Test1extensionattribute1"+(String)attrArray.get(0));
} else {
System.out.println("Test1hextensionattribute1"+(String) attrObj);
}
}catch(Exception e){
System.out.println("Test1JSR168 "+e.getMessage());
}
%>
No comments:
Post a Comment