cancel
Showing results for 
Search instead for 
Did you mean: 

How to costumize the MastHead with different attributes from LDAP?

Former Member
0 Kudos

Hello,

I am using NW 04.

My Portal is connected to an LDAP, which it takes the users from there. When a user logges-in the Masthead says: "Hello <first_name> <last_name>".

The <first_name> & <last_name> parameters are taken from the LDAP Server.

Now, I would like to take a different attributes for <first_name> & <last_name> which exsists at Active Directory to display at the portal.

I have downloaded the current MastHeah iView from:

System Administration -> Support -> Support Desk -> Portal Runtime -> Browse deployment

And imported it into the NWDS.

I am stuck at this point, since I can't find how this iView takes the <first_name> & <last_name> parameters and how I can change it to take different ones.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Roy,

In <b>HeaderiView.jsp</b> the following java code is getting the info. What attribute are you trying to put in the welcome message?

private String GetWelcomeMsg(IPortalComponentRequest request, String welcomeClause)
{
    IUserContext userContext = request.getUser();
    if (userContext != null)
    {
		String firstName = userContext.getFirstName();
		String lastName = userContext.getLastName();
		String salutation = userContext.getSalutation();
		if ((firstName != null) && (lastName != null))
		{
			
			if(salutation != null)
			{
				return java.text.MessageFormat.format(welcomeClause, new Object[] {firstName, lastName, salutation}).toString();
			}
			else
			{
				return java.text.MessageFormat.format(welcomeClause, new Object[] {firstName, lastName, " "}).toString();
			}
		}
		else
		{
			return java.text.MessageFormat.format(welcomeClause, new Object[] {userContext.getUniqueName()," ", " "}).toString();		
		}
	}
    return "";
}

Former Member
0 Kudos

10X Prakash, but now I have more critical problem.

As I said, I've impotred this PAR to the NWDS with a Project Name that I selected: HebMastHead.

Now, even if I don't make any change at all, when I am uploading the PAR file back into the portal it doesn't load. The exception I receive is this:

Caused by: java.lang.ClassNotFoundException: com.sapportals.portal.navigation.HeaderiView

Found in negative cache

-


Loader Info -


ClassLoader name: [com.sapportals.portal.prt.util.ApplicationClassLoader@17139a4]

Parent loader name: [sap.com/HebMastHead]

References:

not registered!

Resources:

C:
usr
sap
J2E
JC00
j2ee
cluster
server0
apps
sap.com
irj
servlet_jsp
irj
root
WEB-INF
portal
portalapps
HebMastHead
private
classes

Former Member
0 Kudos

Hi Roy,

After you have imported the project in NWDS. Don't change anything except the <b>HeaderiView.jsp</b>. Leaving everything that way it is. Don't change portalapp.xml either. Don't delete any of the following files under following folder.

dist\PORTAL-INF\private\exlib->com.sap.portal.navigation.mastheadcore.jar

dist\PORTAL-INF\exlib->com.sap.portal.navigation.mastheadapi.jar

Former Member
0 Kudos

I didn't change or delted anything, but when you import a PAR you are requested to give a Project name, this is the only thing I did, but still I receive this error...

Former Member
0 Kudos

And by the way, although I can find these jar files at the PAR file before import, I can't find them at the NWDS after the import....

Former Member
0 Kudos

Hey, I've created these folders manually and inserted the jars there and now it is working. But why the NWDS didn't do it by itself?

Former Member
0 Kudos

did you download the .par.bak file from portal. It works for me. I don't know why it didn't work for you.

Former Member
0 Kudos

And another Q:

Since I would like to take different attributes I assume I need to connect to LDAP and retreive it. Well, I've created a portal service which is doing that and I want to use it in this PAR file.

I am using it in DynPro succefully like this:

<property name="SharingReference" value="sap.com/LDAPService"/>

But when I refer it like this (And add the propar jar file as an external jar) at this PAR it can't find it.

Why is that?

Former Member
0 Kudos

Oh and by the way:

My Portal Application Project Name is: LDAPService.

Under this I've created a Portal service called LDAPService under the package gov.justice.services.ldap

Former Member
0 Kudos

Delete the other line and add the following line.

<property name="ServicesReference" value="LDAPService"/>

if that doesn't work then try changin the above to

<property name="ServicesReference" value="gov.justice.services"/>

Former Member
0 Kudos

I've already tried tried

<property name="ServicesReference" value="LDAPService"/>

And it doesn't work.

I am not in front of the portal now but I will test

<property name="ServicesReference" value="gov.justice.services"/>

But I suspect it won't work either since the service in inside gov.justice.services.ldap. Did u mean that?

And one more Q (Forgive me for laying it all on you at once...): After I've created the reference and added the external jar, how do I use it in code? I know how to do it in a DynPro Application but not in this environment...

Former Member
0 Kudos

Sorry that was a typo but try <b>gov.justice.services.ldap</b>

ILDAPService ldapservice = (ILDAPService) PortalRuntime.getRuntimeResources().getService("key");

key = whatever key you have defined in your service

ILDAPService = is the name of service api you have created

Former Member
0 Kudos

Hey,

One more thing that it is important to my global understanding. By looking at the MastHead PAR file I see that it references many other service.

Why don't I see PortalRuntime.getRuntimeResources()... and a local jar file for each service?

My guess is that these services are somehow embedded when creating new Portal Projec, but how and which services?

Former Member
0 Kudos

You could use that <b>request.getService</b> which is used in masthead but this particular method is depecrated now. The method will still work though.

I think you saw following lines in the masthead.

ILAFService iLAFService = (ILAFService)request.getService(ILAFService.KEY);

Former Member
0 Kudos

Hey Prakash,

Well, It can't find the service on both notations you suggested. Any other idea?

Former Member
0 Kudos

Well, I think I'll open new post for that. You already did more than enough for me here...