Package br.com.visualmidia.business

Examples of br.com.visualmidia.business.User


        system.execute(new AddUserToGroup("Secret�ria Geral", user));
    }
   
    public void testIfSystemUserIsNotOk() throws Exception {
        Person person = (Person) system.query(new GetUser("developer"));
        User user = (User) person.getPersonType("user");
        assertNotSame("senhaErrada", user.getPassword());
    }
View Full Code Here


        assertNotSame("senhaErrada", user.getPassword());
    }

    public void testIfSystemUserIsOk() throws Exception {
        Person person = (Person) system.query(new GetUser("developer"));
        User user = (User) person.getPersonType("user");
        assertEquals("simpsons", user.getPassword());
    }
View Full Code Here

   
   
    protected void setUp() throws Exception {
        super.setUp();
        login = new Login(new CTabFolder(new Shell(),SWT.NONE), SWT.NONE, new MainScreen());
        user = new User();
        user.setUserName("developer");
        user.setPassWord("simpsons");
    }
View Full Code Here

        assertEquals("simpsons", user.getPassword());
    }

    public void testSystemAuthentication() throws Exception {
        Person person = (Person) system.query(new GetUser("developer"));
        User user = (User) person.getPersonType("user");
        assertFalse(system.authenticate(user.getUserName(), "senhaErrada"));
        assertTrue(system.authenticate(user.getUserName(), "simpsons"));
    }
View Full Code Here

      // item.setText(1, personType.getPassword());
      //                   
      // }
      List<Person> users = (List<Person>) system.query(new GetUsers());
      for (Person person : users) {
        User personType = (User) person.getPersonType("user");
        // System.out.println("Usuario: "+personType.getUserName());
        // System.out.println("Senha: "+personType.getPassword());
        TableItem item = new TableItem(table, SWT.NONE);
        item.setText(0, personType.getUserName());
        item.setText(1, personType.getPassword());
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

        try {
            person = (Person) query(new GetUser(userName));
            if (person.isPersonType("employee")) {
                Employee employee = (Employee) person.getPersonType("employee");
                if (employee.isActivated()) {
                    User user = (User) person.getPersonType("user");
                    isAuthenticated = user.getPassword().equals(passWord);
                    if (isAuthenticated)
                        setLogged(person);
                }
            } else {
                if (person.isPersonType("user")) {
                    User user = (User) person.getPersonType("user");
                    isAuthenticated = user.getPassword().equals(passWord);
                    if (isAuthenticated)
                        setLogged(person);
                }
            }
        } catch (Exception e) {
View Full Code Here

                        Account accountDestiny;
                  try {
                    accountDestiny = (Account) system.query(new GetAccountByName(accountSelected));
                    accountId = accountDestiny.getId();
                    if(!accountDestiny.isBankAccount()) {
                      User user = ((User)accountDestiny.getPerson().getPersonType("user"));
                      ConfirmUserAndPasswordDialog dialog = new ConfirmUserAndPasswordDialog(getShell(), user);
                      dialog.open();
                      if(dialog.isCheckPassword()) {
                        paydParcel(accountId);
                      }
View Full Code Here

                          boolean isOk = false;
                              boolean passwordIsOk = false;
                          if(moneyFromAccount.getId().equals(personLogged.getId())){
                                isOk = true;
                              }else{
                                User userAccountSource = ((User)moneyFromAccount.getPerson().getPersonType("user"));
                                ConfirmUserAndPasswordDialog dialogConfirmAccountSource = new ConfirmUserAndPasswordDialog(getShell(), userAccountSource);
                                dialogConfirmAccountSource.open();
                                passwordIsOk = dialogConfirmAccountSource.isCheckPassword();
                              }
                             
                              if(passwordIsOk || isOk) {
                                new MoneyTransaction().transferMoneyBetweenAccounts(paymentAccountCombo.getText(), moneyFromAccount, transferValue);
                              }
                        }
                        close();
                        }else if(moneyFromAccount.isBankAccount() && accountDestiny.isBankAccount()){//Conta Banco para Conta Banco
                           if(isAdmin(personLogged)){
                             new MoneyTransaction().transferMoneyBetweenAccounts(paymentAccountCombo.getText(), moneyFromAccount, transferValue);
                        }else{
                          Group groupAdmin = (Group) system.query(new GetGroup("Administrador"));
                          ConfirmUserAndPasswordDialog dialogConfirmAccountSource = new ConfirmUserAndPasswordDialog(getShell(), groupAdmin.getPeopleInThisGroup());
                          dialogConfirmAccountSource.open();
                         
                          if(dialogConfirmAccountSource.isCheckPassword()) {
                            new MoneyTransaction().transferMoneyBetweenAccounts(paymentAccountCombo.getText(), moneyFromAccount, transferValue);
                          }
                        }
                           close();
                        }else {//Conta caixa para conta caixa
                          boolean isOk = false;
                          boolean passwordIsOk = false;
                          User userAccountSource = ((User)moneyFromAccount.getPerson().getPersonType("user"));
                          if(moneyFromAccount.getPerson().getId().equals(personLogged.getId())){
                            isOk = true;
                          }else{
                            ConfirmUserAndPasswordDialog dialogConfirmAccountSource = new ConfirmUserAndPasswordDialog(getShell(), userAccountSource);
                            dialogConfirmAccountSource.open();
                            passwordIsOk = dialogConfirmAccountSource.isCheckPassword();
                          }
                         
                          if(isOk || passwordIsOk) {
                if(accountDestiny.getPerson().getId().equals(personLogged.getId())){
                               new MoneyTransaction().transferMoneyBetweenAccounts(paymentAccountCombo.getText(), moneyFromAccount, transferValue);
                             }else{
                               User userAccountDestiny = ((User)accountDestiny.getPerson().getPersonType("user"));
                               ConfirmUserAndPasswordDialog dialogConfirmDestiny = new ConfirmUserAndPasswordDialog(getShell(), userAccountDestiny);
                               dialogConfirmDestiny.open();
                              
                               if(dialogConfirmDestiny.isCheckPassword()) {
                                 new MoneyTransaction().transferMoneyBetweenAccounts(paymentAccountCombo.getText(), moneyFromAccount, transferValue);
View Full Code Here

            close();
        }
    }

  private boolean isAdmin(Person personLogged) {
    User user = (User) personLogged.getPersonType("user");
    List<Group> groups = user.getGroups();
    for (Group group : groups) {
      if(group.getNameGroup().equals("Administrador")){
        return true;
      }
    }
View Full Code Here

    @Override
    protected void execute(PrevalentSystem system) throws BusinessException {
        for (Person person : system.people.values()) {
            if (person.getName().equals(personName)){
                User usuario = (User) person.getPersonType("user");
                usuario.removeGroup(groupName);
            }
        }
    }
View Full Code Here

TOP

Related Classes of br.com.visualmidia.business.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.