Skip to content
Other versions

Loading…

Introducing to reports based on Java

  • Install the iReport tool.
  • Execute iReport tool.

 

  • Click on Designer tab.
  • Click on  report query button.

  • Create an empty list.
  • Iterate across all users calling the API method named AuthDAO.findAllUsers(false).
  • Create a Map for each User object where each value corresponds to a column.
  • Add each map into the list, where each map corresponds to a row.
import com.openkm.dao.*;
import com.openkm.dao.bean.*;
List al = new ArrayList();
for (User user : AuthDAO.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;
  • For each key in map create a field.
  • Use the field in report