Jump to content
We've recently updated our Privacy Statement, available here ×
  • Creating additional built-in parameters


    mgeise

    Implementing BuiltInParameterProvider interface

    Classes that implement BuiltInParameterProvider can be included to provide parameters which are available to reports and queries.

    [toc]
    public interface BuiltInParameterProvider {
       /**
       * Generate a set of standard parameters
       *
       * Each element is a JRParameter, value
       *
       * @param context
       * @param jrParameters unchanged
       * @param parameters unchanged
       * @return List<object[]> [JRParameter, value]
       */
       public List<object[]> getParameters(ExecutionContext context, List jrParameters, Map parameters);
          /**
          * Generate parameters can be requested by name that are not part of the standard set
          *
          * @param context
          * @param jrParameters unchanged, can be null
          * @param parameters unchanged
          * @param name of parameter
          * @return List<object[]> [JRParameter, value] or null if the given name is not set by this generator
          */
       public Object[] getParameter(ExecutionContext context, List jrParameters, Map parameters, String name);
    }
    

    Adding the parameter provider

    To include your custom parameter provider, you have to:

    • put the class into the WAR (in WEB-INF/classes or WEB-INF/lib)
    • add an instance of your class into the builtInParameterProviders bean in WEB-INF/applicationContext.xml, as follows:

      <bean class="java.util.ArrayList" id="builtInParameterProviders">
          <constructor-arg>
              <list>
                  <bean class="com.jaspersoft.jasperserver.api.engine.jasperreports.util.UserProfileBuiltInParameterProvider" />
                  <bean class="your.package.and.class.name.here" />
              </list>
          </constructor-arg>
      </bean>
      

    Have a look at the UserProfileBuiltInParameterProvider class as an example.

    See Also


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...