Package ke.go.moh.oec.reception.data

Examples of ke.go.moh.oec.reception.data.User


            if (usernameTextField.getText().isEmpty()) {
                showWarningMessage("You must enter a username before proceeding!", usernameTextField);
                return;
            }
            try {
                userManager.createUser(new User(usernameTextField.getText(), passwordField.getPassword(), adminCheckBox.isSelected()));
                showInformationMessage("User created successfully!", addButton);
            } catch (ExistingUserException ex) {
                Logger.getLogger(AddUserDialog.class.getName()).log(Level.SEVERE, null, ex);
                showWarningMessage(ex.getMessage(), addButton);
            }
View Full Code Here


        Object selectedItem = userComboBox.getSelectedItem();
        if (selectedItem == null) {
            showWarningMessage("Select the user whose password you want to reset.", resetButton);
            return;
        }
        User user = (User) selectedItem;
        if (showConfirmMessage("Are you sure you want to reset the password for user: '" + user.getUsername() + "'?")) {
            try {
                user.setPassword(passwordField.getPassword());
                persistenceManager.modifyUser(user);
                showInformationMessage("Done!", resetButton);
            } catch (PersistenceManagerException ex) {
                Logger.getLogger(ManagePermissionsDialog.class.getName()).log(Level.SEVERE, null, ex);
                showErrorMessage(ex.getMessage(), resetButton);
View Full Code Here

        if (usernameTextField.getText().isEmpty()) {
            showWarningMessage("You must enter a username before proceeding!", usernameTextField);
            return;
        }
        boolean authentic = false;
        User user = new User(usernameTextField.getText(), passwordField.getPassword());
        try {
            authentic = persistenceManager.authenticateUser(user);
        } catch (PersistenceManagerException ex) {
            Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, null, ex);
            showErrorMessage(ex.getMessage(), loginButton);
View Full Code Here

        Object selectedItem = userComboBox.getSelectedItem();
        if (selectedItem == null) {
            showWarningMessage("Select the user you want to delete.", deleteButton);
            return;
        }
        User user = (User) selectedItem;
        if (user.equals(OECReception.getUser())) {
            showWarningMessage("You are not allowed to delete your own user account!", deleteButton);
            return;
        }
        if (showConfirmMessage("Are you sure you want to delete '" + user.getUsername() + "'?")) {
            try {
                persistenceManager.deleteUser(user);
                userList.remove(user);
                userComboBox.setSelectedItem(null);
                showInformationMessage("Done!", deleteButton);
View Full Code Here

        Object selectedItem = userComboBox.getSelectedItem();
        if (selectedItem == null) {
            showWarningMessage("Select the user you want to grant or revoke permissions from .", okButton);
            return;
        }
        User user = (User) selectedItem;
        user.setAdmin(adminCheckBox.isSelected());
        if (user.equals(OECReception.getUser())
                && !user.isAdmin()) {
            showWarningMessage("You are not allowed to revoke admin rights from yourself!", okButton);
            return;
        }
        try {
            persistenceManager.modifyUser(user);
View Full Code Here

        ResultSet resultSet = null;
        try {
            statement = this.getStatement();
            resultSet = statement.executeQuery("SELECT username, password, admin FROM " + userTable);
            while (resultSet.next()) {
                userList.add(new User(resultSet.getString("username"), resultSet.getString("password").toCharArray(),
                        resultSet.getBoolean("admin")));
            }
        } catch (SQLException ex) {
            Logger.getLogger(PersistenceManager.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
View Full Code Here

    public void createDefaultUser() throws PersistenceManagerException {
        if (noUsersExist()) {
            try {
                char[] defaultPassword = {'a', 'd', 'm', 'i', 'n'};
                createUser(new User("admin", defaultPassword, true));
            } catch (ExistingUserException ex) {
                Logger.getLogger(PersistenceManager.class.getName()).log(Level.INFO, null,
                        "Tried to create a default user when one already existed. " + ex);
            }
        }
View Full Code Here

TOP

Related Classes of ke.go.moh.oec.reception.data.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.