Tuesday, March 1, 2011

Do you know about RunAsId() ? here is the ans

It is to run the request against some other user id.

Ex. You(user Id: 1000) logged into the system .But you want to place an order as if your wife(User Id:1001) is placing an order. In this case, you can set RunAsId to 1001.

com.ibm.commerce.context.base Interface BaseContext.setRunAsId(java.lang.Long nMemberId)
This method sets the run-as user for the request associated with this context

getRunAsId()
This method gets the run-as user for the request associated with this context.

BaseContext baseContext = (BaseContext)getCommandContext().getContext(BaseContext.CONTEXT_NAME);
baseContext.getRunAsId();

Thanks for senthil ..