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:com.gcrm.service.impl.BaseService.java

@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public long getObjectsCount(String clazz) {
    return baseDao.getObjectsCount(clazz);
}

From source file:ch.algotrader.service.TransactionServiceImpl.java

/**
 * {@inheritDoc}//  w ww.  jav  a2  s  .c o  m
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Override
public void createTransaction(final Fill fill) {

    Validate.notNull(fill, "Fill is null");

    long startTime = System.nanoTime();
    LOGGER.debug("createTransaction start");

    Order order = fill.getOrder();
    order.initializeSecurity(HibernateInitializer.INSTANCE);
    order.initializeAccount(HibernateInitializer.INSTANCE);
    order.initializeExchange(HibernateInitializer.INSTANCE);

    // reload the strategy and security to get potential changes
    Strategy strategy = this.strategyDao.load(order.getStrategy().getId());
    Security security = this.securityDao
            .findByIdInclFamilyUnderlyingExchangeAndBrokerParameters(order.getSecurity().getId());

    SecurityFamily securityFamily = security.getSecurityFamily();
    TransactionType transactionType = Side.BUY.equals(fill.getSide()) ? TransactionType.BUY
            : TransactionType.SELL;
    long quantity = Side.BUY.equals(fill.getSide()) ? fill.getQuantity() : -fill.getQuantity();

    Transaction transaction = Transaction.Factory.newInstance();
    transaction.setUuid(UUID.randomUUID().toString());
    transaction.setDateTime(fill.getExtDateTime());
    transaction.setExtId(fill.getExtId());
    transaction.setIntOrderId(order.getIntId());
    transaction.setExtOrderId(order.getExtId());
    transaction.setQuantity(quantity);
    transaction.setPrice(fill.getPrice());
    transaction.setType(transactionType);
    transaction.setSecurity(security);
    transaction.setStrategy(strategy);
    transaction.setCurrency(securityFamily.getCurrency());
    transaction.setAccount(order.getAccount());

    String broker = order.getAccount().getBroker();
    if (fill.getExecutionCommission() != null) {
        transaction.setExecutionCommission(fill.getExecutionCommission());
    } else if (securityFamily.getExecutionCommission(broker) != null) {
        transaction.setExecutionCommission(RoundUtil.getBigDecimal(
                Math.abs(quantity * securityFamily.getExecutionCommission(broker).doubleValue())));
    }

    if (fill.getClearingCommission() != null) {
        transaction.setClearingCommission(fill.getClearingCommission());
    } else if (securityFamily.getClearingCommission(broker) != null) {
        transaction.setClearingCommission(RoundUtil.getBigDecimal(
                Math.abs(quantity * securityFamily.getClearingCommission(broker).doubleValue())));
    }

    if (fill.getFee() != null) {
        transaction.setFee(fill.getFee());
    } else if (securityFamily.getFee(broker) != null) {
        transaction.setFee(
                RoundUtil.getBigDecimal(Math.abs(quantity * securityFamily.getFee(broker).doubleValue())));
    }

    processTransaction(transaction);

    LOGGER.debug("createTransaction end");
    MetricsUtil.accountEnd("CreateTransactionSubscriber", startTime);
}

From source file:com.gcrm.service.impl.BaseService.java

@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public SearchResult<T> getPaginationObjects(String clazz, final SearchCondition searchCondition) {

    return baseDao.getPaginationObjects(clazz, searchCondition);
}

From source file:gov.nih.nci.cabig.caaers.dao.StudyDao.java

/**
 * Get the Class representation of the domain object that this DAO is
 * representing./*from   www.  ja va  2 s  .  c om*/
 *
 * @return Class representation of the domain object that this DAO is
 *         representing.
 */
@Override
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public Class<Study> domainClass() {
    return Study.class;
}

From source file:com.wms.studio.service.WallpaperServiveImpl.java

@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public PageDto<WallpaperDto> findBy(final WallpaperEnum wallpaperType, final Date startDate, final Date endDate,
        PageSize pageSize) {// w  ww .ja v a  2 s .  c  o m

    if (pageSize == null) {
        pageSize = new PageSize();
    }

    Page<Wallpaper> pageWallpaper = this.wallpaperRepository.findAll(new Specification<Wallpaper>() {

        @Override
        public Predicate toPredicate(Root<Wallpaper> root, CriteriaQuery<?> query, CriteriaBuilder cb) {

            List<Predicate> pres = new ArrayList<Predicate>();

            if (wallpaperType != null) {
                pres.add(cb.equal(root.get("wallpaperType").as(WallpaperEnum.class), wallpaperType));
            }

            if (startDate != null) {
                pres.add(cb.greaterThanOrEqualTo(root.get("addDate").as(Date.class), startDate));
            }

            if (endDate != null) {
                pres.add(cb.lessThanOrEqualTo(root.get("addDate").as(Date.class), endDate));
            }

            Predicate[] p = new Predicate[pres.size()];
            return cb.and(pres.toArray(p));
        }
    }, new PageRequest(pageSize.getPage() - 1, pageSize.getLimit()));

    return this.wallpaperCovert.covertToDto(pageWallpaper);
}

