List of usage examples for org.springframework.transaction.annotation Isolation READ_COMMITTED
Isolation READ_COMMITTED
To view the source code for org.springframework.transaction.annotation Isolation READ_COMMITTED.
Click Source Link
From source file:com.inkubator.hrm.service.impl.JadwalKerjaMassExceptionMessagesListener.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { try {//from w ww .java 2s.co m TextMessage textMessage = (TextMessage) message; JSONObject jSONObject = new JSONObject(textMessage.getText()); long workingGroupId = Long.parseLong(jSONObject.getString("groupWorkingId")); String listEmp = jSONObject.getString("listEmpId"); Date createOn = new SimpleDateFormat("dd-MM-yyyy hh:mm").parse(jSONObject.getString("createDate")); String createBy = jSONObject.getString("createBy"); String startDateString = jSONObject.getString("startDate"); String endDateString = jSONObject.getString("endDate"); Date startProposeDate = new SimpleDateFormat("dd-MM-yyyy hh:mm") .parse(jSONObject.getString("startDate")); Gson gson = new GsonBuilder().create(); // List<TempJadwalKaryawan> dataToDelete = new ArrayList<>(); TypeToken<List<Long>> token = new TypeToken<List<Long>>() { }; List<Long> dataEmpId = gson.fromJson(listEmp, token.getType()); //Date now = new Date(); WtGroupWorking groupWorking = wtGroupWorkingDao.getEntiyByPK(workingGroupId); Date startDate = groupWorking.getBeginTime();//tidak ditempatkan di dalam loop karena untuk groupworking yang sama Date endDate = groupWorking.getEndTime(); int numberOfDay = DateTimeUtil.getTotalDayDifference(startDate, endDate); int totalDateDif = DateTimeUtil.getTotalDayDifference(startDate, startProposeDate) + 1; int num = numberOfDay + 1; int hasilBagi = (totalDateDif) / (num); Date tanggalAkhirJadwal = new SimpleDateFormat("dd-MM-yyyy hh:mm") .parse(jSONObject.getString("endDate")); // String dayBegin = new SimpleDateFormat("EEEE").format(endDate); // String dayNow = new SimpleDateFormat("EEEE").format(now); Date beginScheduleDate; if (new SimpleDateFormat("ddMMyyyy").format(tanggalAkhirJadwal) .equals(new SimpleDateFormat("ddMMyyyy").format(new Date()))) { beginScheduleDate = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num) - num, CommonUtilConstant.DATE_FORMAT_DAY); } else { beginScheduleDate = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num), CommonUtilConstant.DATE_FORMAT_DAY); } List<TempJadwalKaryawan> dataToSave = new ArrayList<>(); TempJadwalKaryawan jadwalKaryawan; for (Long id : dataEmpId) { // dataToDelete.addAll(tempJadwalKaryawanDao.getAllByEmpId(id)); for bussiner process Sake so must be close List<WtScheduleShift> dataScheduleShift = new ArrayList<>(groupWorking.getWtScheduleShifts()); // Collections.sort(dataScheduleShift, shortByDate1); int totaldayPropsot = DateTimeUtil.getTotalDayDifference(startProposeDate, tanggalAkhirJadwal); int loop = totaldayPropsot / dataScheduleShift.size(); List<WtScheduleShift> sortedDataScheduleShift = Lambda.sort(dataScheduleShift, Lambda.on(WtScheduleShift.class).getScheduleDate()); int i = 0; // for (int a = 0; a < loop; a++) { for (WtScheduleShift wtScheduleShift : sortedDataScheduleShift) { String onlyDate = new SimpleDateFormat("yyyy-MM-dd").format( DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); Date olnyDate = new SimpleDateFormat("yyyy-MM-dd").parse(onlyDate); jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(id, olnyDate); if (jadwalKaryawan != null) { jadwalKaryawan.setUpdatedBy(createBy); jadwalKaryawan.setUpdatedOn(new Date()); // jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(empData.getId(), olnyDate); } else { jadwalKaryawan = new TempJadwalKaryawan(); jadwalKaryawan.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); jadwalKaryawan.setEmpData(empDataDao.getEntiyByPK(id)); jadwalKaryawan.setTanggalWaktuKerja( DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); jadwalKaryawan.setCreatedBy(createBy); jadwalKaryawan.setCreatedOn(createOn); } // TempJadwalKaryawan jadwalKaryawan = new TempJadwalKaryawan(); // jadwalKaryawan.setEmpData(empDataDao.getEntiyByPK(id)); // jadwalKaryawan.setTanggalWaktuKerja(DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); // jadwalKaryawan.setWtWorkingHour(wtScheduleShift.getWtWorkingHour()); WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(jadwalKaryawan.getTanggalWaktuKerja()); if (holiday != null && groupWorking.getTypeSequeace().equals(HRMConstant.NORMAL_SCHEDULE)) { jadwalKaryawan.setWtWorkingHour(wtWorkingHourDao.getByCode("OFF")); } else { jadwalKaryawan.setWtWorkingHour(wtScheduleShift.getWtWorkingHour()); } // WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(jadwalKaryawan.getTanggalWaktuKerja()); // if (holiday != null || wtScheduleShift.getWtWorkingHour().getCode().equalsIgnoreCase("OFF")) { // jadwalKaryawan.setAttendanceStatus(attendanceStatusDao.getByCode("OFF")); // } else { // jadwalKaryawan.setAttendanceStatus(attendanceStatusDao.getByCode("HD1")); // } jadwalKaryawan.setIsCollectiveLeave(Boolean.FALSE); Date jadwal = jadwalKaryawan.getTanggalWaktuKerja(); if (jadwal.equals(startProposeDate) || jadwal.equals(tanggalAkhirJadwal)) { dataToSave.add(jadwalKaryawan); } if ((jadwal.after(startProposeDate) && jadwal.before(tanggalAkhirJadwal))) { dataToSave.add(jadwalKaryawan); } i++; } // } } // tempJadwalKaryawanDao.deleteBacth(dataToDelete); tempJadwalKaryawanDao.saveBatch(dataToSave); //sending email process // this.sendingEmailJadwalKaryawan(dataToSave, jSONObject.getString("locale")); } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:de.thm.arsnova.FeedbackStorage.java
@Transactional(isolation = Isolation.READ_COMMITTED) public void saveFeedback(final Session session, final int value, final User user) { if (data.get(session) == null) { data.put(session, new ConcurrentHashMap<User, FeedbackStorageObject>()); }/*from w ww .j av a 2s. c o m*/ data.get(session).put(user, new FeedbackStorageObject(value, user)); }
From source file:com.inkubator.hrm.service.impl.BioSertifikasiServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(BioSertifikasi t) throws Exception { this.bioSertifikasiDao.update(t); }
From source file:com.naver.timetable.bo.TableParsingBO.java
@Transactional(isolation = Isolation.READ_COMMITTED) public void doParsing(String year, String season) { // ? ?? .//from w ww. ja va 2 s . c o m if (configDAO.isExistSeason(year, season) == 0) { configDAO.insertSeason(year, season); saveCategory(year, season); saveTimeTable(year, season); } }
From source file:org.jasig.schedassist.impl.DefaultAvailableScheduleReflectionServiceImpl.java
/** * @param platformTransactionManager the platformTransactionManager to set */// w w w . jav a 2 s . c o m @Autowired public void setPlatformTransactionManager(PlatformTransactionManager platformTransactionManager) { this.transactionTemplate = new TransactionTemplate(platformTransactionManager); this.transactionTemplate.setIsolationLevel(Isolation.READ_COMMITTED.value()); }
From source file:com.inkubator.hrm.service.impl.NotificationEmailRecruitmentSelectionScheduleMessagesListener.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override/*from ww w . ja va2s. co m*/ @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { try { LOGGER.info("Begin Send Email Recruitment Selection Schedule"); TextMessage textMessage = (TextMessage) message; String json = textMessage.getText(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm:ss"); RecruitSelectionApplicantSchedulleDetailHistory scheduleDetailHistory = (RecruitSelectionApplicantSchedulleDetailHistory) jsonConverter .getClassFromJson(json, RecruitSelectionApplicantSchedulleDetailHistory.class); RecruitSelectionApplicantSchedulleDetailHistory scheduleDetailHistoryFromDb = recruitSelectionApplicantSchedulleDetailHistoryDao .getEntiyByPK(scheduleDetailHistory.getId()); String locale = "in"; if (scheduleDetailHistoryFromDb.getEmailNotification() == 0) { RecruitApplicant applicant = recruitApplicantDao .getEntityByPkWithDetail(scheduleDetailHistoryFromDb.getApplicantId()); EmpData empData = empDataDao.getByIdWithBioData(scheduleDetailHistoryFromDb.getPicEmpId()); VelocityTempalteModel vtm = new VelocityTempalteModel(); List<String> toSend = new ArrayList<>(); List<String> toSentCC = new ArrayList<String>(); List<String> toSentBCC = new ArrayList<String>(); vtm.setFrom(ownerEmail); toSend.add(scheduleDetailHistoryFromDb.getEmailAddress()); toSentCC.add("deni.arianto1606@gmail.com"); toSentCC.add("rizal2_dhfr@yahoo.com"); // toSentCC.add("yosa.mareta@gmail.com"); toSentCC.add("guntur@incubatechnology.com"); toSentCC.add("rizkykojek@gmail.com"); toSentCC.add("amjadicky@gmail.com"); vtm.setTo(toSend.toArray(new String[toSend.size()])); vtm.setCc(toSentCC.toArray(new String[toSentCC.size()])); vtm.setBcc(toSentBCC.toArray(new String[toSentBCC.size()])); Map maptoSend = new HashMap(); if (StringUtils.equals(locale, "en")) { //not yet implemented } else { /* maptoSend.put("ownerAdministrator", ownerAdministrator); maptoSend.put("ownerCompany", ownerCompany); maptoSend.put("applicationUrl", applicationUrl); maptoSend.put("applicationName", applicationName); velocityTemplateSender.sendMail(vtm, maptoSend);*/ //update scheduleDetailHistory, set EmailNotification == 1 if (scheduleDetailHistoryFromDb.getEmailNotification() == 0) { scheduleDetailHistoryFromDb.setEmailNotification(1); this.recruitSelectionApplicantSchedulleDetailHistoryDao.update(scheduleDetailHistoryFromDb); } } } } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:com.inkubator.hrm.service.impl.NotificationApproverSmsMessagesListener.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { String approverNumber = StringUtils.EMPTY; String notifMessage = StringUtils.EMPTY; try {//from w w w. j av a 2 s. c om TextMessage textMessage = (TextMessage) message; String json = textMessage.getText(); approverNumber = jsonConverter.getValueByKey(json, "senderNumber"); HrmUser approver = hrmUserDao.getEntityByPhoneNumber("+" + approverNumber); String content = jsonConverter.getValueByKey(json, "smsContent"); String[] arrContent = StringUtils.split(content, "#"); notifMessage = StringUtils.EMPTY; ApprovalActivity approvalActivity = StringUtils.isNumeric(arrContent[0]) ? approvalActivityDao.getEntiyByPK(Long.parseLong(arrContent[0])) : null; /** validation */ if (approver == null) { notifMessage = "Maaf, No Telepon tidak terdaftar "; } else if (arrContent.length != 3) { notifMessage = "Maaf, format tidak sesuai dengan standard : ApprovalActivityID#YES/NO/REVISI#COMMENT "; } else if (!(StringUtils.equalsIgnoreCase(arrContent[1], "YES") || StringUtils.equalsIgnoreCase(arrContent[1], "NO") || StringUtils.equalsIgnoreCase(arrContent[1], "REVISI"))) { notifMessage = "Maaf, format tidak sesuai dengan standard : ApprovalActivityID#YES/NO/REVISI#COMMENT "; } else if (!StringUtils.isNumeric(arrContent[0])) { notifMessage = "Maaf, Approval Activity ID tidak terdaftar"; } else if (approvalActivity == null) { notifMessage = "Maaf, approval activity ID tidak terdaftar"; } else if (!StringUtils.equals(approvalActivity.getApprovedBy(), approver.getUserId())) { notifMessage = "Maaf, No Telpon ini tidak berhak untuk melakukan approval"; } else if (approvalActivity.getApprovalStatus() != HRMConstant.APPROVAL_STATUS_WAITING_APPROVAL) { notifMessage = "Maaf, permintaan tidak dapat di proses karena status Approval sudah berubah"; } /** proses approval, jika memenuhi validasi */ if (StringUtils.isEmpty(notifMessage)) { if (StringUtils.equalsIgnoreCase(arrContent[1], "YES")) { /** do Approved */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: businessTravelService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LOAN: loanNewApplicationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.SHIFT_SCHEDULE: tempJadwalKaryawanService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LEAVE: leaveImplementationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.LEAVE_CANCELLATION: leaveImplementationService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.approved(approvalActivity.getId(), null, arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.approved(approvalActivity.getId(), null, arrContent[2]); break; default: break; } notifMessage = "Terima kasih, permintaan untuk disetujui telah di proses"; } else if (StringUtils.equalsIgnoreCase(arrContent[1], "NO")) { /** do Rejected */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: businessTravelService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LOAN: loanNewApplicationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.SHIFT_SCHEDULE: tempJadwalKaryawanService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LEAVE: leaveImplementationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.LEAVE_CANCELLATION: leaveImplementationService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.rejected(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.rejected(approvalActivity.getId(), arrContent[2]); break; default: break; } notifMessage = "Terima kasih, permintaan untuk ditolak telah di proses"; } else if (StringUtils.equalsIgnoreCase(arrContent[1], "REVISI")) { /** do Asking Revised */ switch (approvalActivity.getApprovalDefinition().getName()) { case HRMConstant.LOAN: loanNewApplicationService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT: rmbsApplicationService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: rmbsDisbursementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.ANNOUNCEMENT: announcementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: wtEmpCorrectionAttendanceService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.VACANCY_ADVERTISEMENT: recruitVacancyAdvertisementService.askingRevised(approvalActivity.getId(), arrContent[2]); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: empCareerHistoryService.askingRevised(approvalActivity.getId(), arrContent[2]); break; default: /** Tidak semua module implement asking revised, jika belum/tidak implement maka kirim sms balik ke sender untuk notifikasi */ notifMessage = "Maaf, permintaan untuk \"REVISI\" tidak dapat diproses. Hanya bisa melakukan proses \"YES\" atau \"NO\""; break; } if (StringUtils.isEmpty(notifMessage)) { notifMessage = "Terima kasih, permintaan untuk direvisi telah di proses"; } } } } catch (Exception ex) { notifMessage = "Maaf, permintaan tidak dapat di proses, ada kegagalan di sistem. Mohon ulangi proses via aplikasi web atau hubungi Administrator"; LOGGER.error("Error", ex); } /** kirim sms balik ke sender untuk notifikasi messagenya */ final SMSSend mSSend = new SMSSend(); LOGGER.error("Info SMS " + notifMessage); mSSend.setFrom(HRMConstant.SYSTEM_ADMIN); mSSend.setDestination("+" + approverNumber); mSSend.setContent(notifMessage); //Send notificatin SMS this.jmsTemplateSMS.send(new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { return session.createTextMessage(jsonConverter.getJson(mSSend)); } }); }
From source file:com.jeanchampemont.notedown.note.NoteService.java
/** * Create or update a note/*from ww w . ja v a 2s . co m*/ * @param note * @return */ @Transactional(isolation = Isolation.READ_COMMITTED) @CacheEvict(value = "note", key = "#note.id") public Note createUpdate(Note note, Long version) { User user = authenticationService.getCurrentUser(); Note originalNote = repo.findOne(note.getId()); if (originalNote == null) { originalNote = note; } if (hasWriteAccess(user, originalNote)) { NoteEvent event = new NoteEvent(); event.setId(new NoteEventId(note.getId(), version + 1)); event.setUser(user); event.setDate(new Date()); event.setType(NoteEventType.SAVE); event.setTitle(note.getTitle()); event.setContentDiff(generateDiff(originalNote.getContent(), note.getContent())); originalNote = updateLastModification(originalNote); originalNote.setTitle(note.getTitle()); originalNote.setContent(note.getContent()); originalNote.setUser(user); originalNote = repo.save(originalNote); event.setNote(originalNote); event = eventRepo.save(event); return originalNote; } else { throw new OperationNotAllowedException(); } }
From source file:com.inkubator.hrm.service.impl.BioRelasiPerusahaanServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public BioRelasiPerusahaan getEntiyByPK(Long id) throws Exception { return bioRelasiPerusahaanDao.getEntiyByPK(id); }
From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public MecineFinger getEntiyByPK(Long id) throws Exception { return mecineFingerDao.getEntiyByPK(id); }