public InputStream getInputStream() throws IOException { InputStream fs = null; try { fs = fileStoreService.getFileInStream(fsid); } catch (Exception e) { throw new IOException(e.getMessage(), e); } return fs; }
/** * For the articleDOI, get the article XML datasource * * @param articleDoi the articleInfo object * @return the article XML * @throws ApplicationException * @throws NoSuchArticleIdException */ private DataSource getArticleXML(final String articleDoi) throws NoSuchArticleIdException { String fsid = fileStoreService.objectIDMapper().doiTofsid(articleDoi, "XML"); if (fsid == null) throw new NoSuchArticleIdException(articleDoi); List assets = hibernateTemplate.findByCriteria( DetachedCriteria.forClass(ArticleAsset.class) .add(Restrictions.eq("doi", articleDoi)) .add(Restrictions.eq("extension", "XML"))); if (assets.size() == 0) throw new NoSuchArticleIdException(articleDoi); return new ByteArrayDataSource(fileStoreService, fsid, (ArticleAsset) assets.get(0)); }