I'm currently working on a event handler, which. This will, on a save-event, save the latest revision date of the page and it'sits components into a custom database, and this. It is working, but i'mI'm facing some performance issues.
Let me give you an example, for of how it's workingit works:
If a component is saved/updated (changes are made), then I want to update all pages using this component in my custom database.
Basic blueprint setup: 200 contains components 400
400 translation publication for components (inherent components from 200) 500
500 master publication for pages 600
600 local site publication inherent components from 400 and pages from 500)
So lets say we have component X, "X", in 200, this. This component is included in in a page in 500, X is and localized in 400 (let us call it X(l)) and the. The page in 600 is NOT localized ( i.e it will use the component xX(l) instead of X)
So now to my question: In my save event handler, iI check what pages X(l) are included in , by using :
var filter = new UsingItemsFilter(component.Session)
{
IncludeLocalCopies = true,
ItemTypes = new[] { ItemType.Page }
};
butBut this will only give me references to pages from 500. So what i then doI (which feels kind of stupid) is todo the following: create a tcm idTCM ID of all pages in child publications(by looping over them) that inherent this page (now imI'm using some psuedocodelikepsuedocode-like coding):
foreach(var 500page in foundPages)
foreach(var publication in publications){
if(subject.Session.IsExistingObject(
new TcmUri(page.Id.ItemId,page.Id.ItemType,publication.Id.ItemId)
))
{
someListThatWillContainAllChildPagesFrom500.Add(TheAboveTcmUri);
}
}
And then for each page, check the components in that page, and finally save this state to my custom database.
So the question is,: is there a way by to query for all pages, that make use of the localized component, by using the TOM.NET apiAPI (no not CoreServiceClient)?
Is there a better way to find child publications of a publication, so I only need to check for pages in the childPublication?
And yes, iI have tried the :
if (pub.HasChildren)
{
var childs = pub.GetUsingItems(new UsingItemsFilter(subject.Session) {
ItemTypes=new []{ItemType.Publication}
});
which only throws : not implemented exception.
Be aware that this is on a 2011 implementation
Br Martin