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);
}
}
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;
}
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());
}
}
}
Aggregations