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.ibm.asset.trails.service.impl.ReconWorkspaceServiceImpl.java

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public ReconcileType findReconcileType(Long id) {
    return reconTypeDAO.findById(id);
}

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

/**
 * {@inheritDoc}/* ww  w .ja va2 s.c  om*/
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Override
public void createTransaction(final ExternalFill fill) {

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

    Security security = fill.getSecurity();
    SecurityFamily securityFamily = security != null ? security.getSecurityFamily() : null;
    Currency currency = securityFamily != null ? securityFamily.getCurrency() : fill.getCurrency();
    Account account = fill.getAccount();
    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(null);
    transaction.setExtOrderId(fill.getExtOrderId());
    transaction.setQuantity(quantity);
    transaction.setPrice(fill.getPrice());
    transaction.setType(transactionType);
    transaction.setSecurity(security);
    transaction.setStrategy(fill.getStrategy());
    transaction.setCurrency(currency);
    transaction.setAccount(account);

    String broker = account != null ? account.getBroker() : null;
    if (fill.getExecutionCommission() != null) {
        transaction.setExecutionCommission(fill.getExecutionCommission());
    } else if (securityFamily != null) {
        BigDecimal executionCommission = securityFamily.getExecutionCommission(broker);
        if (executionCommission != null) {
            transaction.setExecutionCommission(
                    RoundUtil.getBigDecimal(Math.abs(quantity * executionCommission.doubleValue())));
        }
    }

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

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

    processTransaction(transaction);

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

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

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public List<InstalledSoftware> installedSoftwareList(Long installedSoftwareId, Account account, String hostName,
        String hwOwner, String machineType, String serial, Long scopeId, String manufacturerName) {

    List<InstalledSoftware> result = new ArrayList<InstalledSoftware>();

    InstalledSoftware is = instSwDAO.findById(installedSoftwareId);
    List<InstalledSoftware> isList = instSwDAO.installedSoftwareList(is.getSoftwareLpar().getId(),
            is.getSoftware().getSoftwareId());

    //filter socpe
    for (InstalledSoftware insw : isList) {
        ScheduleF scheduleF = vSwLparDAO.getScheduleFItem(account, insw.getSoftware().getSoftwareName(),
                hostName, hwOwner, machineType, serial, manufacturerName);
        if (null != scheduleF && scheduleF.getScope().getId().equals(scopeId)) {
            result.add(insw);/*from w w  w  .  ja v  a 2s .com*/
        }
    }

    return result;
}

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

/**
 * ?qs???qs???//from   ww  w. j a  va2  s  .  c  o m
 * @param firstpart qs?
 * @param formatId qs?id
 * @throws ServiceException 
 * @author HuangYog 2015/01/28 --? firstpart
 */
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public List<String> getListOfQsNo(String firstpart, Long formatId) throws ServiceException {
    try {
        return getDAO().getListOfQsNo(firstpart, formatId);
    } catch (DaoException e) {
        throw new ServiceException(e.getMessage(), e.getException());
    }
}

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

@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED)
public InstalledSoftware getInstalledSoftware(Long installedSoftwareId) {
    return instSwDAO.getInstalledSoftware(installedSoftwareId);
}

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

@Scheduled(fixedDelay = 10 * DateUtils.MILLIS_PER_SECOND)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Override/*  w w  w.j  ava  2s  . c o m*/
public synchronized void pollForNewUndeliveredResourcesScheduler() {
    if (getConfig().isSchedulingDisabled()) {
        return;
    }
    pollForNewUndeliveredResources();
}

From source file:com.silverpeas.notification.delayed.DelayedNotificationManager.java

@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public Set<NotifChannel> getWiredChannels() {
    return WIRED_CHANNELS;
}

From source file:com.silverpeas.notification.delayed.DelayedNotificationManager.java

@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public Set<DelayedNotificationFrequency> getPossibleFrequencies() {
    if (POSSIBLE_FREQUENCIES == null) {
        synchronized (SYNCHRONIZED) {
            if (POSSIBLE_FREQUENCIES == null) {

                // Initialization
                final Set<DelayedNotificationFrequency> possibleFrequencies = new HashSet<DelayedNotificationFrequency>();

                // The parameter value
                final String frequencyChoiceList = settings
                        .getString("DELAYED_NOTIFICATION_FREQUENCY_CHOICE_LIST", "").replaceAll(" ", "");

                // The posible frequencies
                if (StringUtils.isNotBlank(frequencyChoiceList)) {
                    for (final String frequencyCode : frequencyChoiceList.split("[,;|]")) {
                        if ("*".equals(frequencyCode)) {
                            possibleFrequencies.addAll(Arrays.asList(DelayedNotificationFrequency.values()));
                        } else {
                            possibleFrequencies.add(DelayedNotificationFrequency.decode(frequencyCode));
                        }/*from  w  ww  .j a  v a 2 s  . c  o  m*/
                    }
                }

                // Eliminating wrong frequencies
                possibleFrequencies.remove(null);
                POSSIBLE_FREQUENCIES = new TreeSet<DelayedNotificationFrequency>(possibleFrequencies);
            }
        }
    }
    return POSSIBLE_FREQUENCIES;
}

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

