Skip to Content
author's profile photo Former Member
Former Member

Finding recursively the iViews assigned to a Role - Portal Component

Hi,

I am trying to make a Portal Component where in I need to know what iViews are assigned to any particular role in a recursive manner.

Currently by using the following code I can search the iViews recursively in the portal_content folder structure but not in the roles,

Hashtable env = new Hashtable();

env.put(IPcdContext.SECURITY_PRINCIPAL, request.getUser());
env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);

InitialContext ctx = null;
DirContext dirCtx;
List iViewList = null;
ctx = new InitialContext(env);
dirCtx = (DirContext) ctx.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);
NamingEnumeration ne = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.iview)", pcdSearchControls);
iViewList = new ArrayList();

while (ne.hasMoreElements())
{
	IPcdSearchResult searchResult =	(IPcdSearchResult) ne.nextElement();
	String location = searchResult.getName();
	iViewList.add(location);
}

Iterator i = iViewList.iterator();

while(i.hasNext())
{
	response.write("<br />" + i.next().toString());
}

I need to find the iviews that are currently assigned to a particular role for which PCD path can be given at the time of making the iVIew from this component.

Please let me know how to go about this.

Regards,

Saurabh Agarwal

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2011 at 11:53 AM

    Hi,

    Somebody please help on this one.

    Regards,

    Saurabh.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.