Introducing to reports based on Java
- Install the iReport tool.
- Execute the iReport tool.
Testing the Java sample report
Section titled “Testing the Java sample report”- Download the JavaReportPattern.jrxml file.
- Open the file.

- Click on the Designer tab.
- Click on
the report query button.

Understanding the code sample
Section titled “Understanding the code sample”- Create an empty list.
- Iterate through all users by calling the API method AuthSrv.findAllUsers(false).
- Create a Map for each DbUser object where each value corresponds to a column.
- Add each map to the list, where each map corresponds to a row.
import com.openkm.db.service.*;import com.openkm.db.bean.*;import com.openkm.util.ContextWrapper;import org.springframework.web.context.WebApplicationContext;WebApplicationContext cc = (WebApplicationContext) ContextWrapper.getContext();AuthSrv authSrv = cc.getBean(AuthSrv.class);List al = new ArrayList();for (DbUser user : authSrv.findAllUsers(false)) { Map usr = new HashMap(); usr.put("id", user.getId()); usr.put("name", user.getName()); usr.put("email", user.getEmail()); usr.put("roles", user.getRoles().toString()); al.add(usr);}return al;Using in the report
Section titled “Using in the report”- For each key in the map, create a field.
- Use the field in the report.
