cancel
Showing results for 
Search instead for 
Did you mean: 

request method not found

Former Member
0 Kudos

Hello

I am trying to pass the first role in the array to a context attribute

but the request method is marked in red and the complier doesnt accept it


 public void wdDoInit()
  {
    //@@begin wdDoInit()
//	get Portal User
	IUserFactory userFactory= UMFactory.getUserFactory();
 
	try
			{
				
				IUser User = userFactory.getUser(request.getUser().getUniqueID());
				String[] s=((IRoleFactory) UMFactory.getRoleFactory()).getRolesOfUser(User.getUniqueID(),true);
				String strtest = s[0];
				wdContext.getCurrentElement().setAttributeValue("Role",strtest);
 
				}
			catch (UMException e)
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
				//System.out.println(e.getMessage());
 
			}


			
    //@@end
  }

any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

>

> Hello

>

> I am trying to pass the first role in the array to a context attribute

> but the request method is marked in red and the complier doesnt accept it

>


>  public void wdDoInit()
>   {
>     //@@begin wdDoInit()
> //	get Portal User
> 	IUserFactory userFactory= UMFactory.getUserFactory();
>  
> 	try
> 			{
> 				
> 				IUser User = userFactory.getUser(request.getUser().getUniqueID());
> 				String[] s=((IRoleFactory) UMFactory.getRoleFactory()).getRolesOfUser(User.getUniqueID(),true);
> 				String strtest = s[0];
> 				wdContext.getCurrentElement().setAttributeValue("Role",strtest);
>  
> 				}
> 			catch (UMException e)
> 			{
> 				// TODO Auto-generated catch block
> 				e.printStackTrace();
> 				//System.out.println(e.getMessage());
>  
> 			}
> 
> 
> 			
>     //@@end
>   }
> 
> 

>

> any ideas?

Hi,

Have you declared the variable request

Ex:

IWDRequest request;

Some thing like this?

Regards

Ayyapparaj

srinivas_sistu
Active Contributor
0 Kudos

Hi,

Use the below code...

String strRoleName=null;

try

{

IUserFactory ufactory=UMFactory.getUserFactory();

IRoleFactory rfcat=UMFactory.getRoleFactory();

IUser myuser=ufactory.getUserByLogonID("ssistu");

// IUserAccount uacc=uafactory.getMutableUserAccount(myuser.getUniqueID());

Iterator i=myuser.getRoles(true);

IRole urole=null;

while(i.hasNext())

{

String s=(String)i.next();

urole=rfcat.getRole(s);

strRoleName=urole.getDisplayName();

wdComponentAPI.getMessageManager().reportSuccess("urole.getDisplayName()"+urole.getDisplayName());

}

}

catch(Exception e)

{

wdComponentAPI.getMessageManager().reportSuccess("Exception "+e);

}

now to assign this role to a Conext attribute..

say , attribute is Va_RoleName of String type and Node name iv Vn_Role

then..

wdContext.currentVn_RoleElement().setVa_RoleName(strRoleName);

Hope this helps you...

Regards,

Srinivas

Answers (1)

Answers (1)

Former Member
0 Kudos

Thx Ayyapparaj

is this is right way of assigning value to context attribute ?

the attribute Role is under folder RoleNode