/** * Retrieves content of a Page by looking the page up by its item id and Publication id. * * @param id int representing the page item id * @param publication int representing the Publication id of the page * @return String representing the content of the Page * @throws ItemNotFoundException if the requested page does not exist */ @Override public String getPageContentById(int id, int publication) throws ItemNotFoundException, SerializationException { final CharacterData data = PAGE_CONTENT_RETRIEVER.getPageContent(publication, id); if (data == null) { throw new ItemNotFoundException("Unable to find page by id '" + id + "' and publication '" + publication + "'."); } try { return decodeAndDecompressContent(convertStreamToString(data.getInputStream())); } catch (IOException e) { throw new SerializationException(e); } }
/** * Retrieves content of a Page by looking the page up by its item id and Publication id. * * @param id int representing the page item id * @param publication int representing the Publication id of the page * @return String representing the content of the Page * @throws ItemNotFoundException if the requested page does not exist */ @Override public String getPageContentById(int id, int publication) throws ItemNotFoundException, SerializationException { CharacterData data = null; try { PageDAO pageDAO = (PageDAO) StorageManagerFactory.getDAO(publication, StorageTypeMapping.PAGE); data = pageDAO.findByPrimaryKey(publication, id); } catch (StorageException e) { LOG.error(e.getMessage(), e); } if (data == null) { throw new ItemNotFoundException("Unable to find page by id '" + id + "' and publication '" + publication + "'."); } try { return decodeAndDecompressContent(convertStreamToString(data.getInputStream())); } catch (IOException e) { throw new SerializationException(e); } }