/** * @param uri of the page * @return the Page Object * @throws org.dd4t.core.exceptions.FactoryException */ @Override public Page getPage(String uri) throws FactoryException { return getPage(uri, null, PageImpl.class); }
@Override public ComponentPresentation getComponentPresentation(String componentURI, RequestContext context) throws FactoryException { return getComponentPresentation(componentURI, null, context); } }
/** * @param url the url of the page * @param publicationId the publication Id * @return a GenericPage object * @throws org.dd4t.core.exceptions.FactoryException */ @Override public Page findPageByUrl(String url, int publicationId) throws FactoryException { return findPageByUrl(url, publicationId, null, PageImpl.class); }
/** * <p>componentPresentationFactory.</p> * * @return a {@link org.dd4t.core.factories.ComponentPresentationFactory} object. */ @Bean public ComponentPresentationFactory componentPresentationFactory() { ComponentPresentationFactoryImpl presentationFactory = ComponentPresentationFactoryImpl.getInstance(); presentationFactory.setComponentPresentationProvider(componentPresentationProvider()); presentationFactory.setCacheProvider(cacheProvider); return presentationFactory; }
page = producePage(resultItem, context, PageImpl.class); page = cacheElement.getPayload(); executePostCacheProcessors(page, context); return (T) page;
/** * Runs all the processors on an item. If cachingAllowed is true it will * only run the processors where the result is allowed to be cached. * * @param item The DD4T Item * @throws org.dd4t.core.exceptions.ProcessorException */ public void executeProcessors(Item item, RunPhase runPhase, RequestContext context) throws ProcessorException { if (item != null) { for (Processor processor : getProcessors()) { if (runPhase == processor.getRunPhase() || processor.getRunPhase() == RunPhase.BOTH) { this.execute(processor, item, context); } } } }
private <T extends Page> T producePage(PageProviderResultItem<String> resultItem, RequestContext context, Class<T> pageClass) throws FactoryException { String pageSource = resultItem.getSourceContent(); Page page = deserialize(pageSource, pageClass); page.setLastPublishedDate(resultItem.getLastPublishDate()); page.setRevisionDate(resultItem.getRevisionDate()); page.setUrl(resultItem.getUrl()); LOG.debug("Running pre caching processors"); this.executeProcessors(page, RunPhase.BEFORE_CACHING, context); return (T) page; }
taxonomy = deserialize(taxonomySource, KeywordImpl.class); cacheElement.setPayload(taxonomy);
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); } } }
/** * 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); }
LOG.debug("Enter getBinaryByURL with url: {} and publicationId: {}", url, publicationId); String key = getCacheKey(url, publicationId); CacheElement<Binary> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Binary binary;
@Override public ComponentPresentation getComponentPresentation(String componentURI, String viewOrTemplateURI) throws FactoryException { return getComponentPresentation(componentURI, viewOrTemplateURI, null); }
@Override public Page findPageByUrl(final String url, final int publicationId, final RequestContext context) throws FactoryException { return findPageByUrl(url, publicationId, context, PageImpl.class); }
page = producePage(resultItem, context, PageImpl.class); executePostCacheProcessors(page, context); return (T) page;
@Override public Page getPage(String uri, RequestContext context) throws FactoryException { return getPage(uri, context, PageImpl.class); }
taxonomy = deserialize(taxonomySource, KeywordImpl.class); cacheElement.setPayload(taxonomy);
@Override public ComponentPresentation getComponentPresentation(String componentURI) throws FactoryException { return getComponentPresentation(componentURI, null, null); }
@Override public <T extends Page> T findPageByUrl(final String url, final int publicationId, final Class<T> pageModel) throws FactoryException { return findPageByUrl(url, publicationId, null, pageModel); }
@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); }
componentPresentation = componentPresentationFactory.getComponentPresentation(new TCMURI(ctUri .getPublicationId(), componentId, 16, 0).toString(), componentPresentation .getComponentTemplate().getId());