cancel
Showing results for 
Search instead for 
Did you mean: 

Retreiving user mapping API

former_member1191927
Participant
0 Kudos

Hi all,

I have done user mapping at group level in the portal and want to retrieve the same in my web dynpro application.

I used the following method for this :-

IUserMappingData mapdata =

UMFactory.getUserMapping().getUserMappingData(

"<system alias",

GroupObject,

null);

This actually works fine. But this is a deprecated API. So I found that the alternate is :-

UMFactory.getUserMapping().getUserMappingData(ISystemLandScapeObject object, IPrincipal p);

In this i can pass IGrrup in place of IPrincipal, but I <b>how do I create the object of "ISystemLandScapeObject"?</b>

I know the system alias name. Some one please help me in this.

Regards,

NArahari

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello NArahari,

Use UMFactory.getSystemLandscapeWrappers. It returns ArrayList of ISystemLandScapeObject`s.

Best regards, Maksim Rashchynski.

former_member1191927
Participant
0 Kudos

Hi Maksim,

How do I retrieve a particular ISystemLandScapeObject from this list, as there is no API available (in ISystemLandScapeObject) to pass system alias and get its object??

Please help me in this.

Regards,

Narahari

former_member182372
Active Contributor
0 Kudos

Hello Narahari,

Just iterate through list and get properties of ISystemLandScapeObject like getUniqueKey or getAlias and compare with system ID which you needs.

Best regards, Maksim Rashchynski.

former_member1191927
Participant
0 Kudos

Hi Maksim,

I have written the following code as you suggested :-

for (int i = 0;

i < UMFactory.getSystemLandscapeWrappers().size();

i++) {

ISystemLandscapeObject e =

(ISystemLandscapeObject) UMFactory

.getSystemLandscapeWrappers()

.get(

i);

if (e.getAlias().compareTo("CN") == 0) {

system = e;

}

}

Here "CN" is the system alias name.

But it throws a ClassCastException while casting the object to ISystemLandscapeObject.

Could you please give me a code snippet for what you have suggested?

Regards,

Narahari

former_member182372
Active Contributor
0 Kudos

Hello Narahari,

try this:


ISystemLandscapeObject system;
try {
	final List wrappers = UMFactory.getSystemLandscapeWrappers();
	for (int i = 0;i < wrappers.size(); i++) {
		ISystemLandscapeWrapper e = (ISystemLandscapeWrapper) wrappers.get(i);
		system = e.getSystemByUniqueKey("CN");
		if(null==system) {
			system = e.getSystemByAlias("CN");
			if(null!=system) {
				break;
			}
		} else {
			break;
		}
	}
} catch (ExceptionInImplementationException e) {
	//handle excpetion
}

Best regards, Maksim Rashchynski.

former_member1191927
Participant
0 Kudos

Hi Maksim,

This problem got solved.

Thank you very much.

Regards,

Narahari

Answers (0)