cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Navigation Target inside WDJ application

Former Member
0 Kudos

Hello Experts,

I have a requirement like I need to get the navigation target like below inside my WD Java application.

http://<hostname>:<port>/irj/portal?NavigationTarget=pcd:portal_content/other_vendors/.....role//pag...

I will send this as return URL data to the master head through Portal Eventing. The Javascript method redirects to another site and comes back. After certain operations are done, the portal will redirect to my WD Java application using this URL.

My question is how to get the Navigation target -- my WDJ's pcd path and the role that it resides in? Hardcoding this path works perfectI don't want to hard code this path since my App can be moved under any role.

I use EP version 7.4

Accepted Solutions (0)

Answers (1)

Answers (1)

vijay_kumar49
Active Contributor
0 Kudos

Sujai,

Can you  give me more explanation regarding Navigation Target.

Mean while Please refer these documents .it may be useful. Navigation Target-1  and Navigation Target-2

Kindly let me know if you need any more information

Former Member
0 Kudos

Thank you very much Vijay Kumar for the reply.

This Navigation Target I am able to get by Copy-ID option under Content Admin.

My requirement is I need to get it in my WD Java application. Is there anyway to achieve it?

My Case is:

1. I have a WDJ application under some role say for eg., Role-2

2. I will redirect it to an external site in the same window(which I am able to achieve) on some button action. After some operation there, that external site will redirect to my WDJ application under Role-2

3. When redirecting, I am giving a return URL as a parameter to that site. I give the redirect URL like http://<hostname>:<port>/irj/portal?NavigationTarget=pcd:portal_content/other_vendors/<sub-folder1>/...

(Now I hard-code the URL when redirecting and it works perfect as expected)

My problem is:

In the future, my WDJ application might get moved under any Role (say- Role-3 or something). So hard coding the return URL is not the way to follow. I need to get this url (NavigationTarget part particularly) programatically inside my WDJ application.

PS: I am able to get  this part: http://<hostname>:<port>/irj/portal

Any guidance on this part will be really helpful for me. If there is another way to achieve my case, please let me know that also.

vdurgarao09
Contributor
0 Kudos

Hi Sujai,

Role information we can get dynamical though code.I am giving some example code try this.

Iterator rolelist = myuser.getRoles(true);

if (null != rolelist) {

  IRole userRole = null;

  while (rolelist.hasNext()) {

  String roleVal = (String) rolelist.next();

  userRole = roleFact.getRole(roleVal);

  if (userRole.getDescription().equalsIgnoreCase("welcome")) {

  String path = userRole.getUniqueName().replace("pcd:", "ROLES://");

  String navigationTarget ="https://host:port/irj/portal?NavigationTarget="+path;

  break;

  }

  }

}

Former Member
0 Kudos

Thanks Durga Rao. It gives partial solution to my requirement.

I need to find this role name ("welcome") through code . I mean, I need to find the name of the role under which my WDJ application is added . I need to find the role & page names' pcd path through code.

vijay_kumar49
Active Contributor
0 Kudos

Please refer these blogs .it may be useful. How to get the Groups/Roles and Users from the Enterprise Portal using Webdynpro JAVA and Dynamic Role Assignment Using WebDynpro application



Kindly let me know if you need any more information



Former Member
0 Kudos

Hi Vijay Kumar,

I am able to get the list of roles & groups. My requirement is, I need to find the role name under which my WDJ application is added as page.

vdurgarao09
Contributor
0 Kudos

Hi Sujai,

Try this code in wdj application.But embedded WebDynpro page level.

  Map<String, String> parameterMap = WDWebContextAdapter.getWebContextAdapter().getRequestParameterMap();

  wdComponentAPI.getMessageManager().reportSuccess("parameterMap: " + parameterMap);

  if (parameterMap != null && !parameterMap.isEmpty()) {

  Iterator<?> keys = parameterMap.keySet().iterator();

  while (keys.hasNext()) {

   String key = (String) keys.next();

   Object value = parameterMap.get(key);

   if (value instanceof String[]) {

  wdComponentAPI.getMessageManager().reportSuccess("Key: " + key + " = String array:");

  String[] sa = (String[]) value;

  for (int ix = 0; ix < sa.length; ix++) {

   wdComponentAPI.getMessageManager().reportSuccess("  Value[" + ix + "] = " + sa[ix]);

  }

   } else {

  wdComponentAPI.getMessageManager().reportSuccess("Key: " + key + " = " + parameterMap.get(key));

   }

  }

  }

Here parameterMap :{PagePath}

Key: PagePath = String array:

   Value[0] = pcd:portal_content/xx................xxx/_page_id

on more option is there u can get navigation information in site map code.Try this one.

mySiteMap.java - Portal - SAP Library