Search in sources :

Example 1 with PartnerRepository

use of com.axelor.apps.base.db.repo.PartnerRepository in project axelor-open-suite by axelor.

the class MailServiceBaseImpl method resolve.

@Override
public Model resolve(String email) {
    final UserRepository users = Beans.get(UserRepository.class);
    final User user = users.all().filter("self.partner.emailAddress.address = ?1", email).fetchOne();
    if (user != null) {
        return user;
    }
    final PartnerRepository partners = Beans.get(PartnerRepository.class);
    final Partner partner = partners.all().filter("self.emailAddress.address = ?1", email).fetchOne();
    if (partner != null) {
        return partner;
    }
    return super.resolve(email);
}
Also used : PartnerRepository(com.axelor.apps.base.db.repo.PartnerRepository) UserRepository(com.axelor.auth.db.repo.UserRepository) User(com.axelor.auth.db.User) Partner(com.axelor.apps.base.db.Partner)

Aggregations

Partner (com.axelor.apps.base.db.Partner)1 PartnerRepository (com.axelor.apps.base.db.repo.PartnerRepository)1 User (com.axelor.auth.db.User)1 UserRepository (com.axelor.auth.db.repo.UserRepository)1