on 02-02-2009 6:47 PM
Hi,
Does any one has the idea about how to retrieve the worksets, pages and iviews assigned to a role.
I found a piece of code that will retrieve the roles, worksets, pages and iviews from PCD.
Here is the code, that is to retrieve the roles, worksets, pages and iviews from PCD
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, WDClientUser.getCurrentUser().getSAPUser());
env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION);
InitialContext initialContext = null;
DirContext dirCtx;
initialContext = new InitialContext(env);
dirCtx = (DirContext) initialContext.lookup("pcd:portal_content/");
PcdSearchControls pcdSearchControls = new PcdSearchControls();
pcdSearchControls.setReturningObjFlag(false);
pcdSearchControls.setSearchScope(PcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);
dirCtx.addToEnvironment(Constants.APPLY_ASPECT_TO_CONTEXTS,Constants.APPLY_ASPECT_TO_CONTEXTS);
// Gets the full path of the iViews from the PCD
NamingEnumeration ne = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.iview)", pcdSearchControls);
while (ne.hasMoreElements())
{
IPcdSearchResult searchResult = (IPcdSearchResult) ne.nextElement();
String location = "pcd:portal_content/" + searchResult.getName();
wdComponentAPI.getMessageManager().reportSuccess("View ="+location);
}
// Gets the full path of the pages from the PCD
NamingEnumeration nePage = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.page)",pcdSearchControls);
while (nePage.hasMoreElements())
{
IPcdSearchResult searchResult = (IPcdSearchResult) nePage.nextElement();
String location = "pcd:portal_content/" + searchResult.getName();
wdComponentAPI.getMessageManager().reportSuccess("Page ="+location);
}
// Gets the full path of the worksets from the PCD
NamingEnumeration neWorkSet = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.workset)",pcdSearchControls);
while (neWorkSet.hasMoreElements())
{
IPcdSearchResult searchResult = (IPcdSearchResult) neWorkSet.nextElement();
String location = "pcd:portal_content/" + searchResult.getName();
wdComponentAPI.getMessageManager().reportSuccess("WorkSet ="+location);
}
But my requirements is, if I have the role as "Sales Role", I want to find the iViews, Pages and worksets assinged to this role.
Your help is really appreciated.
Thanks in Advance,
Chinna.
Hi Chinna Babu,
I guess what you need is there in this blog. [https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2080] [original link is broken] [original link is broken] [original link is broken];. The blog is for a portal application. I should not be difficult to refactor it for Webdynpro application. Here he uses the user initially to get the roles assinged to the user. Once he gets the roles then its your requirement.
Regards,
Sanyev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.