We are upgrading from SDL Tridion 2013 to Web 8.5 and have had to make several changes to our custom deployer for PageDeploy/Undeploy and ComponentDeploy/Undeploy.
At this point we have all 3 of 4 pipeline steps working. When reading component custom meta values within the page deploy step, if the component has never been published and the following code executes and compMeta is null. If we publish the page a second time the custom meta information is available.
Iterator iterator = page.getComponentPresentationKeys();
while(iterator.hasNext())
{
ComponentPresentationKey key = (ComponentPresentationKey)iterator.next();
ItemDAO itemDAO = null;
try {
itemDAO = ((ItemDAO)
StorageManagerFactory.getDAO(
key.getComponentId().getPublicationId(),
StorageTypeMapping.COMPONENT_META));
} catch (StorageException ex) {
log.error("Failed to get ItemDAO: ", ex);
}
if (itemDAO != null) {
com.tridion.meta.ComponentMeta compMeta = null;
try {
compMeta = (com.tridion.meta.ComponentMeta)
MapperFactory.mapItemMetaInstance(
itemDAO.findByPrimaryKey(
key.getComponentId().getPublicationId(),
key.getComponentId().getItemId(),
ItemTypeSelector.COMPONENT));
} catch (StorageException ex) {
log.error("Failed to get ComponentMeta: ", ex);
}
Is there another way to read the component custom meta data within the page deploy step? I tried moving the ComponentDeploy and CustomComponentDeploy steps ahead of the PageDeploy steps. To read the data in the ComponentDeploy step we used component.getCustomMeta() then parsed the xml.