use of org.xmldb.api.base.XMLDBException 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.xmldb.api.base.XMLDBException in project exist by eXist-db.
the class UserManagerDialog method showEditUserDialog.
private void showEditUserDialog(final Account account) {
final UserManagerDialog that = this;
final DialogCompleteWithResponse<String> callback = response -> {
// get client to reconnect with edited users new password
try {
System.out.println("Detected logged-in user password change, reconnecting to server...");
that.userManagementService = reconnectClientAndUserManager(response);
System.out.println("Reconnected.");
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(that, "Could not edit user '" + getSelectedUsername() + "': " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
};
final EditUserDialog userDialog = new EditUserDialog(userManagementService, account);
if (getSelectedUsername().equals(currentUser)) {
// register for password update event, if we are changing the password
// of the current user
userDialog.addDialogCompleteWithResponseCallback(callback);
}
userDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(final WindowEvent e) {
refreshUsersTableModel();
}
});
userDialog.setVisible(true);
}
use of org.xmldb.api.base.XMLDBException in project exist by eXist-db.
the class UserManagerDialog method miEditGroupActionPerformed.
// GEN-LAST:event_tblUsersMouseClicked
private void miEditGroupActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_miEditGroupActionPerformed
final String selectedGroup = getSelectedGroup();
try {
final Group group = userManagementService.getGroup(selectedGroup);
showEditGroupDialog(group);
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(this, "Could not edit group '" + selectedGroup + "': " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
}
use of org.xmldb.api.base.XMLDBException in project exist by eXist-db.
the class UserManagerDialog method tblUsersMouseClicked.
// GEN-LAST:event_btnCreateActionPerformed
private void tblUsersMouseClicked(java.awt.event.MouseEvent evt) {
// GEN-FIRST:event_tblUsersMouseClicked
final boolean userSelected = tblUsers.getSelectedRow() > -1;
final String selectedUsername = getSelectedUsername();
boolean canModify = userSelected && !selectedUsername.equals(SecurityManager.SYSTEM);
boolean canDelete = userSelected && !(selectedUsername.equals(SecurityManager.SYSTEM) || selectedUsername.equals(SecurityManager.DBA_USER) || selectedUsername.equals(SecurityManager.GUEST_USER));
miEditUser.setEnabled(canModify);
miRemoveUser.setEnabled(canDelete);
if (evt.getClickCount() == 2 && canModify) {
try {
final Account account = userManagementService.getAccount(selectedUsername);
showEditUserDialog(account);
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(this, "Could not edit user '" + selectedUsername + "': " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
}
}
use of org.xmldb.api.base.XMLDBException in project exist by eXist-db.
the class UserManagerDialog method miEditUserActionPerformed.
// GEN-LAST:event_miRemoveUserActionPerformed
private void miEditUserActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_miEditUserActionPerformed
final String selectedUsername = getSelectedUsername();
try {
final Account account = userManagementService.getAccount(selectedUsername);
showEditUserDialog(account);
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(this, "Could not edit user '" + selectedUsername + "': " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
}
Aggregations