List of usage examples for org.springframework.transaction.annotation Propagation MANDATORY
Propagation MANDATORY
To view the source code for org.springframework.transaction.annotation Propagation MANDATORY.
Click Source Link
From source file:com.epam.catgenome.dao.DaoHelper.java
/** * Returns the next {@code Long} ID for a new temporary list. * * @return {@code Long}// w w w . j a v a 2s.c om */ @Transactional(propagation = Propagation.MANDATORY) public Long createListId() { return createId(listIdSequenceName); }
From source file:com.epam.catgenome.dao.BiologicalDataItemDao.java
/** * Persists a BiologicalDataItem instance into the database * @param item BiologicalDataItem to persist *//*w ww .ja va 2s . co m*/ @Transactional(propagation = Propagation.MANDATORY) public void createBiologicalDataItem(BiologicalDataItem item) { if (!item.getFormat().isIndex() || (item.getFormat().isIndex() && !StringUtils.isEmpty(item.getName()))) { Assert.isTrue(!StringUtils.isEmpty(item.getName()), "File name is required for registration."); List<BiologicalDataItem> items = loadFilesByNameStrict(item.getName()); Assert.isTrue(items.isEmpty(), MessageHelper.getMessage(MessagesConstants.ERROR_FILE_NAME_EXISTS, item.getName())); item.setId(daoHelper.createId(biologicalDataItemSequenceName)); } else { item.setId(daoHelper.createId(biologicalDataItemSequenceName)); item.setName("INDEX " + item.getId()); } final MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue(BiologicalDataItemParameters.BIO_DATA_ITEM_ID.name(), item.getId()); params.addValue(BiologicalDataItemParameters.NAME.name(), item.getName()); params.addValue(BiologicalDataItemParameters.TYPE.name(), item.getType().getId()); params.addValue(BiologicalDataItemParameters.PATH.name(), item.getPath()); params.addValue(BiologicalDataItemParameters.FORMAT.name(), item.getFormat().getId()); params.addValue(BiologicalDataItemParameters.CREATED_DATE.name(), item.getCreatedDate()); params.addValue(BiologicalDataItemParameters.CREATED_BY.name(), item.getCreatedBy()); params.addValue(BiologicalDataItemParameters.BUCKET_ID.name(), item.getBucketId()); params.addValue(BiologicalDataItemParameters.PRETTY_NAME.name(), item.getPrettyName()); getNamedParameterJdbcTemplate().update(insertBiologicalDataItemQuery, params); }
From source file:com.jaspersoft.jasperserver.api.metadata.data.snapshot.hibernate.HibernateDataSnapshotContentsService.java
@Transactional(propagation = Propagation.MANDATORY, readOnly = true) public DataContainer loadDataSnapshotData(ExecutionContext context, final long id) { return getHibernateTemplate().execute(new HibernateCallback<DataContainer>() { public DataContainer doInHibernate(Session session) throws HibernateException, SQLException { if (log.isDebugEnabled()) { log.debug("loading snapshot data " + id); }// w w w . ja va 2s.com Blob dataBlob = loadSnapshotDataBlob(id, session); if (dataBlob == null) { return null; } FileBufferedDataContainer dataContainer; InputStream dataStream = dataBlob.getBinaryStream(); try { dataContainer = new FileBufferedDataContainer(); OutputStream dataOut = dataContainer.getOutputStream(); try { DataContainerStreamUtil.pipeData(dataStream, dataOut); } finally { dataOut.close();// fail on close exception } } catch (IOException e) { throw new JSExceptionWrapper("Failed to read data snapshot", e); } finally { try { dataStream.close(); } catch (IOException e) { log.warn("Failed to close blob stream for data snapshot " + id, e); } } return dataContainer; } }); }
From source file:cz.zcu.kiv.eegdatabase.logic.indexing.IndexingServiceImpl.java
/** * Does indexing of all LinkedIn posts.//from www . j a v a2 s. com * @throws IllegalAccessException * @throws SolrServerException * @throws IOException */ @Async @Transactional(propagation = Propagation.MANDATORY) public void indexLinkedIn() throws IllegalAccessException, SolrServerException, IOException { int startIndex = 0; List<Post> posts = new ArrayList<Post>(); List<Post> receivedPosts = linkedin.getGroupPostsWithMoreInfo(LINKEDIN_POSTS_STEP, startIndex); // additional iterations are necessary due to the limit of 50 returned posts at maximum (LinkedIn API restriciton) while (receivedPosts != null) { posts.addAll(receivedPosts); startIndex += LINKEDIN_POSTS_STEP; receivedPosts = linkedin.getGroupPostsWithMoreInfo(LINKEDIN_POSTS_STEP, startIndex); } linkedInIndexer.indexAll(posts); }
From source file:com.epam.catgenome.dao.vcf.VcfFileDao.java
/** * Deletes {@code VcfFile} metadata from database and corresponding vcf samples. * * @param vcfFileId id of file to remove *///w w w . java2s.c o m @Transactional(propagation = Propagation.MANDATORY) public void deleteVcfFile(final Long vcfFileId) { getJdbcTemplate().update(deleteVcfSampleQuery, vcfFileId); getJdbcTemplate().update(deleteVcfFileQuery, vcfFileId); }
From source file:net.dontdrinkandroot.persistence.dao.GenericJpaDao.java
@Override @Transactional(propagation = Propagation.MANDATORY, readOnly = true) public <E extends Entity<K>, K> long getCount(final Class<E> clazz) { final CriteriaBuilder builder = this.getCriteriaBuilder(); final CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class); final Root<E> from = criteriaQuery.from(clazz); final Expression<Long> count = builder.count(from); criteriaQuery.select(count);/*from w w w .j a va2 s . c o m*/ return this.findSingle(criteriaQuery).longValue(); }
From source file:net.dontdrinkandroot.persistence.dao.TypedJpaDao.java
@Override @Transactional(propagation = Propagation.MANDATORY, readOnly = true) public List<E> findAll(final PredicateBuilder<E> filter) { final CriteriaBuilder builder = this.getCriteriaBuilder(); final CriteriaQuery<E> criteriaQuery = builder.createQuery(this.entityClass); final Root<E> from = criteriaQuery.from(this.entityClass); criteriaQuery.where(filter.createPredicate(builder, from)); return this.find(criteriaQuery); }
From source file:ru.org.linux.user.UserLogDao.java
@Transactional(rollbackFor = Exception.class, propagation = Propagation.MANDATORY) public void logUnblockUser(@Nonnull User user, @Nonnull User moderator) { jdbcTemplate.update(/*from ww w .j a v a2 s .c o m*/ "INSERT INTO user_log (userid, action_userid, action_date, action, info) VALUES (?,?,CURRENT_TIMESTAMP, ?::user_log_action, ?)", user.getId(), moderator.getId(), UserLogAction.UNBLOCK_USER.toString(), ImmutableMap.of()); }
From source file:com.epam.catgenome.dao.vcf.VcfFileDao.java
/** * Loads a persisted {@code VcfFile} record by it's ID * * @param id {@code long} a VcfFile ID//from w w w . j a va 2s. c o m * @return {@code VcfFile} instance */ @Transactional(propagation = Propagation.MANDATORY) public VcfFile loadVcfFile(long id) { List<BiologicalDataItem> files = getJdbcTemplate().query(loadVcfFileQuery, BiologicalDataItemDao.BiologicalDataItemParameters.getRowMapper(), id); return !files.isEmpty() ? (VcfFile) files.get(0) : null; }
From source file:ru.org.linux.user.UserLogDao.java
@Transactional(rollbackFor = Exception.class, propagation = Propagation.MANDATORY) public void logAcceptNewEmail(@Nonnull User user, @Nonnull String newEmail) { ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder(); builder.put(OPTION_NEW_EMAIL, newEmail); if (user.getEmail() != null) { builder.put(OPTION_OLD_EMAIL, user.getEmail()); }// ww w . j a v a 2 s . co m jdbcTemplate.update( "INSERT INTO user_log (userid, action_userid, action_date, action, info) VALUES (?,?,CURRENT_TIMESTAMP, ?::user_log_action, ?)", user.getId(), user.getId(), UserLogAction.ACCEPT_NEW_EMAIL.toString(), builder.build()); }