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.BioRelasiPerusahaanServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(BioRelasiPerusahaan entity, UploadedFile fileUpload) throws Exception { entity.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); entity.setBioData(bioDataDao.getEntiyByPK(entity.getBioData().getId())); entity.setCity(cityDao.getEntiyByPK(entity.getCity().getId())); entity.setRelasiAddress(entity.getRelasiAddress()); entity.setRelasiCompany(entity.getRelasiCompany()); entity.setRelasiEmail(entity.getRelasiEmail()); entity.setRelasiJabatan(entity.getRelasiJabatan()); entity.setRelasiMobilePhone(entity.getRelasiMobilePhone()); entity.setRelasiName(entity.getRelasiName()); entity.setRelasiPhoneNumber(entity.getRelasiPhoneNumber()); entity.setCreatedBy(UserInfoUtil.getUserName()); entity.setCreatedOn(new Date()); if (fileUpload != null) { InputStream inputStream = null; byte[] buffer = null; inputStream = fileUpload.getInputstream(); buffer = IOUtils.toByteArray(inputStream); entity.setRelasiAttachment(buffer); }//from ww w . java2 s . co m this.bioRelasiPerusahaanDao.save(entity); }
From source file:com.inkubator.hrm.service.impl.LoginHistoryServiceImpl.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED, timeout = 30) public Long getTotalLoginThisMonth() throws Exception { Date firtsMonth = null;/*from ww w .ja v a 2 s.co m*/ try { String bulanTahun = DateFormatter.getDateAsStringsDefaultLocale(new Date(), CommonUtilConstant.DEFAULT_ONLY_YEAR_AND_MONTH_SHORT_FORMAT); firtsMonth = DateFormatter.getDateWithDefaultLocale("01-" + bulanTahun, CommonUtilConstant.DEFAULT_DATE_SHORT_PATTERN); } catch (ParseException ex) { LOGGER.error("Error", ex); } return this.loginHistoryDao.getTotalLoginByParam(firtsMonth, new Date()); }
From source file:de.thm.arsnova.service.UserServiceImpl.java
@Override @Transactional(isolation = Isolation.READ_COMMITTED) public void addUserToRoomBySocketId(final UUID socketId, final String roomId) { final String userId = socketIdToUserId.get(socketId); userIdToRoomId.put(userId, roomId);//ww w. j a v a 2s .c o m }
From source file:com.inkubator.sms.gateway.service.impl.TaskDefinitionServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public Integer getTotalByFullTextService(String parameter) throws Exception { return this.taskDefinitionDao.getTotalByFullTextService(parameter); }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@SuppressWarnings("unchecked") @ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public DefaultResult<T> findObjectByOid(T object) throws ServiceException, Exception { if (object == null || !(object instanceof BaseValueObj)) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }//w w w. java2 s. c o m Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0); Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1); E entityObject = entityObjectClass.newInstance(); T objectByOid = null; try { this.doMapper(object, entityObject, this.getMapperIdVo2Po()); E entityByOid = this.findByOid(entityObject); if (entityByOid != null) { objectByOid = valueObjectClass.newInstance(); this.doMapper(entityByOid, objectByOid, this.getMapperIdPo2Vo()); } } catch (Exception e) { e.printStackTrace(); } DefaultResult<T> result = new DefaultResult<T>(); if (objectByOid != null && !StringUtils.isBlank(((BaseValueObj) objectByOid).getOid())) { result.setValue(objectByOid); } else { result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA))); } return result; }
From source file:de.thm.arsnova.service.UserServiceImpl.java
@Override @Transactional(isolation = Isolation.READ_COMMITTED) public void removeUserFromRoomBySocketId(final UUID socketId) { final String userId = socketIdToUserId.get(socketId); if (null == userId) { logger.warn("No user exists for socket {}.", socketId); return;// w ww . j a v a 2 s .co m } userIdToRoomId.remove(userId); }
From source file:com.inkubator.sms.gateway.service.impl.UserServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void saveAndNotification(SmsGatewayUser user) throws Exception { String pass = user.getPassword(); final PasswordHistory passwordHistory = new PasswordHistory(); passwordHistory.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); passwordHistory.setPassword(/*from w ww . j a v a 2 s. co m*/ AESUtil.getAESEncription(user.getPassword(), SMSGATEWAY.KEYVALUE, SMSGATEWAY.AES_ALGO)); user.setCreatedBy(UserInfoUtil.getUserName()); user.setPassword(HashingUtils.getHashSHA256(user.getPassword())); user.setCreatedOn(new Date()); userDao.save(user); passwordHistory.setEmailNotification(SMSGATEWAY.EMAIL_NOTIFICATION_NOT_YET_SEND); passwordHistory.setSmsNotification(SMSGATEWAY.SMA_NOTIFICATION_NOT_SEND); passwordHistory.setEmailAddress(user.getEmailAddress()); passwordHistory.setRequestType(SMSGATEWAY.USER_NEW); passwordHistory.setPhoneNumber(user.getPhoneNumber()); passwordHistory.setRealName(user.getRealName()); passwordHistory.setUserName(user.getUserId()); passwordHistory.setLocalId(FacesUtil.getSessionAttribute(SMSGATEWAY.BAHASA_ACTIVE).toString()); passwordHistory.setCreatedBy(UserInfoUtil.getUserName()); passwordHistory.setCreatedOn(new Date()); List<String> dataRole = new ArrayList<>(); List<Role> roles = new ArrayList<>(); for (UserRole userRole : userRoleDao.getByUserId(user.getId())) { roles.add(userRole.getRole()); } for (Role role : roles) { dataRole.add(role.getRoleName()); } passwordHistory.setListRole(jsonConverter.getJson(dataRole.toArray(new String[dataRole.size()]))); this.passwordHistoryDao.save(passwordHistory); this.jmsTemplate.send(new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { return session.createTextMessage(jsonConverter.getJson(passwordHistory)); } }); }
From source file:com.inkubator.sms.gateway.service.impl.SmsActivityServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public Integer getTotalByFullTextService(String parameter) throws Exception { return this.smsActivityDao.getTotalByFullTextService(parameter); }
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 deleteByPeriodId(Long periodId) throws Exception { logWtAttendanceRealizationDao.deleteByPeriodId(periodId); }
From source file:com.inkubator.hrm.service.impl.LoginHistoryServiceImpl.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED, timeout = 30) public Long getTotalLoginThisWeek() throws Exception { String day = new SimpleDateFormat("EE", Locale.ENGLISH).format(new Date()); Date firtstDateOfWeek = null; int factorPengurang; if (day.equalsIgnoreCase("Sun")) { factorPengurang = 0;/*ww w . j av a 2 s. c o m*/ } else if (day.equals("Mon")) { factorPengurang = -1; } else if (day.equals("Tue")) { factorPengurang = -2; } else if (day.equals("Wed")) { factorPengurang = -3; } else if (day.equals("Thu")) { factorPengurang = -4; } else if (day.equals("Fri")) { factorPengurang = -5; } else { factorPengurang = -6; } if (factorPengurang == 0) { String justDate = DateFormatter.getDateAsStringsDefaultLocale(new Date(), CommonUtilConstant.DEFAULT_DATE_SHORT_PATTERN); try { firtstDateOfWeek = DateFormatter.getDateWithDefaultLocale(justDate + " 00:00:00", CommonUtilConstant.DEFAULT_FULL_DATE_SHORT_PATTERN); } catch (ParseException ex) { LOGGER.error("Error", ex); } } else { firtstDateOfWeek = DateTimeUtil.getDateFrom(new Date(), factorPengurang, CommonUtilConstant.DATE_FORMAT_DAY); } return this.loginHistoryDao.getTotalLoginByParam(firtstDateOfWeek, new Date()); }