Example usage for org.springframework.transaction.annotation Propagation NOT_SUPPORTED

List of usage examples for org.springframework.transaction.annotation Propagation NOT_SUPPORTED

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Propagation NOT_SUPPORTED.

Prototype

Propagation NOT_SUPPORTED

To view the source code for org.springframework.transaction.annotation Propagation NOT_SUPPORTED.

Click Source Link

Document

Execute non-transactionally, suspend the current transaction if one exists.

Usage

From source file:org.wallride.service.PageService.java

@CacheEvict(value = WallRideCacheConfiguration.PAGE_CACHE, allEntries = true)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public List<Page> bulkDeletePage(PageBulkDeleteRequest bulkDeleteRequest, BindingResult result) {
    List<Page> pages = new ArrayList<>();
    for (long id : bulkDeleteRequest.getIds()) {
        final PageDeleteRequest deleteRequest = new PageDeleteRequest.Builder().id(id)
                .language(bulkDeleteRequest.getLanguage()).build();

        final BeanPropertyBindingResult r = new BeanPropertyBindingResult(deleteRequest, "request");
        r.setMessageCodesResolver(messageCodesResolver);

        TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
        transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
        Page page = null;//  w w  w  . j  av  a2s  .  c o m
        try {
            page = transactionTemplate.execute(new TransactionCallback<Page>() {
                public Page doInTransaction(TransactionStatus status) {
                    try {
                        return deletePage(deleteRequest, r);
                    } catch (BindException e) {
                        throw new RuntimeException(e);
                    }
                }
            });
            pages.add(page);
        } catch (Exception e) {
            logger.debug("Errors: {}", r);
            result.addAllErrors(r);
        }
    }
    return pages;
}

From source file:com.xn.interfacetest.service.impl.TestCaseServiceImpl.java

@Transactional(propagation = Propagation.NOT_SUPPORTED)
private void excute(final List<TestCaseDto> testCaseDtoList, final TestEnvironmentDto testEnvironmentDto,
        final Long planId, final TestReportDto testReportDto, final TestSuitDto suitDto) {
    logger.info("==================");
    ///*www .j  ava  2 s.c  om*/
    ExecutorService threadPool = Executors.newFixedThreadPool(10);
    ;
    //??
    for (int i = 0; i < testCaseDtoList.size(); i++) {
        final int finalI = i;
        threadPool.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    logger.info("========" + finalI);
                    excuteCase(testCaseDtoList.get(finalI), testEnvironmentDto, planId, testReportDto, suitDto);
                } catch (Exception e) {
                    logger.error("", e);
                }

            }
        });
    }

    try {
        logger.info("sleep-----" + 1000);
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        logger.info("InterruptedException-----" + e.getMessage());
    }

    threadPool.shutdown();
    while (true) {
        if (threadPool.isTerminated()) {
            break;
        }
    }
}

From source file:com.gettec.fsnip.fsn.service.business.impl.BusinessUnitServiceImpl.java

/**
 * Id??/* w ww  .j  a  v a 2s.c  o  m*/
 * @param info  ?
 * @param isLoadImg<br>
 *              true:??, false:?
 * @param isCompatibilityNotRegiste<br>
 *              true:?, false:?
 * @author ZhangHui 2015/4/9
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public BusinessUnit findByInfo(AuthenticateInfo info, boolean isLoadImg, boolean isCompatibilityNotRegiste)
        throws ServiceException {
    try {
        /* 1. ??  */
        BusinessUnit businessUnit = BusinessUnitTransfer
                .transfer(getDAO().findByOrgnizationId(info.getOrganization()));
        if (businessUnit.getType() != null && businessUnit.getType().equals("??")) {
            /* 2. ???  */
            List<BusinessBrand> brands = BusinessBrandTransfer
                    .transfer(businessBrandService.getDAO().getListByBusunitId(businessUnit.getId()));
            businessUnit.setBrands(brands);
            /* 3. ??  */
            List<FieldValue> fieldValues = fieldValueService.getListByBusunitId(businessUnit.getId());
            businessUnit.setFieldValues(fieldValues);
            /* 4. ??? */
            List<ProducingDepartment> subDepartments = producingDepartmentService.getDAO()
                    .getListByBusunitIdAndDepartFlag(businessUnit.getId(), false);
            businessUnit.setSubDepartments(subDepartments);
            /* 5. ?? */
            List<ProducingDepartment> proDepartments = producingDepartmentService.getDAO()
                    .getListByBusunitIdAndDepartFlag(businessUnit.getId(), true);
            businessUnit.setProDepartments(proDepartments);
        }
        if (isLoadImg) {
            EnterpriseRegiste orig_enterprise = enterpriseService.findbyEnterpriteName(businessUnit.getName());
            if (orig_enterprise != null) {
                /* 4. ??  */
                businessUnit.setOrgAttachments(orig_enterprise.getOrgAttachments());
                businessUnit.setLicAttachments(orig_enterprise.getLicAttachments());
                businessUnit.setDisAttachments(orig_enterprise.getDisAttachments());
                businessUnit.setQsAttachments(orig_enterprise.getQsAttachments());
                businessUnit.setLogoAttachments(orig_enterprise.getLogoAttachments());
                businessUnit.setTaxRegAttachments(orig_enterprise.getTaxRegAttachments());
                if (businessUnit.getTaxRegister() != null) {
                    businessUnit.getTaxRegister().setTaxAttachments(orig_enterprise.getTaxRegAttachments());
                }
                businessUnit.setLiquorAttachments(orig_enterprise.getLiquorAttachments());
            } else if (isCompatibilityNotRegiste) {
                /* ?? */
                enterpriseService.save(businessUnit, info);
            }
            /* ?? */
            BusinessSalesInfo orig_busSalesInfo = businessSalesInfoService.findByBusId(businessUnit.getId());
            if (orig_busSalesInfo != null) {
                businessUnit.setPropagandaAttachments(setListResourceEx(orig_busSalesInfo.getPubPtotosName(),
                        orig_busSalesInfo.getPubPtotosUrl()));
                businessUnit.setQrAttachments(setListResource(orig_busSalesInfo.getQrcodeImgName(),
                        orig_busSalesInfo.getQrcodeImgUrl()));
            }
            /* ??  */
            List<BusinessCertification> listOfCertification = businessCertificationService
                    .getListOfCertificationByBusinessId(businessUnit.getId());
            businessUnit.setListOfCertification(listOfCertification);
        }
        return businessUnit;
    } catch (DaoException dex) {
        throw new ServiceException(
                "?service-errorId??,?",
                dex.getException());
    }
}

