@Override public List<String> getBeneficiary() { List<String> res = new LinkedList(); res.add(recipient.getUsername()); res.add(recipient.getFirstname()); res.add(recipient.getSecondname()); return res; }
public void checkRecipient() throws InvalidCustomerAccountException { try { em.createNamedQuery("UserEntity.findByUsername") .setParameter("username", recipient.getUsername()) .getSingleResult(); } catch (NoResultException nre) { System.out.println("No recipient found"); throw new InvalidCustomerAccountException("Error: the recipient does not exist anymore."); } }
public void checkCredentials(String user, String pwd) throws InvalidCustomerAccountException { if (!(sender.getUsername().equals(user) && sender.getPassword().equals(pwd))) { throw new InvalidCustomerAccountException("Error: Username or password not correct"); } }