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.PayTempKalkulasiServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void deleteAllData() throws Exception {
    payTempKalkulasiDao.deleteAllData();

}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public Long getTotalKaryawan() throws Exception {
    return payTempKalkulasiDao.getTotalKaryawan();
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<PayTempKalkulasi> getByParamForDetail(String searchParameter, int firstResult, int maxResults,
        Order order, Long paySalaryComponentId) throws Exception {
    return payTempKalkulasiDao.getByParamForDetail(searchParameter, firstResult, maxResults, order,
            paySalaryComponentId);/* w ww . j ava2s . co  m*/
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public Long getTotalPayTempKalkulasiByParamForDetail(String searchParameter, Long paySalaryComponentId)
        throws Exception {
    return payTempKalkulasiDao.getTotalPayTempKalkulasiByParamForDetail(searchParameter, paySalaryComponentId);
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<PayTempKalkulasi> getAllDataByEmpDataIdAndTaxNotNull(Long empDataId) throws Exception {
    return payTempKalkulasiDao.getAllDataByEmpDataIdAndTaxNotNull(empDataId);

}

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

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void executeBatchFinalSalaryCalculation(EmpData empData) throws ScriptException {
    PayTempKalkulasiEmpPajak tax_23 = payTempKalkulasiEmpPajakDao
            .getEntityByEmpDataIdAndTaxComponentId(empData.getId(), 23L);
    PayTempKalkulasi taxKalkulasi = payTempKalkulasiDao
            .getEntityByEmpDataIdAndSpecificModelComponent(empData.getId(), HRMConstant.MODEL_COMP_TAX);
    //jika pajak PPh pasal 21 kurang dari 0(minus), maka di set 0 saja di payTempKalkulasi
    if (tax_23.getNominal() > 0) {
        taxKalkulasi.setNominal(new BigDecimal(tax_23.getNominal()));
    } else {// ww w.j a v a 2  s. com
        taxKalkulasi.setNominal(new BigDecimal(0));
    }
    payTempKalkulasiDao.update(taxKalkulasi);

    PayTempKalkulasi ceilKalkulasi = payTempKalkulasiDao
            .getEntityByEmpDataIdAndSpecificModelComponent(empData.getId(), HRMConstant.MODEL_COMP_CEIL);
    ScriptEngineManager mgr = new ScriptEngineManager();
    ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");
    double ceiling = (Double) jsEngine.eval(ceilKalkulasi.getPaySalaryComponent().getFormula());

    PayTempKalkulasi totalIncomeKalkulasi = payTempKalkulasiDao.getEntityByEmpDataIdAndSpecificModelComponent(
            empData.getId(), HRMConstant.MODEL_COMP_TAKE_HOME_PAY);
    BigDecimal totalIncome = totalIncomeKalkulasi.getNominal();
    totalIncome = this.calculateTotalIncome(totalIncome, taxKalkulasi);

    //dapatkan nilai sisa/pembulatan
    BigDecimal val[] = totalIncome.divideAndRemainder(new BigDecimal(ceiling));

    ceilKalkulasi.setNominal(val[1]);
    payTempKalkulasiDao.update(ceilKalkulasi);

    totalIncome = this.calculateTotalIncome(totalIncome, ceilKalkulasi);
    totalIncomeKalkulasi.setNominal(totalIncome);
    payTempKalkulasiDao.update(totalIncomeKalkulasi);
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public PayTempKalkulasi getEntityByEmpIdAndModelTakeHomePayId(Long empId) throws Exception {
    return payTempKalkulasiDao.getEntityByEmpIdAndModelTakeHomePayId(empId);
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public List<PayTempKalkulasi> getAllDataByEmpDataIdAndExcludeCompTHP(Long empDataId) throws Exception {
    return payTempKalkulasiDao.getAllDataByEmpDataIdAndExcludeCompTHP(empDataId);
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<SalaryJournalModel> getByParamForSalaryJournal(String searchParameter, int firstResult,
        int maxResults, Order order, String locale) throws Exception {

    Integer jumlahRowsTambahan = Integer.valueOf(String.valueOf(
            payTempKalkulasiDao.getTotalPayTempKalkulasiForSalaryJournalDebetAndKredit(searchParameter)));
    //reset sisaData biar bisa bulak balik page akhir + 1 halaman page akhir
    Integer hitLastPage = 0;/*from w  w w . ja v a2s  . com*/
    if (parameterLoop == null) {
        parameterLoop = 0;
    }
    Integer currentResult = maxResults;
    Long totalData = payTempKalkulasiDao.getTotalPayTempKalkulasiForSalaryJournal(searchParameter);
    Integer totalPage = Integer.valueOf(String.valueOf(totalData))
            / Integer.valueOf(String.valueOf(maxResults));
    //get list debet and credit
    List<SalaryJournalModel> listDebet = payTempKalkulasiDao.getByParamForSalaryJournalDebet(searchParameter);
    List<SalaryJournalModel> listKredit = payTempKalkulasiDao.getByParamForSalaryJournalKredit(searchParameter);
    List<SalaryJournalModel> listSalaryJournal = new ArrayList<>();

    if (totalData % maxResults != 0) {
        totalPage = totalPage + 1;
    }
    //jika halaman terakhir, total recordnya cukup untuk data tambahan
    Long spaceKosong = (totalPage * maxResults) - totalData;
    Boolean isSpaceKosongCukup = (spaceKosong < jumlahRowsTambahan) ? Boolean.FALSE : Boolean.TRUE;
    Boolean isLastPage = (firstResult == (totalPage * maxResults) - maxResults) ? Boolean.TRUE : Boolean.FALSE;

    listSalaryJournal = payTempKalkulasiDao.getByParamForSalaryJournal(searchParameter, firstResult, maxResults,
            order);
    SalaryJournalModel salaryJournalModel;
    if (sisaData == null) {
        sisaData = 0;
    }
    if (indexDataTerakhir == null) {
        indexDataTerakhir = jumlahRowsTambahan;
    }
    Integer sisaDataTerakhir = 0;
    if (isLastPage) {
        sisaData = 0;
        parameterLoop = Integer.valueOf(String.valueOf(maxResults)) - listSalaryJournal.size();
        sisaDataTerakhir = jumlahRowsTambahan - parameterLoop;
        hitLastPage = hitLastPage + 1;
    }
    Double totalUang = 0.0;
    int j = 0;
    if (hitLastPage == 0 && spaceKosong != 0) {
        indexDataTerakhir = indexDataTerakhir - Integer.valueOf(String.valueOf(spaceKosong));
        sisaData = jumlahRowsTambahan - Integer.valueOf(String.valueOf(spaceKosong));
        parameterLoop = jumlahRowsTambahan;
        int temp = sisaData;
        sisaData = parameterLoop - temp;

    } else if (isSpaceKosongCukup || totalData % maxResults == 0) {
        parameterLoop = jumlahRowsTambahan;
        sisaData = 0;
    }
    for (j = sisaData; j < parameterLoop; j++) {
        indexDataTerakhir = indexDataTerakhir - 1;
        totalUang = listDebet.get(j).getJumlahDebet().doubleValue()
                - listKredit.get(j).getJumlahKredit().doubleValue();
        salaryJournalModel = new SalaryJournalModel();
        salaryJournalModel.setCostCenterCode(listKredit.get(j).getCostCenterCodeKredit());
        salaryJournalModel.setCostCenterName(listKredit.get(j).getCostCenterNameKredit());
        salaryJournalModel.setJurnalCode("000000");
        ResourceBundle messages = ResourceBundle.getBundle("Messages", new Locale(locale));
        salaryJournalModel.setJurnalName(messages.getString("salaryJournal.paySalaryEmployee"));
        //debet > kredit => hasil ditaro di kredit
        //debet < kredit => hasil ditaro di debet
        if (listDebet.get(j).getJumlahDebet().doubleValue() > listKredit.get(j).getJumlahKredit()
                .doubleValue()) {
            salaryJournalModel.setDebet2(new BigDecimal(0));
            salaryJournalModel.setKredit(totalUang);
        } else {
            totalUang = -totalUang;
            salaryJournalModel.setDebet2(new BigDecimal(totalUang));
            salaryJournalModel.setKredit(0.0);
        }
        listSalaryJournal.add(salaryJournalModel);
        if (j == 0) {
            sisaData = 0;
        } else {
            sisaData = sisaData + 1;
        }
    }

    if (isLastPage) {
        sisaData = sisaData + 1;
        parameterLoop = parameterLoop + sisaDataTerakhir;
    }

    //reset sisaData dan hitLastPage jika terjadi pergantian maxResult
    if (previousMaxResult != currentResult) {
        sisaData = null;
        hitLastPage = 0;
    }
    previousMaxResult = currentResult;

    return listSalaryJournal;
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30)
public LoanNewApplication getEntityWithDetailByActivityNumber(String activityNumber) throws Exception {
    return loanNewApplicationDao.getEntityWithDetailByActivityNumber(activityNumber);
}