This article is NO LONGER VALID in versions 6.x and beyond
Issue
How we can use built in parameters?
Please give some example of using built in parameter (LoggedInUser).
We want to use "LoggedInUser" in query and in scriptlet class.
Resolution
To use LoggedInUser parameter you need to first define it in your report like this:
<parameter name="LoggedInUser" isForPrompting="false" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User">
Now you can use the parameter in same fashion as you use parameters and can access methods of this object like this:
$P{LoggedInUser}.getRoles()
You can check the list of parameters in chapter 4.4 - Built-in Parameters for Query-based Input Controls of JasperReports Server Administrator Guide.
For list of methods you should refer to our javadoc (Jasperserver-ce public API), specifically User class. In scriptlet you'll have to call this method:
public java.lang.Object getParameterValue(java.lang.String parameterName, boolean mustBeDeclared) throws JRScriptletException
To get the User object from parameter and then you'll be able to use it's methods.
More info on scriptlet methods can be also found in public API here:
http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRAbstractScriptlet.html
Ref. Case #00024935 -- 16:42, 26 June 2012 (UTC)
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now