use of com.axelor.apps.talent.db.TrainingSession in project axelor-open-suite by axelor.
the class TrainingSessionController method updateTraingRegisterTraining.
public void updateTraingRegisterTraining(ActionRequest request, ActionResponse response) {
TrainingSession trainingSession = request.getContext().asType(TrainingSession.class);
if (trainingSession.getTrainingRegisterList() != null) {
trainingSession = Beans.get(TrainingSessionService.class).updateTraingRegisterTraining(trainingSession);
response.setValue("trainingRegisterList", trainingSession.getTrainingRegisterList());
}
}
use of com.axelor.apps.talent.db.TrainingSession in project axelor-open-suite by axelor.
the class TrainingSessionController method cancel.
public void cancel(ActionRequest request, ActionResponse response) {
TrainingSession trainingSession = request.getContext().asType(TrainingSession.class);
trainingSession = Beans.get(TrainingSessionRepository.class).find(trainingSession.getId());
Beans.get(TrainingSessionService.class).cancel(trainingSession);
response.setReload(true);
}
use of com.axelor.apps.talent.db.TrainingSession 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.TrainingSession in project axelor-open-suite by axelor.
the class TrainingRegisterTalentRepository method save.
@Override
public TrainingRegister save(TrainingRegister trainingRegister) {
if (trainingRegister.getFromDate().isAfter(trainingRegister.getToDate())) {
throw new ValidationException(I18n.get(IExceptionMessage.INVALID_DATE_RANGE));
}
TrainingSession trainingSession = trainingRegister.getTrainingSession();
if (trainingSession != null && (trainingSession.getFromDate().isAfter(trainingRegister.getFromDate()) || trainingSession.getToDate().isBefore(trainingRegister.getToDate()))) {
throw new ValidationException(I18n.get(IExceptionMessage.INVALID_TR_DATE));
}
trainingRegister.setFullName(trainingRegisterService.computeFullName(trainingRegister));
trainingRegister = super.save(trainingRegister);
trainingRegisterService.updateTrainingRating(trainingRegister.getTraining(), null);
if (trainingRegister.getTrainingSession() != null) {
trainingRegisterService.updateSessionRating(trainingRegister.getTrainingSession(), null);
}
refresh(trainingRegister);
return trainingRegister;
}
use of com.axelor.apps.talent.db.TrainingSession 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