/** * Retrieves content of a Dynamic Component Presentation by looking up its componentId and publicationId. * A templateId is not provided, so the DCP with the highest linking priority is retrieved. * <p/> * <b>Note: This method performs significantly slower than getDynamicComponentPresentation(int, int, int)! * Do provide a templateId!</b> * * @param componentId int representing the Component item id * @param publicationId int representing the Publication id of the DCP * @return String representing the content of the DCP * @throws ItemNotFoundException if the requested DCP cannot be found */ @Override public String getDynamicComponentPresentation(int componentId, int publicationId) throws ItemNotFoundException, SerializationException { return getDynamicComponentPresentation(componentId, 0, publicationId); }
@Override public ComponentPresentationResultItem<String> getDynamicComponentPresentationItem(int componentId, int publicationId) throws ItemNotFoundException, SerializationException { return getDynamicComponentPresentationItem(componentId, 0, publicationId); }
@Override public ComponentPresentationResultItem<String> getDynamicComponentPresentationItem(int componentId, int templateId, int publicationId) throws ItemNotFoundException, SerializationException { ComponentPresentation result = getComponentPresentation(componentId, templateId, publicationId); String resultString; ComponentPresentationResultItemImpl resultModel; if (result != null) { resultModel = new ComponentPresentationResultItemImpl(result.getPublicationId(), result.getComponentId(), result.getComponentTemplateId()); assertQueryResultNotNull(result, componentId, templateId, publicationId); resultString = result.getContent(); if (!StringUtils.isEmpty(resultString)) { resultModel.setContentSource(decodeAndDecompressContent(resultString)); } else { resultModel.setContentSource(resultString); } } else { resultModel = new ComponentPresentationResultItemImpl(0, 0, 0); } return resultModel; }
result.getComponentTemplateId()); assertQueryResultNotNull(result, componentId, templateId, publicationId); resultString = result.getContent(); resultmodel.setContentSource(decodeAndDecompressContent(resultString)); } else { resultmodel.setContentSource(resultString);
/** * Retrieves content of a Dynamic Component Presentation by looking up its componentId, templateId and * publicationId. * * @param componentId int representing the Component item id * @param templateId int representing the Component Template item id * @param publicationId int representing the Publication id of the DCP * @return String representing the content of the DCP * @throws ItemNotFoundException if the requested DCP cannot be found */ @Override public String getDynamicComponentPresentation(int componentId, int templateId, int publicationId) throws ItemNotFoundException, SerializationException { ComponentPresentation result; result = getComponentPresentation(componentId, templateId, publicationId); final String resultString; resultString = result.getContent(); if (!StringUtils.isEmpty(resultString)) { return decodeAndDecompressContent(resultString); } return null; }
protected ComponentPresentation getComponentPresentation(final int componentId, final int templateId, final int publicationId) throws ItemNotFoundException { WebComponentPresentationFactory factory = FACTORY_CACHE.get(publicationId); if (factory == null) { factory = new WebComponentPresentationFactoryImpl(publicationId); FACTORY_CACHE.put(publicationId, factory); } final ComponentPresentation result; if (templateId != 0) { result = factory.getComponentPresentation(componentId, templateId); } else { result = factory.getComponentPresentationWithHighestPriority(componentId); } assertQueryResultNotNull(result, componentId, templateId, publicationId); return result; } }
@Override public ComponentPresentationResultItem<String> getDynamicComponentPresentationItem(int componentId, int publicationId) throws ItemNotFoundException, SerializationException { return getDynamicComponentPresentationItem(componentId, 0, publicationId); }
/** * Retrieves content of a Dynamic Component Presentation by looking up its componentId and publicationId. * A templateId is not provided, so the DCP with the highest linking priority is retrieved. * <p/> * <b>Note: This method performs significantly slower than getDynamicComponentPresentation(int, int, int)! * Do provide a templateId!</b> * * @param componentId int representing the Component item id * @param publicationId int representing the Publication id of the DCP * @return String representing the content of the DCP * @throws ItemNotFoundException if the requested DCP cannot be found */ @Override public String getDynamicComponentPresentation(int componentId, int publicationId) throws ItemNotFoundException, SerializationException { return getDynamicComponentPresentation(componentId, 0, publicationId); }
/** * Retrieves content of a Dynamic Component Presentation by looking up its componentId, templateId and * publicationId. * * @param componentId int representing the Component item id * @param templateId int representing the Component Template item id * @param publicationId int representing the Publication id of the DCP * @return String representing the content of the DCP * @throws ItemNotFoundException if the requested DCP cannot be found */ @Override public String getDynamicComponentPresentation(int componentId, int templateId, int publicationId) throws ItemNotFoundException, SerializationException { return getDynamicComponentPresentationItem(componentId, templateId, publicationId).getSourceContent(); }