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

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

Introduction

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

Prototype

Isolation SERIALIZABLE

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

Click Source Link

Document

A constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented.

Usage

From source file:fi.hsl.parkandride.back.LockDao.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.SERIALIZABLE)
public boolean releaseLock(Lock lock) {
    validationService.validate(lock);/*from  www.java  2 s .c  o  m*/
    if (ownerName.equals(lock.owner)) {
        return deleteLock(lock) == 1;
    } else {
        throw new LockException("Cannot release lock. Lock is not owned by this node.");
    }
}

From source file:com.aan.girsang.server.service.impl.SecurityServiceImpl.java

@Override
@Transactional(isolation = Isolation.SERIALIZABLE)
public void simpan(TingkatAkses tA) {
    if ("".equals(tA.getId()))
        tA.setId(runningNumberDao.ambilBerikutnyaDanSimpan(MasterRunningNumberEnum.TINGKATAKSES));
    tingkatAksesDao.simpan(tA);/*w  w  w.jav a2 s  . c  om*/
}

From source file:com.perceptive.epm.perkolcentral.bl.EmployeeBL.java

@Cacheable(cacheName = "EmployeeKeyedByGroupCache", keyGenerator = @KeyGenerator(name = "HashCodeCacheKeyGenerator", properties = @Property(name = "includeMethod", value = "false")))
@Transactional(propagation = Propagation.REQUIRED, readOnly = true, isolation = Isolation.SERIALIZABLE, rollbackFor = ExceptionWrapper.class)
public LinkedHashMap<Integer, ArrayList<EmployeeBO>> getAllEmployeesKeyedByGroupId() throws ExceptionWrapper {
    LinkedHashMap<Integer, ArrayList<EmployeeBO>> employeeBOLinkedHashMap = new LinkedHashMap<Integer, ArrayList<EmployeeBO>>();
    Collection<EmployeeBO> employeeBOCollection = this.getAllEmployees().values();
    try {/*from w  ww.  ja  v  a2s .  com*/
        for (Object item : groupsBL.getAllGroups().values()) {
            final GroupBO groupBO = (GroupBO) item;
            ArrayList<EmployeeBO> employeeBOArrayList = new ArrayList<EmployeeBO>(employeeBOCollection);
            CollectionUtils.filter(employeeBOArrayList, new Predicate() {
                @Override
                public boolean evaluate(Object o) {
                    return CollectionUtils.exists(((EmployeeBO) o).getGroups(), new Predicate() {
                        @Override
                        public boolean evaluate(Object o) {
                            return ((GroupBO) o).getGroupId().equalsIgnoreCase(groupBO.getGroupId());
                        }
                    });
                }
            });
            employeeBOLinkedHashMap.put(Integer.valueOf(groupBO.getGroupId()), employeeBOArrayList);
        }
    } catch (Exception ex) {
        throw new ExceptionWrapper(ex);
    }
    return employeeBOLinkedHashMap;
}

From source file:eu.trentorise.smartcampus.permissionprovider.oauth.NonRemovingTokenServices.java

@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.SERIALIZABLE)
public OAuth2AccessToken refreshAccessToken(String refreshTokenValue, AuthorizationRequest request)
        throws AuthenticationException {
    return refreshWithRepeat(refreshTokenValue, request, false);
}

From source file:com.perceptive.epm.perkolcentral.bl.LicensesBL.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = true, isolation = Isolation.SERIALIZABLE, rollbackFor = ExceptionWrapper.class)
public HashMap<String, ArrayList<String>> getLicenseRelatedInfo() throws ExceptionWrapper {
    HashMap<String, ArrayList<String>> licenseInfoKeyedByLicenseName = new HashMap<String, ArrayList<String>>();
    try {// ww  w  .  j  a v a2s.  c  o  m

        for (Object obj : licenseMasterDataAccessor.getAllLicenseType().values()) {
            final LicenseBO licenseBO = (LicenseBO) obj;

            //get the total license purchased for this type of item
            ArrayList<Licensepurchase> licensepurchaseArrayList = licensePurchaseDataAccessor
                    .getAllLicensePurchaseInformation();
            CollectionUtils.filter(licensepurchaseArrayList, new Predicate() {
                @Override
                public boolean evaluate(Object o) {
                    Licensepurchase item = (Licensepurchase) o;
                    return (item.getLicensemaster().getLicenseTypeId()
                            .equals(Long.valueOf(licenseBO.getLicenseTypeId())));
                }
            });
            //Add up all the licenses purchased
            int totLicenses = 0;
            for (Object item : licensepurchaseArrayList) {
                totLicenses = totLicenses + ((Licensepurchase) item).getNumberOfLicenses();
            }

            if (!licenseInfoKeyedByLicenseName.containsKey(licenseBO.getLicenseTypeName()))
                licenseInfoKeyedByLicenseName.put(licenseBO.getLicenseTypeName(), new ArrayList<String>());
            licenseInfoKeyedByLicenseName.get(licenseBO.getLicenseTypeName())
                    .add(Integer.toString(totLicenses));

            //Get the total number of licenses used up for this type of licenses
            licenseInfoKeyedByLicenseName.get(licenseBO.getLicenseTypeName())
                    .add(Integer.toString(employeeLicenseDataAccessor
                            .getEmployeeIdsByLicenseId(licenseBO.getLicenseTypeId()).size()));
        }

    } catch (Exception ex) {
        throw new ExceptionWrapper(ex);
    }
    return licenseInfoKeyedByLicenseName;
}

From source file:com.aan.girsang.server.service.impl.MasterServiceImpl.java

