cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the Role Title

Former Member
0 Kudos

Hi All,

I developed one WD application which browses all the Roles in EP. I am using the code given by Prakash Singh in his weblog on Browsing through Roles,Worksets,Pages and Iviews. In his weblog /people/prakash.singh4/blog/2005/07/28/browse-roles-folders-pages-iviews-assigned-to-a-user-ep6-sp9-and-higher he was not mentioned how to get the Role Title, but he had given the code to get description and Display name of a Role using role.getDescription()and role.getDisplayName().

Is there any method to get the Title of a Role in the EP.? If yes, Could you please respond to this thread.

Thank you in advance,

Sandeep Kumar B

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

What do u mean by 'Title of a Role'?

Former Member
0 Kudos

Hi Denish,

"Title of Role" is name of a role displayed in the browser.

I am using the following code to get the name of a role

try{

IPcdContext targetObject = (IPcdContext)initialContext.lookup(browsing_root);

Object object = (Object)targetObject.getAttributes("").get("com.sap.portal.pcm.Title");

if(object instanceof IPcdAttribute){

IPcdAttribute att = (IPcdAttribute)object;

objtitle = att.get().toString();

}

} catch (NamingException e) {

msgMgr.reportSuccess(e.toString());

e.printStackTrace();

}

It is throwing ClassCastException at the first line.

How can I get over this classcastexception.

Thank you,

Sandeep Kumar b

Former Member
0 Kudos

in a blog there is such code:

IRole r = UMFactory.getRoleFactory().getRole(rolestr);

to get title u can use:

r.getDescription();

Former Member
0 Kudos

Hi,

I am using the method r.getDescription() in my application but it is giving the description of the role instead of title.

Thank you,

Sandeep Kumar B

Former Member
0 Kudos

Hi Sandeep,

Can you please mention what database you are using to get the roles?

regards

Anil

Former Member
0 Kudos

Hi Anil,

Here I am not using any database. I am using the same code which was given in the link mentioned in my thread. For this I am using security.api.*. The only thing I want is getting the title of a role instead of display name, unique name and description.

Thank you,

Sandeep Kumar B