I'm using Tridion 2013 SP1, and I'm wondering how to extend a page metadata in a deployer extension. I need to extract the existing one and add new ones.
BTW, As a best practice, Should I do it at Processor level or Module level?
Thanks in advance.
UPDATE
So far, I'm trying to do it extending PageDeploy module like this:
public class PageMedatadaAggregatorModule extends com.tridion.deployer.modules.PageDeploy {
private static TLogger logger = TLogger.getLogger(PageMedatadaAggregatorModule.class);
public PageMedatadaAggregatorModule(Configuration config, Processor processor)
throws ConfigurationException {
super(config, processor);
}
@Override
public void processPage(Page page, File pageFile) throws ProcessingException {
logger.info("processPage: <<< Starting processing Page.");
Document pageDocument = null;
if (pageFile.exists() {
pageDocument = Utils.getDocument(pageFile);
}
if (pageDocument != null) {
addMetadata(page, pageDocument);
}
logger.info("processPage: <<< Finished processing Page.");
super.processPage(page, pageFile);
}
/**
* Adds new metadata to the page.
*
* @param Page
* Page metadata.
* @param File
* Page file.
*
* @exception ProcessingException.
*/
private void addMetadata(Page page, Document pageDocument) {
// Add metadata to the page
// Which of the following methods should I use? Any example?
CustomMetaData customMetaData = new CustomMetaData();
page.setRenderAddedMetaData(renderAddedMetaData);
page.setRawCustomMeta(rawCustomMeta);
page.setCustomMetaData(customMetaData);
}
}
I don't find examples nor documentation regarding the following methods, Which of the following methods should I use? Any example?
page.setRenderAddedMetaData(renderAddedMetaData);
page.setRawCustomMeta(rawCustomMeta);
page.setCustomMetaData(customMetaData);