From source file:com.gettec.fsnip.fsn.service.business.impl.BusinessUnitServiceImpl.java

/**
 * Id??//w ww. j a v  a 2s  .c  o m
 * @param info  ?
 * @param isLoadImg<br>
 *              true:??, false:?
 * @param isCompatibilityNotRegiste<br>
 *              true:?, false:?
 * @author ZhangHui 2015/4/9
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public BusinessUnit findByInfo2(AuthenticateInfo info, BusinessUnit businessUnit1, boolean isLoadImg,
        boolean isCompatibilityNotRegiste) throws ServiceException {
    //      try {
    /* 1. ??  */
    //         BusinessUnit businessUnit = BusinessUnitTransfer.transfer(getDAO().findByOrgnizationId(info.getOrganization()));
    BusinessUnit businessUnit = null;
    try {
        businessUnit = BusinessUnitTransfer.transfer(getDAO().findById(businessUnit1.getId()));
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (businessUnit == null) {
        businessUnit = businessUnit1;
    }
    if (businessUnit.getType() != null && businessUnit.getType().equals("??")) {
        /* 2. ???  */
        List<BusinessBrand> brands = null;
        try {
            brands = BusinessBrandTransfer
                    .transfer(businessBrandService.getDAO().getListByBusunitId(businessUnit.getId()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        businessUnit.setBrands(brands);
        /* 3. ??  */
        List<FieldValue> fieldValues = null;
        try {
            fieldValues = fieldValueService.getListByBusunitId(businessUnit.getId());
        } catch (Exception e) {
            e.printStackTrace();
        }
        businessUnit.setFieldValues(fieldValues);
        /* 4. ??? */
        List<ProducingDepartment> subDepartments = null;
        try {
            subDepartments = producingDepartmentService.getDAO()
                    .getListByBusunitIdAndDepartFlag(businessUnit.getId(), false);
        } catch (Exception e) {
            e.printStackTrace();
        }

        businessUnit.setSubDepartments(subDepartments);
        /* 5. ?? */
        List<ProducingDepartment> proDepartments = null;
        try {
            proDepartments = producingDepartmentService.getDAO()
                    .getListByBusunitIdAndDepartFlag(businessUnit.getId(), true);
        } catch (Exception e) {
            e.printStackTrace();
        }

        businessUnit.setProDepartments(proDepartments);
    }
    if (isLoadImg) {
        EnterpriseRegiste orig_enterprise = null;
        try {
            orig_enterprise = enterpriseService.findbyEnterpriteName(businessUnit.getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (orig_enterprise != null) {
            /* 4. ??  */
            businessUnit.setOrgAttachments(orig_enterprise.getOrgAttachments());
            businessUnit.setLicAttachments(orig_enterprise.getLicAttachments());
            businessUnit.setDisAttachments(orig_enterprise.getDisAttachments());
            businessUnit.setQsAttachments(orig_enterprise.getQsAttachments());
            businessUnit.setLogoAttachments(orig_enterprise.getLogoAttachments());
            businessUnit.setTaxRegAttachments(orig_enterprise.getTaxRegAttachments());
            try {
                if (businessUnit.getTaxRegister() != null) {
                    try {
                        businessUnit.getTaxRegister().setTaxAttachments(orig_enterprise.getTaxRegAttachments());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    businessUnit.setTaxRegister(null);
                }
            } catch (Exception e) {
                e.printStackTrace();
                businessUnit.setTaxRegister(null);
            }
            businessUnit.setLiquorAttachments(orig_enterprise.getLiquorAttachments());
        } else if (isCompatibilityNotRegiste) {
            /* ?? */
            enterpriseService.save(businessUnit, info);
        }
        /* ?? */
        BusinessSalesInfo orig_busSalesInfo = null;
        try {
            orig_busSalesInfo = businessSalesInfoService.findByBusId(businessUnit.getId());
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (orig_busSalesInfo != null) {
            businessUnit.setPropagandaAttachments(setListResourceEx(orig_busSalesInfo.getPubPtotosName(),
                    orig_busSalesInfo.getPubPtotosUrl()));
            businessUnit.setQrAttachments(
                    setListResource(orig_busSalesInfo.getQrcodeImgName(), orig_busSalesInfo.getQrcodeImgUrl()));
        }
        /* ??  */
        List<BusinessCertification> listOfCertification = null;
        try {
            listOfCertification = businessCertificationService
                    .getListOfCertificationByBusinessId(businessUnit.getId());
        } catch (Exception e) {
            e.printStackTrace();
        }

        businessUnit.setListOfCertification(listOfCertification);
    }
    return businessUnit;
    //      } catch (DaoException dex) {
    //         throw new ServiceException("?service-errorId??,?", dex.getException());
    //      }
}

From source file:com.ibm.asset.trails.service.impl.ReconWorkspaceServiceImpl.java

@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public Long total(Account account, ReconSetting reconSetting) {
    // TODO Auto-generated method stub
    return vSwLparDAO.total(account, reconSetting);
}

From source file:com.ibm.asset.trails.service.impl.ReconWorkspaceServiceImpl.java

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public void paginatedList(DisplayTagList data, Account account, ReconSetting reconSetting, int startIndex,
        int objectsPerPage, String sort, String dir) {
    vSwLparDAO.paginatedList(data, account, reconSetting, startIndex, objectsPerPage, sort, dir);
}

From source file:com.ibm.asset.trails.service.impl.ReconWorkspaceServiceImpl.java

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public Reconcile reconcileDetail(Long id) {
    return reconDAO.reconcileDetail(id);
}

From source file:com.ibm.asset.trails.service.impl.ReconWorkspaceServiceImpl.java

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public List<Long> findAffectedAlertUnlicensedSwList(Account pAccount, List<ReconWorkspace> plReconWorkspace,
        String psRunOn) {//w ww . j  a  va2s.c o  m
    ListIterator<ReconWorkspace> lliReconWorkspace = plReconWorkspace.listIterator();
    ReconWorkspace lrwTemp = null;
    List<Long> results;

    if (psRunOn.equalsIgnoreCase("SELECTED")) {
        List<Long> llAlertUnlicensedSwId = new ArrayList<Long>();

        while (lliReconWorkspace.hasNext()) {
            lrwTemp = lliReconWorkspace.next();
            llAlertUnlicensedSwId.add(lrwTemp.getAlertId());
        }
        results = alertDAO.findAffectedAlertList(llAlertUnlicensedSwId);
    } else {
        List<Long> llProductInfoId = new ArrayList<Long>();
        Map<Long, Long> lmProductInfoId = new HashMap<Long, Long>();

        while (lliReconWorkspace.hasNext()) {
            lrwTemp = lliReconWorkspace.next();

            if (!lmProductInfoId.containsKey(lrwTemp.getProductInfoId())) {
                llProductInfoId.add(lrwTemp.getProductInfoId());
            }
        }

        if (psRunOn.equalsIgnoreCase("ALL")) {
            results = alertDAO.findAffectedAlertList(pAccount, llProductInfoId);
        } else {
            results = alertDAO.findAffectedAlertList(pAccount, llProductInfoId, psRunOn);
        }
    }

    return results;
}

From source file:com.newmainsoftech.spray.slingong.datastore.Slim3PlatformTransactionManagerTest.java

@Transactional(propagation = Propagation.NOT_SUPPORTED)
protected void notSupportedPropagationCommit() throws Throwable {
    prepTestModels();//ww  w . j  ava 2  s .c o m

    Assert.assertNull(Datastore.getCurrentGlobalTransaction());

    Datastore.put(a1);
    Datastore.put(a2);
    Datastore.put(b1);
    Datastore.put(b2);
    Datastore.put(a1b2);
    Datastore.put(a2b1);
    Datastore.put(a2b2);
    Datastore.put(b1c1);
    Datastore.put(b1c2);
    Datastore.put(b2c1);
    Datastore.put(b2c2);
}

From source file:com.newmainsoftech.spray.slingong.datastore.Slim3PlatformTransactionManagerTest.java

@Transactional(propagation = Propagation.NOT_SUPPORTED)
protected void notSupportedPropagationOnExistingTransaction() throws Throwable {
    GlobalTransaction gtx = Datastore.getCurrentGlobalTransaction();
    Assert.assertTrue(gtx instanceof GlobalTransaction);

    prep3rdBookModels(); // Note: Calling non transactional method
    Datastore.put(author3);// ww w .  ja va 2 s  . com
    Datastore.put(book3);
    Datastore.put(a2book3);
    Datastore.put(book3Chapter1);
    Datastore.put(a3b3Chapter1);
}