cancel
Showing results for 
Search instead for 
Did you mean: 

Determine system aliases from PCD path?

Former Member
0 Kudos

I'm trying to display all the system objects in the PCD, along with their associated aliases. I'm able to traverse the PCD via the JNDI interface, and I can pick out all the systems (based on the class name).

However, at this point I'm stuck. I've tried various methods of trying to fetch the system object from the PCD, but nothing seems to work.

Given a PCD path, how can you fetch the related object?

I'm trying to do this:

Object o = ctx.lookup( "pcd:portal_content/Collaboration_Integration_WebEx" );

'o' is a com.sapportals.portal.pcd.gl.PcdGlContext, which I assume should be accessed via IPcdContext. However, this isn't a system object; rather, it seems to be another lookup mechanism.

Any suggestions would be most welcome.

BTW, I've also looked at using the Portal Service for systems, ala

ISystems systemSrv = (ISystems) PortalRuntime.getRuntimeResources().getService(ISystems.KEY);
			IPrincipal prin = getServiceUser("pcd_service");
			String aliases[] = systemSrv.getAliases(prin, true);

but this doesn't seem to return all aliases in the system (and therefore not all systems), whereas traversing the PCD manually does return all defined systems.

Message was edited by: Ken Miller

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Well, I figured it out myself.

Turns out I was using the wrong aspect when creating the context. By using this:

env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.READONLY_ASPECTS);

I was able to retrieve ISystemObjects from the PCD. Yay!

However, I'd also like to be able to display the descriptive name of the object, since the PCD path might be different than the display path.

Where do I find this information? I've looked at all the methods for IPcdContext and ISystemObject, and there doesn't appear to be a 'display name' method. I thought that perhaps so.getAttributes( "com.sap.portal.pcm.Title" ) might work, but to no avail...

Former Member
0 Kudos

Thanks 4 sharing!

regards,

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

Hi Ken,

I suggest doing the look up this way:

Once you get the PCD address for each system, do a lookup to get the semantic object (ISystem) for the system:

-


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);

InitialContext iCtx = null;

try

{

String systemID = "pcd:portal_content/myFolder/mySystem";

iCtx = new InitialContext(env);

ISystem result =(ISystem)iCtx.lookup(systemID);

}

catch(Exception e)

{

}

-


Either way, when you look up the title (a text attribute), you must supply the locale. For example:

result.getAttribute ("attribute",request.getLocale() )

Hope this helps.

Daniel

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

Hi Ken,

Also, have you tried using the getAliases() method without any parameters? Or with the personalized set to false?

Daniel

Former Member
0 Kudos

Daniel, that was what I ended up doing. It took a while to figure out that there are different views over the PCD.

Regarding using getAliases(), that wasn't quite the functionality I was after. I wanted a listing of all systems, and their associated aliases even if undefined. I therefore had to traverse the PCD to do this.

Former Member
0 Kudos

Hello Everyone,

Please check if this code helps:

IUserMappingService iums = (IUserMappingService)PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);

String str[] = iums.getAllSystems();

response.write("<br> **** System Mapped ***** <br>");

for (int j=0;j<str.length;j++)

{ //response.write("<br> Systems => " + str[j]);

IUserMappingData iumd = iums.getMappingData(str[j], iuser);

if(iumd.isMappingDirect() == true)

response.write("<br> Mapped to System : " + str[j]);

This code displays all the existing System Aliases and also whether an EP user is mapped to it or not.

Warm Regards,

Ritu R Hunjan

Message was edited by: Ritu Hunjan