From source file:ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoSubscriptionDstu3.java

@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public synchronized int pollForNewUndeliveredResources() {
    if (getConfig().isSubscriptionEnabled() == false) {
        return 0;
    }// ww  w .  ja  v a  2s  . c  o m
    ourLog.trace("Beginning pollForNewUndeliveredResources()");

    // SubscriptionCandidateResource

    Collection<Long> subscriptions = mySubscriptionTableDao
            .findSubscriptionsWhichNeedToBeChecked(SubscriptionStatusEnum.ACTIVE.getCode(), new Date());

    TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
    txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);

    int retVal = 0;
    for (final Long nextSubscriptionTablePid : subscriptions) {
        retVal += txTemplate.execute(new TransactionCallback<Integer>() {
            @Override
            public Integer doInTransaction(TransactionStatus theStatus) {
                SubscriptionTable nextSubscriptionTable = mySubscriptionTableDao
                        .findOne(nextSubscriptionTablePid);
                return pollForNewUndeliveredResources(nextSubscriptionTable);
            }
        });
    }

    return retVal;
}

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

@Transactional(propagation = Propagation.NOT_SUPPORTED)
@CacheEvict(value = { WallRideCacheConfiguration.ARTICLE_CACHE,
        WallRideCacheConfiguration.PAGE_CACHE }, allEntries = true)
public List<Tag> bulkDeleteTag(TagBulkDeleteRequest bulkDeleteRequest, final BindingResult result) {
    List<Tag> tags = new ArrayList<>();
    for (long id : bulkDeleteRequest.getIds()) {
        final TagDeleteRequest deleteRequest = new TagDeleteRequest.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);
        Tag tag = null;//from   ww w  .j  a  v  a2  s  .c  om
        try {
            tag = transactionTemplate.execute(new TransactionCallback<Tag>() {
                public Tag doInTransaction(TransactionStatus status) {
                    return deleteTag(deleteRequest, result);
                }
            });
            tags.add(tag);
        } catch (Exception e) {
            logger.debug("Errors: {}", r);
            result.addAllErrors(r);
        }
    }
    return tags;
}

From source file:com.gcrm.service.impl.BaseService.java

@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public List<T> getObjects(final String clazz, final String condition) {
    return baseDao.getObjects(clazz, condition);
}

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

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public List<Map<String, Object>> reconcileTypeActions() {
    // User Story 23223 - remove "CO/CM" from reconcile type list Start
    List<Map<String, Object>> reconcileTypeList = reconTypeDAO.reconcileTypeActions();
    List<Map<String, Object>> reconcileTypeRemoveList = new ArrayList<Map<String, Object>>();

    for (Map<String, Object> reconcileTypeMap : reconcileTypeList) {
        if (reconcileTypeMap.get("id") != null && ((Long) reconcileTypeMap.get("id")).intValue() == 2) {// judge
            // if
            // reconcile
            // type
            // is
            // manual
            // CO/CM
            reconcileTypeRemoveList.add(reconcileTypeMap);// add manual
            // CO/CM
            // reconcile
            // type into
            // reconcile
            // type remove
            // list
        }/*from  ww w . j  a v a  2 s  . co  m*/
    }

    reconcileTypeList.removeAll(reconcileTypeRemoveList);// remove manual
    // CO/CM
    // reconcile
    // type from
    // reconcile
    // type list
    return reconcileTypeList;
    // User Story 23223 - remove "CO/CM" from reconcile type list End
}

From source file:com.xyz.framework.data.impl.JpaDao.java

/**
 * ,????.//w  ww. j a v a  2  s. c  o m
 * 
 * @param matchType
 *            ??,????PropertyFilterMatcheType enum.
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public List<T> findBy(final String propertyName, final Object value, final MatchType matchType) {
    String criterion = buildPropertyFilterCriterion(propertyName, value, matchType);
    return find(criterion);
}