Example usage for org.springframework.transaction.annotation Isolation READ_COMMITTED

List of usage examples for org.springframework.transaction.annotation Isolation READ_COMMITTED

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Isolation READ_COMMITTED.

Prototype

Isolation READ_COMMITTED

To view the source code for org.springframework.transaction.annotation Isolation READ_COMMITTED.

Click Source Link

Document

A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.

Usage

From source file:com.inkubator.hrm.service.impl.ProscessToApproveServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public ProscessToApprove getEntiyByPK(Long id) throws Exception {
    return this.proscessToApproveDao.getEntiyByPK(id);
}

From source file:com.inkubator.sms.gateway.service.impl.SchedullerSendingSmsServiceImpl.java

@Override
@Scheduled(cron = "${cron.sending.sms.scheduller}")
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void sendScheduleSms() throws Exception {
    List<TaskDefinition> allDataHaveToSendBySms = taskDefinitionDao.getAllData();

    for (TaskDefinition taskDefinition : allDataHaveToSendBySms) {
        if (taskDefinition.getScheduleType().equals(SMSGATEWAY.SMS_REPEAT)) {
            if (SMSGATEWAY.EVERY_DAY.equals(taskDefinition.getIsRepeatOnCondition())) {
                if (new Date().after(taskDefinition.getDate()) || new Date().equals(taskDefinition.getDate())) {
                    String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date());
                    String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime());
                    if (waktuSekarang.equals(waktukirim)) {
                        sendingSms(taskDefinition);
                    }//from  ww  w .jav a  2s  .c  om
                }
            }
            if (SMSGATEWAY.EVERY_WEEK.equals(taskDefinition.getIsRepeatOnCondition())) {
                if (new Date().after(taskDefinition.getDate()) || new Date().equals(taskDefinition.getDate())) {
                    String hariSekarang = new SimpleDateFormat("EEEE").format(new Date());
                    System.out.println(" hari sekarngan ad" + hariSekarang);
                    String hariPengiriman = new SimpleDateFormat("EEEE").format(taskDefinition.getDate());
                    System.out.println(" hari pengirimana ad" + hariPengiriman);
                    if (hariSekarang.equals(hariPengiriman)) {
                        String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date());
                        String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime());
                        if (waktuSekarang.equals(waktukirim)) {
                            sendingSms(taskDefinition);
                        }
                    }
                }

            }
            if (SMSGATEWAY.EVERY_MONTH.equals(taskDefinition.getIsRepeatOnCondition())) {
                if (new Date().after(taskDefinition.getDate()) || new Date().equals(taskDefinition.getDate())) {
                    String tanggalSekarng = new SimpleDateFormat("dd").format(new Date());
                    String tanggalPengiriman = new SimpleDateFormat("dd").format(taskDefinition.getDate());
                    if (tanggalSekarng.equals(tanggalPengiriman)) {
                        String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date());
                        String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime());
                        if (waktuSekarang.equals(waktukirim)) {
                            sendingSms(taskDefinition);
                        }
                    }
                }
            }

        }
        if (SMSGATEWAY.SMS_ONCE.equals(taskDefinition.getScheduleType())) {
            if (new Date().equals(taskDefinition.getDate())) {
                String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date());
                String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime());
                if (waktuSekarang.equals(waktukirim)) {
                    sendingSms(taskDefinition);
                }
            }
        }

    }
}

