List of usage examples for org.springframework.transaction.interceptor DefaultTransactionAttribute setReadOnly
public final void setReadOnly(boolean readOnly)
From source file:ome.services.sharing.ShareRestrictionTransactionAttributeSource.java
public TransactionAttribute getTransactionAttribute(Method method, Class targetClass) { try {// w ww. j a v a 2 s.com Principal principal = current.getLast(); String uuid = principal.getName(); EventContext ec = cache.getSessionContext(uuid); Long shareId = ec.getCurrentShareId(); if (ec.getCurrentShareId() != null) { log.debug("Returning readOnly tx for shared " + shareId); DefaultTransactionAttribute ta = new DefaultTransactionAttribute(); ta.setReadOnly(true); return ta; } } catch (SessionException se) { // No worries. It's not our job to enforce anything. return null; } catch (NoSuchElementException nse) { // No one is logged in so there can't be a share active! return null; } return null; }