List of usage examples for javax.ejb TransactionAttributeType SUPPORTS
TransactionAttributeType SUPPORTS
To view the source code for javax.ejb TransactionAttributeType SUPPORTS.
Click Source Link
REQUIRED
case. From source file:com.flexive.ejb.beans.AccountEngineBean.java
/** * {@inheritDoc}//from w w w . j av a 2 s.c o m */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public Account load(final long id) throws FxApplicationException { return load(null, id, null); }
From source file:com.flexive.ejb.beans.ScriptingEngineBean.java
/** * {@inheritDoc}/* w w w.j a v a 2 s. c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public String loadScriptCode(long scriptId) throws FxApplicationException { Connection con = null; PreparedStatement ps = null; String sql; String code; try { // Obtain a database connection con = Database.getDbConnection(); // 1 sql = "SELECT SDATA FROM " + TBL_SCRIPTS + " WHERE ID=?"; ps = con.prepareStatement(sql); ps.setLong(1, scriptId); ResultSet rs = ps.executeQuery(); if (rs == null || !rs.next()) throw new FxNotFoundException("ex.scripting.notFound.id", scriptId); code = rs.getString(1); } catch (SQLException exc) { EJBUtils.rollback(ctx); throw new FxLoadException(LOG, exc, "ex.scripting.load.failed", scriptId, exc.getMessage()); } finally { Database.closeObjects(ScriptingEngineBean.class, con, ps); } return code; }
From source file:com.flexive.ejb.beans.AccountEngineBean.java
/** * {@inheritDoc}/*from w w w .j av a 2 s . c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public Account load(final String loginName) throws FxApplicationException { return load(loginName, null, null); }
From source file:gov.nih.nci.caarray.application.translation.geosoft.GeoSoftExporterBean.java
/** * {@inheritDoc}//from w ww .j a va 2s .c om */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public void export(Project project, String permaLinkUrl, PackagingInfo.PackagingMethod method, OutputStream out) throws IOException { final OutputStream closeShield = new CloseShieldOutputStream(out); final Experiment experiment = project.getExperiment(); boolean addReadMe = false; if (method == PackagingInfo.PackagingMethod.TGZ) { addReadMe = true; } else { ensureZippable(project); } final ArchiveOutputStream arOut = method.createArchiveOutputStream(closeShield); try { exportArchive(experiment, permaLinkUrl, addReadMe, arOut); } finally { // note that the caller's stream is shielded from the close(), // but this is the only way to finish and flush the (gzip) stream. IOUtils.closeQuietly(arOut); } }
From source file:com.flexive.ejb.beans.AccountEngineBean.java
/** * {@inheritDoc}//from ww w . j a v a 2s.co m */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public Account loadForContactData(FxPK contactDataPK) throws FxApplicationException { return load(null, null, contactDataPK.getId()); }
From source file:com.flexive.ejb.beans.AccountEngineBean.java
/** * {@inheritDoc}//from ww w. jav a 2 s .c om */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public String getPasswordHash(long accountId) throws FxApplicationException { if (!FxContext.getUserTicket().isGlobalSupervisor()) { throw new FxNoAccessException("ex.structure.noAccess.needSupervisor"); } Connection con = null; PreparedStatement stmt = null; try { con = Database.getDbConnection(); stmt = con.prepareStatement("SELECT password FROM " + TBL_ACCOUNTS + " WHERE id=?"); stmt.setLong(1, accountId); final ResultSet rs = stmt.executeQuery(); if (rs.next()) { return rs.getString(1); } else { throw new FxNotFoundException("ex.account.notFound", accountId); } } catch (SQLException e) { throw new FxLoadException(LOG, e); } finally { Database.closeObjects(AccountEngineBean.class, con, stmt); } }
From source file:com.flexive.ejb.beans.ScriptingEngineBean.java
/** * {@inheritDoc}// w w w. j ava2s .c o m */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public List<FxScriptInfo> getScriptInfos() throws FxApplicationException { Connection con = null; PreparedStatement ps = null; String sql; ArrayList<FxScriptInfo> slist = new ArrayList<FxScriptInfo>(); try { // Obtain a database connection con = Database.getDbConnection(); // 1 2 3 4 5 6 sql = "SELECT ID, SNAME,SDESC,STYPE,ACTIVE, IS_CACHED FROM " + TBL_SCRIPTS + " ORDER BY ID"; ps = con.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs != null && rs.next()) { slist.add(new FxScriptInfo(rs.getInt(1), FxScriptEvent.getById(rs.getLong(4)), rs.getString(2), rs.getString(3), rs.getBoolean(5), rs.getBoolean(6))); } } catch (SQLException exc) { EJBUtils.rollback(ctx); throw new FxLoadException(LOG, exc, "ex.scripts.load.failed", exc.getMessage()); } finally { Database.closeObjects(ScriptingEngineBean.class, con, ps); } return slist; }
From source file:com.flexive.ejb.beans.ContentEngineBean.java
/** * {@inheritDoc}//from www. j av a2s .com */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public FxContentContainer loadContainer(long id) throws FxApplicationException { FxContentVersionInfo vi = getContentVersionInfo(new FxPK(id)); List<FxContent> contents = new ArrayList<FxContent>(vi.getVersionCount()); for (int ver : vi.getVersions()) contents.add(load(new FxPK(id, ver))); return new FxContentContainer(vi, contents); }
From source file:fr.ortolang.diffusion.store.binary.BinaryStoreServiceBean.java
@Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public void check(String identifier) throws BinaryStoreServiceException, DataNotFoundException, DataCorruptedException { Path path = getPathForIdentifier(identifier); if (!Files.exists(path)) { throw new DataNotFoundException("Unable to find an object with id [" + identifier + "] in the storage"); }// w w w. ja v a2 s.c om String check; try (InputStream input = Files.newInputStream(path)) { check = generate(input); } catch (IOException e) { throw new BinaryStoreServiceException(e); } if (!check.equals(identifier)) { throw new DataCorruptedException("The object with id [" + identifier + "] is CORRUPTED. The stored object's content has generate a wrong identifier [" + check + "]"); } }
From source file:com.flexive.ejb.beans.AccountEngineBean.java
/** * {@inheritDoc} */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public UserTicket getUserTicket() { return UserTicketStore.getTicket(); }