From source file:com.inkubator.sms.gateway.service.impl.UserDetailsServiceImpl.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED, timeout = 30)
public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException, DataAccessException {
    System.out.println("user detail service");
    if (userName == null || userName.trim().isEmpty()) {
        throw new UsernameNotFoundException("Empty username");
    }/*from   ww w . j  ava2 s.c  om*/

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Security verification for user '" + userName + "'");
    }
    SmsGatewayUser spiUser = this.userDao.getByUserIdOrEmail(userName);
    if (spiUser == null) {
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("User " + userName + " could not be found");
        }
        throw new UsernameNotFoundException("user " + userName + " could not be found");
    } else {
        System.out.println("ketemu kokk");
    }
    //        List<SpiRole> spiRoles = new ArrayList<>();
    List<String> dataRole = new ArrayList<>();
    for (UserRole spiUserRole : userRoleDao.getByUserId(spiUser.getId())) {
        //            spiRoles.add(spiUserRole.getSpiRole());
        dataRole.add(spiUserRole.getRole().getRoleName());
    }
    Collection<GrantedAuthority> grantedAuthorities = toGrantedAuthorities(dataRole);
    String password = spiUser.getPassword();
    Boolean isActive = Boolean.FALSE;
    Boolean isLock = Boolean.FALSE;
    Boolean isExired = Boolean.FALSE;

    if (spiUser.getIsActive() == 1) {
        isActive = Boolean.TRUE;
    }
    if (spiUser.getIsExpired() == 1) {
        isExired = Boolean.TRUE;
    }
    if (spiUser.getIsLock() == 1) {
        isLock = Boolean.TRUE;
    }
    //        for (SpiRole spiRole : spiRoles) {
    //            dataRole.add(spiRole.getRoleName());
    //        }
    return new User(userName, password, isActive, true, !isExired, !isLock, grantedAuthorities);
}

From source file:com.inkubator.hrm.service.impl.BioRelasiPerusahaanServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<BioRelasiPerusahaan> getByParam(BioRelasiPerusahaanSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) throws Exception {
    return bioRelasiPerusahaanDao.getByParam(searchParameter, firstResult, maxResults, order);
}

From source file:com.inkubator.sms.gateway.service.impl.ModemDefinitionServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public ModemDefinition getEntiyByPK(Long id) throws Exception {
    return this.modemDefinitionDao.getByFullText(id);
}

From source file:annis.administration.DeleteCorpusDao.java

@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
public void deleteCorpora(List<Long> ids, boolean acquireLock) {
    if (acquireLock && !lockRepositoryMetadataTable(false)) {
        log.error("Another import is currently running");
        return;/*from  w  w w .j a va2  s . c  o  m*/
    }

    if (ids == null || ids.isEmpty()) {
        return;
    }

    File dataDir = getRealDataDir();

    for (long l : ids) {
        log.info("deleting external data files");

        List<String> filesToDelete = getJdbcTemplate()
                .queryForList("SELECT filename FROM media_files AS m, corpus AS top, corpus AS child\n"
                        + "WHERE\n" + "  m.corpus_ref = child.id AND\n" + "  top.id = ? AND\n"
                        + "  child.pre >= top.pre AND child.post <= top.post", String.class, l);
        for (String fileName : filesToDelete) {
            File f = new File(dataDir, fileName);
            if (f.exists()) {
                if (!f.delete()) {
                    log.warn("Could not delete {}", f.getAbsolutePath());
                }
            }
        }

        log.info("dropping tables");

        log.debug("dropping facts table for corpus " + l);
        getJdbcTemplate().execute("DROP TABLE IF EXISTS facts_" + l);
        getJdbcTemplate().execute("DROP TABLE IF EXISTS facts_edge_" + l);
        getJdbcTemplate().execute("DROP TABLE IF EXISTS facts_node_" + l);
        log.debug("dropping annotation_pool table for corpus " + l);
        getJdbcTemplate().execute("DROP TABLE IF EXISTS annotation_pool_" + l);
        log.debug("dropping annotations table for corpus " + l);
        getJdbcTemplate().execute("DROP TABLE IF EXISTS annotations_" + l);
    }

    log.info("recursivly deleting corpora: " + ids);

    executeSqlFromScript("delete_corpus.sql", makeArgs().addValue(":ids", StringUtils.join(ids, ", ")));
}

From source file:com.inkubator.sms.gateway.service.impl.LoginHistoryServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void save(LoginHistory entity) throws Exception {
    this.loginHistoryDao.save(entity);
}

From source file:com.inkubator.hrm.service.impl.PasswordComplexityServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void save(PasswordComplexity entity) throws Exception {
    this.passwordComplexityDao.save(entity);
}

From source file:com.inkubator.hrm.service.impl.HrmRoleServiceImpl.java

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
public void save(HrmRole entity) throws Exception {
    this.hrmRoleDao.save(entity);
}

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 TaskDefinition getEntiyByPK(Long id) throws Exception {
    TaskDefinition definition = taskDefinitionDao.getByFullText(id);
    definition.getModemDefinition().getManufacture();
    return definition;
}