use of org.exist.security.AccountComparator in project exist by eXist-db.
the class UserManagerDialog method refreshUsersTableModel.
public void refreshUsersTableModel() {
final int rowCount = usersTableModel.getRowCount();
for (int i = 0; i < rowCount; i++) {
usersTableModel.removeRow(0);
}
try {
final Account[] accounts = userManagementService.getAccounts();
Arrays.sort(accounts, new AccountComparator());
for (Account account : accounts) {
usersTableModel.addRow(new String[] { account.getName(), account.getMetadataValue(AXSchemaType.FULLNAME), account.getMetadataValue(EXistSchemaType.DESCRIPTION) });
}
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(this, "Could not get users list: " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
}
use of org.exist.security.AccountComparator in project exist by eXist-db.
the class UserManagerDialog method getUsersTableModel.
private TableModel getUsersTableModel() {
if (usersTableModel == null) {
try {
final Account[] accounts = userManagementService.getAccounts();
Arrays.sort(accounts, new AccountComparator());
final String[][] tableData = new String[accounts.length][3];
for (int i = 0; i < accounts.length; i++) {
tableData[i][0] = accounts[i].getName();
tableData[i][1] = accounts[i].getMetadataValue(AXSchemaType.FULLNAME);
tableData[i][2] = accounts[i].getMetadataValue(EXistSchemaType.DESCRIPTION);
}
usersTableModel = new ReadOnlyDefaultTableModel(tableData, new String[] { "User", "Full Name", "Description" });
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(this, "Could not get users list: " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
}
return usersTableModel;
}
Aggregations