@Override public String getTaxonomyByURI(final String taxonomyURI, final boolean resolveContent) throws ItemNotFoundException, SerializationException { throw new NotImplementedException(); }
@Override public <T> T deserialize(final String content, final Class<T> aClass) throws SerializationException { try { return MAPPER.readValue(content, aClass); } catch (IOException e) { LOG.error("Error deserializing.", e); throw new SerializationException(e); } }
/** * @param url string representing the path portion of the URL of the binary * @param publication int representing the publication id * @return BinaryMeta the binary identified by url and publication * @throws ItemNotFoundException if the item identified by url and publication was not found */ public BinaryMeta getBinaryMetaByURL(String url, int publication) throws ItemNotFoundException { final BinaryMeta binaryMeta = WEB_BINARY_META_FACTORY.getMetaByURL(publication, url); if (binaryMeta == null) { throw new ItemNotFoundException("Unable to find binary by url '" + url + "' and publication '" + publication + "'."); } return binaryMeta; }
/** * 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); } }
/** * Method to check whether a page exists in the Tridion Broker. * * @param url the Url to check * @param publicationId the publication Id * @return boolean indicating the page is present */ @Override public Boolean isPagePublished(String url, int publicationId) { LOG.debug("Enter isPagePublished with url: {} and publicationId: {}", url, publicationId); try { return pageProvider.checkPageExists(url, publicationId); } catch (ItemNotFoundException | SerializationException e) { LOG.error(e.getLocalizedMessage(), e); } return false; }
private void executePostCacheProcessors(final Page page, RequestContext context) { if (page != null) { LOG.debug("Running Post caching Processors"); try { this.executeProcessors(page, RunPhase.AFTER_CACHING, context); } catch (ProcessorException e) { LOG.error(e.getLocalizedMessage(), e); } } }
/** * Retrieves metadata 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 PageMeta representing the metadata of the Page * @throws ItemNotFoundException if the requested page does not exist */ public PageMeta getPageMetaById(int id, int publication) throws ItemNotFoundException { final WebPageMetaFactory webPageMetaFactory = getWebPageMetaFactory(publication); final PageMeta pageMeta = webPageMetaFactory.getMeta(id); if (pageMeta == null) { throw new ItemNotFoundException("Unable to find page by id '" + id + "' and publication '" + publication + "'."); } return pageMeta; }
@Override public String serialize(final Object item) throws SerializationException { try { LOG.debug("Serializing a {}", item.getClass()); return MAPPER.writeValueAsString(item); } catch (JsonProcessingException e) { LOG.error("Error serializing.", e); throw new SerializationException(e); } } }
@Override public String getTaxonomyFilterBySchema(final String taxonomyURI, final String schemaURI) throws ItemNotFoundException, SerializationException { throw new NotImplementedException(); } }
/** * Retrieves metadata of a Page by looking the page up by its URL. * * @param url String representing the path part of the page URL * @param publication int representing the Publication id of the page * @return PageMeta representing the metadata of the Page * @throws ItemNotFoundException if the requested page does not exist */ public PageMeta getPageMetaByURL(String url, int publication) throws ItemNotFoundException { final WebPageMetaFactory webPageMetaFactory = getWebPageMetaFactory(publication); final PageMeta pageMeta = webPageMetaFactory.getMetaByURL(publication, url); if (pageMeta == null) { throw new ItemNotFoundException("Unable to find page by url '" + url + "' and publication '" + publication + "'."); } return pageMeta; }
@Override public <T extends Page> T getPage(final String uri, final Class<T> pageModel) throws FactoryException { if (!pageModel.getClass().isInstance(Page.class)) { throw new SerializationException("Given model class does not implement the Page interface"); } return getPage(uri, null, pageModel); }
@Override public String getTaxonomyByURI(final String taxonomyURI, final boolean resolveContent) throws ItemNotFoundException, SerializationException { throw new NotImplementedException(); }
public BinaryMeta getBinaryMetaByTcmUri(TCMURI binaryUri) throws ItemNotFoundException { BinaryMeta binaryMeta = WEB_BINARY_META_FACTORY.getMeta(binaryUri.toString()); if (binaryMeta == null) { throw new ItemNotFoundException("Unable to find binary by TCMURI '" + binaryUri.toString()); } return binaryMeta; }
/** * Deserializes a JSON encoded String into an object of the given type, which must * derive from the Page interface * * @param source String representing the JSON encoded object * @param clazz Class representing the implementation type to deserialize into * @return the deserialized object */ @Override public <T extends Page> T deserialize(final String source, final Class<? extends T> clazz) throws FactoryException { DataBinder binder = selectDataBinder(source); if (binder == null) { throw new SerializationException("Unable to select databinder."); } return binder.buildPage(source, clazz); }
@Override public String getTaxonomyFilterBySchema(final String taxonomyURI, final String schemaURI) throws ItemNotFoundException, SerializationException { throw new NotImplementedException(); } }
@Override public TCMURI getPageIdForUrl(final String url, final int publicationId) throws ItemNotFoundException, SerializationException { final PageMeta pageMeta = getPageMetaByURL(url, publicationId); if (pageMeta != null) { return new TCMURI(publicationId, pageMeta.getId(), pageMeta.getType(), pageMeta.getMajorVersion()); } throw new ItemNotFoundException("Page Id for URL not found."); }
/** * Returns a list of RelatedKeyword objects representing the usage of each Keyword under the given taxonomy URI * and its direct using item. Returned items are only Components based on the given Schema URI. * * @param taxonomyURI String representing the root taxonomy Keyword TCMURI * @param schemaURI String representing the filter for classified related Components to return for each Keyword * @return List a list of RelatedKeyword objects holding item usage information * @throws ParseException if the given Keyword URI does not represent a valid TCMURI * @throws StorageException if something went wrong during accessing the CD DB */ public List<RelatedKeyword> getRelatedComponentsBySchema(String taxonomyURI, String schemaURI) throws ParseException, StorageException { throw new NotImplementedException(); }
@Override public TCMURI getPageIdForUrl(final String url, final int publicationId) throws ItemNotFoundException, SerializationException { PageMeta pageMeta = getPageMetaByURL(url, publicationId); if (pageMeta != null) { return new TCMURI(publicationId, pageMeta.getItemId(), pageMeta.getItemType(), pageMeta.getMajorVersion()); } throw new ItemNotFoundException("Page Id for URL not found."); }
/** * Returns a list of RelatedKeyword objects representing the usage of each Keyword under the given taxonomy URI * and its direct using item. Returned items are only of the given type. * * @param taxonomyURI String representing the root taxonomy Keyword TCMURI * @param itemType int representing the item type id to retrieve * @return List a list of RelatedKeyword objects holding item usage information * @throws ParseException if the given Keyword URI does not represent a valid TCMURI * @throws StorageException if something went wrong during accessing the CD DB */ public List<RelatedKeyword> getRelatedItems(String taxonomyURI, int itemType) throws ParseException, StorageException { throw new NotImplementedException(); }