Search in sources :

Example 1 with Training

use of com.axelor.apps.talent.db.Training in project axelor-open-suite by axelor.

the class TrainingRegisterTalentRepository method remove.

@Override
public void remove(TrainingRegister trainingRegister) {
    Training training = trainingRegister.getTraining();
    TrainingSession session = trainingRegister.getTrainingSession();
    List<Event> eventList = trainingRegister.getEventList();
    for (Event event : eventList) {
        eventRepo.remove(event);
    }
    super.remove(trainingRegister);
    trainingRegisterService.updateTrainingRating(training, null);
    if (session != null) {
        trainingRegisterService.updateSessionRating(session, null);
    }
}
Also used : Training(com.axelor.apps.talent.db.Training) Event(com.axelor.apps.crm.db.Event) TrainingSession(com.axelor.apps.talent.db.TrainingSession)

Example 2 with Training

use of com.axelor.apps.talent.db.Training in project axelor-open-suite by axelor.

the class TrainingSessionServiceImpl method updateTraingRegisterTraining.

@Override
@Transactional
public TrainingSession updateTraingRegisterTraining(TrainingSession trainingSession) {
    Training training = trainingSession.getTraining();
    for (TrainingRegister register : trainingSession.getTrainingRegisterList()) {
        register.setTraining(training);
        for (Event event : register.getEventList()) {
            event.setSubject(training.getName());
            Beans.get(EventRepository.class).save(event);
        }
    }
    return trainingSession;
}
Also used : Training(com.axelor.apps.talent.db.Training) TrainingRegister(com.axelor.apps.talent.db.TrainingRegister) Event(com.axelor.apps.crm.db.Event) EventRepository(com.axelor.apps.crm.db.repo.EventRepository) Transactional(com.google.inject.persist.Transactional)

Example 3 with Training

use of com.axelor.apps.talent.db.Training in project axelor-open-suite by axelor.

the class TrainingRegisterController method updateOldRating.

public void updateOldRating(ActionRequest request, ActionResponse response) {
    TrainingRegister trainingRegister = request.getContext().asType(TrainingRegister.class);
    TrainingRegisterService trainingRegisterService = Beans.get(TrainingRegisterService.class);
    Training trainingSaved = null;
    TrainingSession trainingSessionSaved = null;
    if (trainingRegister.getId() != null) {
        TrainingRegister trainingRegisterSaved = Beans.get(TrainingRegisterRepository.class).find(trainingRegister.getId());
        trainingSessionSaved = trainingRegisterSaved.getTrainingSession();
        trainingSaved = trainingRegisterSaved.getTraining();
    }
    if (trainingSaved != null && trainingSaved.getId().equals(trainingRegister.getTraining().getId())) {
        trainingRegisterService.updateTrainingRating(trainingSaved, trainingRegister.getId());
    }
    if (trainingSessionSaved != null) {
        if (trainingRegister.getTrainingSession() == null || trainingRegister.getTrainingSession().getId().equals(trainingSessionSaved.getId())) {
            trainingRegisterService.updateSessionRating(trainingSessionSaved, trainingRegister.getId());
        }
    }
}
Also used : Training(com.axelor.apps.talent.db.Training) TrainingRegister(com.axelor.apps.talent.db.TrainingRegister) TrainingRegisterRepository(com.axelor.apps.talent.db.repo.TrainingRegisterRepository) TrainingRegisterService(com.axelor.apps.talent.service.TrainingRegisterService) TrainingSession(com.axelor.apps.talent.db.TrainingSession)

Aggregations

Training (com.axelor.apps.talent.db.Training)3 Event (com.axelor.apps.crm.db.Event)2 TrainingRegister (com.axelor.apps.talent.db.TrainingRegister)2 TrainingSession (com.axelor.apps.talent.db.TrainingSession)2 EventRepository (com.axelor.apps.crm.db.repo.EventRepository)1 TrainingRegisterRepository (com.axelor.apps.talent.db.repo.TrainingRegisterRepository)1 TrainingRegisterService (com.axelor.apps.talent.service.TrainingRegisterService)1 Transactional (com.google.inject.persist.Transactional)1