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

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

Introduction

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

Prototype

Propagation SUPPORTS

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

Click Source Link

Document

Support a current transaction, execute non-transactionally if none exists.

Usage

From source file:com.brienwheeler.svc.users.impl.UserService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork
@GracefulShutdown
public User findById(DbId<User> userId) {
    return userDao.findById(userId.getId());
}

From source file:it.geosolutions.geobatch.users.dao.hibernate.HibGBUserDAO.java

@Transactional(propagation = Propagation.SUPPORTS)
public GBUser findByUserId(Long userId) throws DAOException {
    return (GBUser) getHibernateTemplate().get(GBUser.class, userId);
}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 30)
public LoanType getEntiyByPK(Long l) throws Exception {
    return loanTypeDao.getEntiyByPK(l);
}

From source file:com.inkubator.sms.gateway.service.impl.UserServiceImpl.java

@Override
@Transactional(readOnly = false, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50)
public Integer getTotalByFullTextService(String parameter) throws Exception {
    return userDao.getTotalByFullTextService(parameter);
}

From source file:com.oak_yoga_studio.service.impl.FacultyServiceImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
@Override/*from w w w. j ava2s  .c  o m*/
public List<Faculty> getListOfFaculty() {
    try {
        return facultyDAO.getAllFaculties();
    } catch (Exception e) {
        return new ArrayList();
    }

}

From source file:org.brekka.phalanx.core.services.impl.AsymmetricCryptoServiceImpl.java

@Override
@Transactional(propagation = Propagation.SUPPORTS)
public <T> T decrypt(AsymedCryptoData cryptoData, final PrivateKeyToken privateKeyToken,
        final Class<T> expectedType) {
    if (privateKeyToken == null) {
        throw new NullPointerException("No private key token supplied");
    }//from   w ww. ja  v  a  2s .  c  om
    cryptoData = (AsymedCryptoData) this.cryptoDataDAO.retrieveById(cryptoData.getId());

    CryptoProfile profile = this.cryptoProfileService.retrieveProfile(cryptoData.getProfile());
    InternalPrivateKeyToken ipkt = narrow(privateKeyToken);
    PrivateKey privateKey = ipkt.getPrivateKey();

    AsymmetricKeyPair dataKeyPair = cryptoData.getKeyPair();
    AsymmetricKeyPair incomingkeyPair = ipkt.getKeyPair();
    // Public keys should always match, even if it is not the same keyPair.
    if (!dataKeyPair.getPublicKey().getId().equals(incomingkeyPair.getPublicKey().getId())) {
        throw new PhalanxException(PhalanxErrorCode.CP204,
                "The supplied private key '%s' (public key '%s') does not match that required to decrypt the keyPair '%s' (public key '%s').",
                incomingkeyPair.getPrivateKey().getId(), incomingkeyPair.getPublicKey().getId(),
                dataKeyPair.getId(), dataKeyPair.getPublicKey().getId());
    }

    byte[] data;
    try {
        data = this.phoenixAsymmetric.decrypt(cryptoData.getData(), privateKey);
    } catch (PhoenixException e) {
        throw new PhalanxException(PhalanxErrorCode.CP211, e, "Failed to decrypt data for CryptoData '%s'",
                cryptoData.getId());
    }
    return toType(data, expectedType, cryptoData.getId(), profile);
}

From source file:it.geosdi.era.server.dao.hibernate.DAOUtenteHibernate.java

/**
 * Load the user with the argument ID//www  .jav  a  2s  . c om
 */
@Transactional(propagation = Propagation.SUPPORTS)
public Utente loadUser(Long id) {
    Session session = getSession();
    Query query = session.createQuery(
            "select utente from Utente utente left join fetch utente.utentiProgetto utentiProgetto where utente.id = ?");
    query.setLong(0, id);
    return (Utente) query.uniqueResult();
}

From source file:com.brienwheeler.svc.users.impl.UserEmailAddressService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork//from   ww w .j a  va2 s.  com
@GracefulShutdown
public List<VerifiableEmailAddress> findByUser(User user) {
    ValidationUtils.assertNotNull(user, "user cannot be null");

    List<UserEmailAddress> userEmailAddresses = userEmailAddressDao.findByUser(user);
    List<VerifiableEmailAddress> emailAddresses = new ArrayList<VerifiableEmailAddress>();
    for (UserEmailAddress userEmailAddress : userEmailAddresses)
        emailAddresses.add(userEmailAddress.getEmailAddress());
    return emailAddresses;
}

From source file:com.brienwheeler.svc.users.impl.UserService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork/*ww w.  ja  v a 2 s. c  o m*/
@GracefulShutdown
public User findByUsername(String username) {
    username = ValidationUtils.assertNotEmpty(username, "username cannot be empty");

    return userDao.findByUsername(username);
}

From source file:net.longfalcon.newsj.Nfo.java

/**
 * only returns one NFO. dunno about releases with two nfos.
 * @param release/*w ww  . j  ava 2s . c om*/
 * @return
 */
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED)
public ReleaseNfo determineReleaseNfo(Release release) {
    Pattern nfoPattern = Pattern.compile(".*\\.nfo[ \"\\)\\]\\-]?.*", Pattern.CASE_INSENSITIVE);

    List<Binary> binaryList = binaryDAO.findBinariesByReleaseId(release.getId());
    for (Binary binary : binaryList) {
        Matcher matcher = nfoPattern.matcher(binary.getName());
        if (matcher.matches()) {
            ReleaseNfo releaseNfo = new ReleaseNfo();
            releaseNfo.setBinary(binary);
            releaseNfo.setRelease(release);

            return releaseNfo;
        }
    }

    return null;
}