@Override public Session findSessionById(long id, ServiceFactory sf) { final LocalQuery iQuery = (LocalQuery) sf.getQueryService(); final String sessionClass = iQuery.find(Share.class, id) == null ? "Session" : "Share"; return (Session) iQuery.findByQuery( "select s from " + sessionClass + " s " + "left outer join fetch s.sudoer " + "left outer join fetch s.annotationLinks l " + "left outer join fetch l.child a where s.id = :id", new Parameters().addId(id).cache()); }
@RolesAllowed("user") @Transactional(readOnly = false) public void setDescription(long shareId, String description) { Share share = (Share) iQuery.find(Share.class, shareId); ShareData data = store.get(shareId); share.setMessage(description); storeShareData(shareId, data); }
@RolesAllowed("user") @Transactional(readOnly = false) public void setExpiration(long shareId, Timestamp expiration) { Share share = (Share) iQuery.find(Share.class, shareId); ShareData data = store.get(shareId); share.setTimeToLive(expirationAsLong(share.getStarted().getTime(), expiration)); storeShareData(shareId, data); }
final Share share = iQuery.find(Share.class, shareId); // Reload! this.sec.doAction(new SecureShare() { @Override