Search in sources :

Example 1 with AppRecruitment

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

the class JobPositionServiceImpl method updateLastEmailId.

@Transactional
public void updateLastEmailId(Message message) {
    AppRecruitment appRecruitment = appRecruitmentRepo.all().fetchOne();
    appRecruitment.setLastEmailId(message.getId().toString());
    appRecruitmentRepo.save(appRecruitment);
}
Also used : AppRecruitment(com.axelor.apps.base.db.AppRecruitment) Transactional(com.google.inject.persist.Transactional)

Example 2 with AppRecruitment

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

the class MailAccountServiceTalentImpl method createMessage.

@Transactional(rollbackOn = { Exception.class })
@Override
public Message createMessage(EmailAccount mailAccount, MailParser parser, Date date) throws MessagingException {
    Message message = super.createMessage(mailAccount, parser, date);
    AppRecruitment appRecruitment = appRecruitmentRepo.all().fetchOne();
    if (appRecruitment != null && appRecruitment.getApp().getActive() && message.getMailAccount() != null && message.getMailAccount().getServerTypeSelect() > 1) {
        String lastEmailId = appRecruitment.getLastEmailId();
        if (lastEmailId == null || message.getId() > Long.parseLong(lastEmailId)) {
            jobPositionService.createJobApplication(message);
        }
    }
    return message;
}
Also used : Message(com.axelor.apps.message.db.Message) AppRecruitment(com.axelor.apps.base.db.AppRecruitment) Transactional(com.google.inject.persist.Transactional)

Aggregations

AppRecruitment (com.axelor.apps.base.db.AppRecruitment)2 Transactional (com.google.inject.persist.Transactional)2 Message (com.axelor.apps.message.db.Message)1