@Scheduled(fixedDelay = DateUtils.MILLIS_PER_MINUTE)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Override/*w w  w  .  j  a v a2  s .c  o  m*/
public void purgeInactiveSubscriptions() {
    if (getConfig().isSchedulingDisabled()) {
        return;
    }

    Long purgeInactiveAfterMillis = getConfig().getSubscriptionPurgeInactiveAfterMillis();
    if (getConfig().isSubscriptionEnabled() == false || purgeInactiveAfterMillis == null) {
        return;
    }

    Date cutoff = new Date(System.currentTimeMillis() - purgeInactiveAfterMillis);
    Collection<SubscriptionTable> toPurge = mySubscriptionTableDao.findInactiveBeforeCutoff(cutoff);
    for (SubscriptionTable subscriptionTable : toPurge) {

        final IdDt subscriptionId = subscriptionTable.getSubscriptionResource().getIdDt();
        ourLog.info("Deleting inactive subscription {} - Created {}, last client poll {}",
                new Object[] { subscriptionId.toUnqualified(), subscriptionTable.getCreated(),
                        subscriptionTable.getLastClientPoll() });
        TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
        txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
        txTemplate.execute(new TransactionCallback<Void>() {
            @Override
            public Void doInTransaction(TransactionStatus theStatus) {
                delete(subscriptionId, null);
                return null;
            }
        });
    }
}

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

/**
 * {@inheritDoc}/* ww  w.  ja v  a 2s.co m*/
 */
// This method needs to be non-transaction in ensure correct creation of position and cash balance records in a separate transaction
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Override
public void createTransaction(final long securityId, final String strategyName, final String extId,
        final Date dateTime, final long quantity, final BigDecimal price, final BigDecimal executionCommission,
        final BigDecimal clearingCommission, final BigDecimal fee, final Currency currency,
        final TransactionType transactionType, final String accountName, final String description) {

    Validate.notEmpty(strategyName, "Strategy name is empty");
    Validate.notNull(dateTime, "Date time is null");
    Validate.notNull(price, "Price is null");
    Validate.notNull(transactionType, "Transaction type is null");

    Currency currencyNonFinal = currency;
    long quantityNonFinal = quantity;
    // validations

    Strategy strategy = this.strategyDao.findByName(strategyName);
    if (strategy == null) {
        throw new ServiceException("strategy " + strategyName + " was not found", null);
    }

    int scale = this.commonConfig.getPortfolioDigits();
    Security security = this.securityDao.get(securityId);
    if (TransactionType.BUY.equals(transactionType) || TransactionType.SELL.equals(transactionType)
            || TransactionType.EXPIRATION.equals(transactionType)
            || TransactionType.TRANSFER.equals(transactionType)) {

        if (security == null) {
            throw new IllegalArgumentException("security " + securityId + " was not found");
        }

        currencyNonFinal = security.getSecurityFamily().getCurrency();
        scale = security.getSecurityFamily().getScale();

        if (TransactionType.BUY.equals(transactionType)) {
            quantityNonFinal = Math.abs(quantityNonFinal);
        } else if (TransactionType.SELL.equals(transactionType)) {
            quantityNonFinal = -Math.abs(quantityNonFinal);
        }

        // for EXPIRATION or TRANSFER the actual quantity istaken

    } else if (TransactionType.CREDIT.equals(transactionType)
            || TransactionType.INTREST_RECEIVED.equals(transactionType)
            || TransactionType.DIVIDEND.equals(transactionType)
            || TransactionType.REFUND.equals(transactionType)) {

        if (currencyNonFinal == null) {
            throw new IllegalArgumentException("need to define a currency for " + transactionType);
        }

        quantityNonFinal = 1;

    } else if (TransactionType.DEBIT.equals(transactionType)
            || TransactionType.INTREST_PAID.equals(transactionType)
            || TransactionType.FEES.equals(transactionType)) {

        if (currencyNonFinal == null) {
            throw new IllegalArgumentException("need to define a currency for " + transactionType);
        }

        quantityNonFinal = -1;

    } else if (TransactionType.REBALANCE.equals(transactionType)) {

        throw new IllegalArgumentException("transaction type REBALANCE not allowed");
    }

    Account account = accountName != null ? this.accountDao.findByName(accountName) : null;

    // create the transaction
    Transaction transaction = Transaction.Factory.newInstance();
    transaction.setUuid(UUID.randomUUID().toString());
    transaction.setDateTime(dateTime);
    transaction.setExtId(extId);
    transaction.setQuantity(quantityNonFinal);
    transaction.setPrice(price.setScale(scale));
    transaction.setType(transactionType);
    transaction.setSecurity(security);
    transaction.setStrategy(strategy);
    transaction.setCurrency(currencyNonFinal);
    transaction.setExecutionCommission(executionCommission);
    transaction.setClearingCommission(clearingCommission);
    transaction.setFee(fee);
    transaction.setAccount(account);
    transaction.setDescription(description);

    processTransaction(transaction);

}