@Override
@Transactional(isolation = Isolation.SERIALIZABLE)
public void simpan(SatuanBarang satuanBarang) {
    if (satuanBarang.getId() == null)
        satuanBarang.setId(runningNumberDao.ambilBerikutnyaDanSimpan(MasterRunningNumberEnum.SATUAN));
    satuanBarangDao.simpan(satuanBarang);
}

From source file:com.ephesoft.dcma.da.service.impl.ReportsFolderServiceImpl.java

@Transactional(isolation = Isolation.SERIALIZABLE, readOnly = true)
@Override
public List<ReportsFolder> getAllFolders() {
    return reportsFolderDao.getAllFolders();
}

From source file:com.aan.girsang.server.service.impl.TransaksiServiceImpl.java

@Transactional(isolation = Isolation.SERIALIZABLE)
@Override/*from  w  w  w . jav  a 2s. c o m*/
public void simpan(Pembelian p) {
    Pembelian pembelian = pembelianDao.cariId(p.getNoRef());
    if (pembelian == null) {
        p.setNoRef(runningNumberTransaksiDao.ambilBerikutnyaDanSimpan(TransaksiRunningNumberEnum.PEMBELIAN));
        int i = 1;
        for (PembelianDetail detail : p.getPembelianDetails()) {
            detail.setId(p.getNoRef() + i++);
        }
    } else {
        int i = 1;
        for (PembelianDetail detail : p.getPembelianDetails()) {
            try {
                i++;
                if (detail.getId() == null) {
                    detail.setId(p.getNoRef() + i++);
                }
            } catch (Exception e) {
                i = i + 1;
                if (detail.getId() == null) {
                    detail.setId(p.getNoRef() + i++);
                }
            }
            if (detail.getId() == null) {
                detail.setId(p.getNoRef() + i++);
            }
        }
    }
    //update barang
    //<editor-fold defaultstate="collapsed" desc="Update Barang">
    for (PembelianDetail detail : p.getPembelianDetails()) {

        Barang b = barangDao.cariId(detail.getBarang().getPlu());
        if (detail.getUpdate() == true) {
            Double hargaBeli = Double.valueOf(TextComponentUtils
                    .getValueFromTextNumber(TextComponentUtils.formatNumber(detail.getHargaBarang())));
            Double isi = Double.valueOf(detail.getIsiPembelian());//harga beli di bagi isi
            Double hargaSatuan = hargaBeli / isi;
            BigDecimal hS = new BigDecimal(hargaSatuan, MathContext.DECIMAL64);
            b.setSatuanPembelian(detail.getSatuanPembelian());
            b.setHargaBeli(BigDecimal.valueOf(hargaSatuan));
            b.setIsiPembelian(detail.getIsiPembelian());

            //Simpan HPP Barang
            HPPBarang hPPBarang = new HPPBarang();
            hPPBarang.setIdHpp(runningNumberDao.ambilBerikutnyaDanSimpan(MasterRunningNumberEnum.HPP));
            hPPBarang.setTanggal(detail.getPembelian().getTanggal());
            hPPBarang.setBarang(b);
            hPPBarang.setHpp(detail.getHargaBarang());
            hPPBarang.setIsi(detail.getIsiPembelian());
            hPPBarang.setHppSatuan(BigDecimal.valueOf(hargaSatuan));

            barangDao.simpan(b);
            hPPDao.simpan(hPPBarang);
        }

    }
    //</editor-fold>
    pembelianDao.merge(p);
    simpanStokPembelian(p);
    simpanHutang();
}

From source file:com.ephesoft.dcma.da.service.impl.ReportsFolderServiceImpl.java

@Transactional(isolation = Isolation.SERIALIZABLE, readOnly = true)
@Override//from w  w w. j  av  a  2 s  .c  om
public List<ReportsFolder> getAllFoldersEagerly() {
    final List<ReportsFolder> reportFolderList = reportsFolderDao.getAllFolders();
    if (CollectionUtils.isNotEmpty(reportFolderList)) {

        // iterating through the returned Arraylist to get values of all child report before service layer disconnect it from
        // session.
        for (final ReportsFolder reportFolder : reportFolderList) {
            final List<Report> reports = reportFolder.getChildReports();
            String hostURIPath = reportFolder.getHostURIPath();
            String folderContextPath = reportFolder.getDefaultContextPath();
            if (CollectionUtils.isNotEmpty(reports)) {
                LOGGER.info("Following is the retrieved reports Name for folder: ", hostURIPath,
                        folderContextPath);
                for (final Report aReport : reports) {
                    String parentReportName = aReport.getFolderName();
                    LOGGER.debug("Report Name: ", parentReportName, ", Default Folder Path is: ",
                            aReport.getDefaultFolderPath());
                    final List<SubReport> subReports = aReport.getSubReports();
                    if (CollectionUtils.isNotEmpty(subReports)) {
                        LOGGER.info("Following is the retrieved sub reports Name for parent report: ",
                                parentReportName);
                        for (final SubReport aSubReport : subReports) {
                            LOGGER.debug("Sub Report Name: ", aSubReport.getReportName(),
                                    " and Default Report Path is: ", aSubReport.getDefaultReportPath());
                        }
                    } else {
                        LOGGER.warn("Either null or no reports are under report: ", parentReportName);
                    }
                }
            } else {
                LOGGER.warn("Either null or no reports are under folder: ", hostURIPath, folderContextPath);
            }
        }
    } else {
        LOGGER.info("Report folder list came as null or empty");
    }
    return reportFolderList;
}

From source file:com.ephesoft.dcma.da.service.ServerRegistryServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE)
public void createServerRegistry(ServerRegistry serverRegistry) {
    serverRegistryDao.createServerRegistry(serverRegistry);
}