|
|
| Line 1: | |||
| + | Report of Total Users In the System. This is a report of all the users in the system and which realm they are in. This report has to be used in conjunction with a report template such as the [[HTML Template]]. | ||
| + | ---- | ||
| + | ''Meta-Data Script:'' | ||
| + | <pre>import com.urbancode.anthill3.domain.reporting.*; | ||
| + | ReportMetaData rmd = new ReportMetaData(); | ||
| + | // Configure columns | ||
| + | rmd.addColumn("Total"); | ||
| + | rmd.addColumn("Active"); | ||
| + | rmd.addColumn("Inactive"); | ||
| + | return rmd; | ||
| + | </pre> | ||
| + | ---- | ||
| + | ''Report Script:'' | ||
| + | <pre>import com.urbancode.anthill3.domain.security.*; | ||
| + | import com.urbancode.anthill3.domain.reporting.*; | ||
| + | import com.urbancode.anthill3.domain.authentication.*; | ||
| + | int totalUsers = 0; | ||
| + | int activeUsers = 0; | ||
| + | int inactiveUsers = 0; | ||
| + | User[] activeUserArray = UserFactory.getInstance().restoreAll(); | ||
| + | activeUsers = activeUserArray.length; | ||
| + | AuthenticationRealm[] realms = AuthenticationRealmFactory.getInstance().restoreAll(); | ||
| + | for (int i = 0; i < realms.length; i++) { | ||
| + | User[] inactiveUserArray = UserFactory.getInstance().restoreAllInactiveForRealm(realms[i]); | ||
| + | if (inactiveUserArray != null) { | ||
| + | inactiveUsers += inactiveUserArray.length; | ||
| + | } | ||
| + | } | ||
| + | totalUsers = activeUsers + inactiveUsers; | ||
| + | // The output of a report is based on the meta-data | ||
| + | ReportOutput output = new ReportOutput(metaData); | ||
| + | ReportRow row = new ReportRow(output, "Output"); | ||
| + | row.setColumnValue("Total", totalUsers + ""); | ||
| + | row.setColumnValue("Active", activeUsers + ""); | ||
| + | row.setColumnValue("Inactive", inactiveUsers + ""); | ||
| + | output.addRow(row); | ||
| + | return output; | ||
| + | </pre> | ||
| + | ---- | ||
| + | '''Related Content''' | ||
| + | [[AnthillPro Template Reports]]<br/> | ||
| + | [[Report Templates]] | ||