Skip to Content
0
Former Member
Sep 22, 2005 at 08:47 PM

IVU Title

34 Views

Need help in retreiving the Title of an Iview.

V are on SP12.

Do i need to perform JNDI Lookup to achieve this?

I found this code on SDN:

IPcdContext targetobject = (IPcdContext)_jndiContext.lookup("");

Object obj = targetobject.getAttributes("").get("com.sap.portal.pcm.Title");

if (obj instanceof IPcdAttribute) {

IPcdAttribute att = (IPcdAttribute)obj;

String title = att.get(_locale);

}

I know a different procedure to look up objects ...

1. Create an instance of the helper object for the type of semantic object that you want to create, such as, IiViews for an iView, ISystems for a system, and so forth.

IiViews iViewSrv = (IiViews)

PortalRuntime.getRuntimeResources().getService(IiViews.KEY);

2. Set the parameters for a JNDI lookup in the PCD.

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,

IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);

3. Perform the lookup by supplying the PCD address of the object, and then cast the returned object to the appropriate semantic object interface.

InitialContext iCtx = null;

try

{

String iViewID = "pcd:portal_content/myFolder/stocks";

iCtx = new InitialContext(env);

IiView result =(IiView)iCtx.lookup(objectAddress);

}

catch(Exception e)

{

}

How to know which is correct..Iam not gud @ JNDI ....

Regards.