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.BioSertifikasiServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(BioSertifikasi entity, UploadedFile documentFile) throws Exception { BioSertifikasi bioSertifikasi = bioSertifikasiDao.getEntiyByPK(entity.getId()); String uploadPath = bioSertifikasi.getUploadPath(); if (documentFile != null) { //remove old file if exist if (null != bioSertifikasi.getUploadPath()) { File oldFile = new File(bioSertifikasi.getUploadPath()); oldFile.delete();//from ww w.j a va 2 s . c o m } //added new file uploadPath = getUploadPath(bioSertifikasi.getId(), documentFile); facesIO.transferFile(documentFile); File file = new File(facesIO.getPathUpload() + documentFile.getFileName()); file.renameTo(new File(uploadPath)); } //BioData bioData = bioDataDao.getEntiyByPK(entity.getBioData().getId()); EducationNonFormal educationNonFormal = educationNonFormalDao .getEntiyByPK(entity.getEducationNonFormal().getId()); OccupationType occupationType = occupationTypeDao.getEntiyByPK(entity.getOccupationType().getId()); bioSertifikasi.setEducationNonFormal(educationNonFormal); //bioSertifikasi.setBioData(bioData); bioSertifikasi.setOccupationType(occupationType); bioSertifikasi.setNamaSertifikasi(entity.getNamaSertifikasi()); bioSertifikasi.setDocumentTitle(entity.getDocumentTitle()); bioSertifikasi.setNomorDokumen(entity.getNomorDokumen()); bioSertifikasi.setUploadPath(uploadPath); bioSertifikasi.setUpdatedBy(UserInfoUtil.getUserName()); bioSertifikasi.setUpdatedOn(new Date()); bioSertifikasiDao.update(bioSertifikasi); }
From source file:com.inkubator.hrm.service.impl.SystemLetterReferenceServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public Long getTotalSystemLetterReferenceByParam(SystemLetterReferenceSearchParameter searchParameter) throws Exception { return this.systemLetterReferenceDao.getTotalSystemLetterReferenceByParam(searchParameter); }
From source file:com.inkubator.hrm.service.impl.PayTempOvertimeServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void synchronizedOvertimeStatus() throws Exception { //validate/* www .java 2s . co m*/ WtPeriode periode = wtPeriodeDao.getEntityByPayrollTypeActive(); List<LogWtAttendanceRealization> listAttendanceRealization = logWtAttendanceRealizationDao .getAllDataByPeriodId(periode.getId()); if (StringUtils.equals(periode.getAbsen(), HRMConstant.PERIODE_ABSEN_ACTIVE)) { throw new BussinessException("payTempAttendanceStatus.error_absent_period_still_active"); } else if (listAttendanceRealization.isEmpty()) { throw new BussinessException("payTempAttendanceStatus.error_attendance_realization_empty"); } //delete all data PayTempOvertime payTempOvertimeDao.deleteAllData(); //synchronize All Data based on active payroll wtPeriode for (LogWtAttendanceRealization attendanceRealization : listAttendanceRealization) { EmpData empData = empDataDao.getEntiyByPK(attendanceRealization.getEmpDataId()); PayTempOvertime payTempOvertime = new PayTempOvertime(); payTempOvertime.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); payTempOvertime.setEmpData(empData); payTempOvertime.setOvertime((double) attendanceRealization.getOvertime()); payTempOvertime.setCreatedBy(UserInfoUtil.getUserName()); payTempOvertime.setCreatedOn(new Date()); payTempOvertimeDao.save(payTempOvertime); } }
From source file:com.inkubator.hrm.service.impl.TempJadwalKaryawanServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void savePenempatanJadwal(EmpData empData) throws Exception { // List<TempJadwalKaryawan> dataMustDelete = this.tempJadwalKaryawanDao.getAllByEmpId(empData.getId()); // if (!dataMustDelete.isEmpty()) { // for (TempJadwalKaryawan dataMustDelete1 : dataMustDelete) { // tempJadwalKaryawanDao.delete(dataMustDelete1); // } // }/*w ww . j a v a 2 s . co m*/ EmpData data = empDataDao.getEntiyByPK(empData.getId()); Date now = new Date(); WtGroupWorking groupWorking = this.wtGroupWorkingDao.getByCode(empData.getWtGroupWorking().getCode()); groupWorking.setIsActive(Boolean.TRUE); wtGroupWorkingDao.update(groupWorking); data.setWtGroupWorking(groupWorking); empDataDao.update(data); List<WtScheduleShift> list = new ArrayList<>(groupWorking.getWtScheduleShifts()); Collections.sort(list, shortByDate1); Date startDate = groupWorking.getBeginTime(); Date endDate = groupWorking.getEndTime(); int numberOfDay = DateTimeUtil.getTotalDayDifference(startDate, endDate); int totalDateDif = DateTimeUtil.getTotalDayDifference(startDate, now) + 1; int num = numberOfDay + 1; int hasilBagi = (totalDateDif) / (num); Date tanggalAkhirJadwal = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num) - 1, CommonUtilConstant.DATE_FORMAT_DAY); // 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); } int i = 0; TempJadwalKaryawan jadwalKaryawan; for (WtScheduleShift list1 : list) { 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.getEntityByEmpDataIdAndTanggalWaktuKerja(empData.getId(), olnyDate); if (jadwalKaryawan != null) { jadwalKaryawan.setUpdatedBy(UserInfoUtil.getUserName()); jadwalKaryawan.setUpdatedOn(new Date()); // jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(empData.getId(), olnyDate); } else { jadwalKaryawan = new TempJadwalKaryawan(); jadwalKaryawan.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); jadwalKaryawan.setEmpData(empData); jadwalKaryawan.setTanggalWaktuKerja( DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); jadwalKaryawan.setCreatedBy(UserInfoUtil.getUserName()); jadwalKaryawan.setCreatedOn(new Date()); } WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(olnyDate); if (holiday != null && groupWorking.getTypeSequeace().equals(HRMConstant.NORMAL_SCHEDULE)) { jadwalKaryawan.setWtWorkingHour(wtWorkingHourDao.getByCode("OFF")); } else { jadwalKaryawan.setWtWorkingHour(list1.getWtWorkingHour()); } jadwalKaryawan.setIsCollectiveLeave(Boolean.FALSE); this.tempJadwalKaryawanDao.saveOrUpdateAndMerge(jadwalKaryawan); i++; } }
From source file:com.inkubator.hrm.service.impl.LogWtAttendanceRealizationServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void afterMonthEndProcess() throws Exception { /** update payrollType status di periode yg lama menjadi VOID */ WtPeriode wtPeriode = wtPeriodeDao.getEntityByAbsentTypeActive(); wtPeriode.setAbsen(HRMConstant.PERIODE_ABSEN_VOID); wtPeriode.setUpdatedOn(new Date()); wtPeriode.setUpdatedBy(HRMConstant.SYSTEM_ADMIN); wtPeriodeDao.update(wtPeriode);/*from w w w. j av a2 s . c o m*/ /** dapatkan range (untilPeriode dan fromPeriode) untuk periode yg baru */ Date untilPeriode = wtPeriode.getUntilPeriode(); Date fromPeriode = DateUtils.addDays(untilPeriode, 1); int lastDateOfMonth = DateUtils.toCalendar(untilPeriode).getActualMaximum(Calendar.DAY_OF_MONTH); if (lastDateOfMonth == DateUtils.toCalendar(untilPeriode).get(Calendar.DATE)) { untilPeriode = DateUtils.addMonths(untilPeriode, 1); lastDateOfMonth = DateUtils.toCalendar(untilPeriode).getActualMaximum(Calendar.DAY_OF_MONTH); untilPeriode = DateUtils.setDays(untilPeriode, lastDateOfMonth); } else { untilPeriode = DateUtils.addMonths(untilPeriode, 1); } /** adding process or update the entity if already exist */ WtPeriode wtp = wtPeriodeDao.getEntityByFromPeriodeAndUntilPeriode(fromPeriode, untilPeriode); if (wtp == null) { wtp = new WtPeriode(); wtp.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); wtp.setTahun(String.valueOf(DateUtils.toCalendar(fromPeriode).get(Calendar.YEAR))); wtp.setBulan(DateUtils.toCalendar(fromPeriode).get(Calendar.MONTH) + 1); wtp.setFromPeriode(fromPeriode); wtp.setUntilPeriode(untilPeriode); wtp.setAbsen(HRMConstant.PERIODE_ABSEN_ACTIVE); wtp.setPayrollType(HRMConstant.PERIODE_PAYROLL_NOT_ACTIVE); long totalHoliday = wtHolidayDao.getTotalBetweenDate(fromPeriode, untilPeriode); int workingDays = DateTimeUtil.getTotalWorkingDay(fromPeriode, untilPeriode, (int) totalHoliday, 0); wtp.setWorkingDays(workingDays); wtp.setCreatedOn(new Date()); wtp.setCreatedBy(HRMConstant.SYSTEM_ADMIN); wtPeriodeDao.save(wtp); } else { wtp.setAbsen(HRMConstant.PERIODE_ABSEN_ACTIVE); wtp.setUpdatedOn(new Date()); wtp.setUpdatedBy(HRMConstant.SYSTEM_ADMIN); wtPeriodeDao.update(wtp); } /** delete all the record in the temporary table **/ tempProcessReadFingerDao.deleteAllData(); tempAttendanceRealizationDao.deleteAllData(); }
From source file:com.inkubator.hrm.service.impl.SystemLetterReferenceServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(SystemLetterReference entity, UploadedFile uploadedFile) throws Exception { long totalDuplicateCode = systemLetterReferenceDao.getTotalByCode(entity.getCode()); if (totalDuplicateCode > 0) { throw new BussinessException("global.error_duplicate_code"); }// www . j a va 2 s. c o m long totalDuplicateName = systemLetterReferenceDao.getTotalByName(entity.getName()); if (totalDuplicateName > 0) { throw new BussinessException("global.error_duplicate_name"); } entity.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); entity.setCreatedBy(UserInfoUtil.getUserName()); entity.setCreatedOn(new Date()); if (uploadedFile != null) { InputStream inputStream = null; byte[] buffer = null; inputStream = uploadedFile.getInputstream(); buffer = IOUtils.toByteArray(inputStream); entity.setUploadData(buffer); } this.systemLetterReferenceDao.save(entity); }
From source file:com.inkubator.hrm.service.impl.BioRelasiPerusahaanServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(BioRelasiPerusahaan entity, UploadedFile fileUpload) throws Exception { BioRelasiPerusahaan update = bioRelasiPerusahaanDao.getEntiyByPK(entity.getId()); update.setBioData(bioDataDao.getEntiyByPK(entity.getBioData().getId())); update.setCity(cityDao.getEntiyByPK(entity.getCity().getId())); update.setRelasiAddress(entity.getRelasiAddress()); update.setRelasiCompany(entity.getRelasiCompany()); update.setRelasiEmail(entity.getRelasiEmail()); update.setRelasiJabatan(entity.getRelasiJabatan()); update.setRelasiMobilePhone(entity.getRelasiMobilePhone()); update.setRelasiName(entity.getRelasiName()); update.setRelasiPhoneNumber(entity.getRelasiPhoneNumber()); update.setUpdatedBy(UserInfoUtil.getUserName()); update.setPostalCode(entity.getPostalCode()); update.setUpdatedOn(new Date()); if (fileUpload != null) { InputStream inputStream = null; byte[] buffer = null; inputStream = fileUpload.getInputstream(); buffer = IOUtils.toByteArray(inputStream); update.setRelasiAttachment(buffer); update.setRelasiAttachmentName(entity.getRelasiAttachmentName()); }/*from ww w . ja v a 2 s. c o m*/ this.bioRelasiPerusahaanDao.update(update); }
From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public Long getTotalByParam(MecineFingerSearchParameter parameter) throws Exception { return mecineFingerDao.getTotalByParam(parameter); }
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 getMecineFingerAndDetaiUploadByFK(long id) throws Exception { MecineFinger mecineFinger = this.mecineFingerDao.getMecineFingerAndDetaiUploadByFK(id); List<Department> data = new ArrayList<>(); for (DepartementUploadCapture departementUploadCapture : departementUploadCaptureDao .getByMecineFingerId(id)) {/* ww w. j a va2s .co m*/ data.add(departementUploadCapture.getDepartment()); } mecineFinger.setDepartments(data); return mecineFinger; }
From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void saveByModel(FingerUploadModel fingerUploadModel, Set<DepartementUploadCapture> dataToSave) throws Exception { MecineFinger mecineFinger = this.mecineFingerDao.getEntiyByPK(fingerUploadModel.getId()); mecineFinger.getMacineFingerUploads().clear(); mecineFinger.getDepartementUploadCaptures().clear(); mecineFinger.setFileType(fingerUploadModel.getUploadType()); mecineFinger.setFileExtension(fingerUploadModel.getExtensionType()); mecineFinger.setInOutStatus(fingerUploadModel.getItialInOut()); mecineFinger.setBaseOnField(fingerUploadModel.getFieldNumber()); mecineFinger.setUpdatedBy(UserInfoUtil.getUserName()); mecineFinger.setUpdatedOn(new Date()); mecineFingerDao.saveAndMerge(mecineFinger); List<MacineFingerUpload> dataMecineToFingerUpload = fingerUploadModel.getDataToSave(); for (MacineFingerUpload macineFingerUpload : dataMecineToFingerUpload) { macineFingerUpload.setMecineFinger(mecineFinger); macineFingerUpload.setCreatedBy(UserInfoUtil.getUserName()); macineFingerUpload.setCreatedOn(new Date()); macineFingerUploadDao.save(macineFingerUpload); }/* w w w . j a va 2s . co m*/ for (DepartementUploadCapture capture : dataToSave) { capture.setMecineFinger(mecineFinger); departementUploadCaptureDao.save(capture); } }