Question
· Mar 16, 2022

Does anyone have a sample CCREventHandler class?

I had heard that sample classes are available somewhere.

Discussion (2)2
Log in or sign up to continue

@Hugh Badian  - I suggest you add the tag 'CCR' to your question.

The %Studio.SourceControl.CCREventHandler.cls is included in the CCR Client Tools so you should be able to open that on any CCR Client system to look at the methods that you can extend to do things on ItemSet download or Refresh.  It has a lot of built-in documentation.

Is there a specific thing that you are looking to accomplish with a CCREventHandler?

Here's a sample that loads interoperability system defaults from an XML file:

Class Sample.CCREventHandler Extends %Studio.SourceControl.CCREventHandler
{

/// This method is called during the loading of an ItemSet, after the contents of the ItemSet have been loaded into the namespace, 
/// and after the ImplementCCR routine has been run
Method ItemSetAfterLoadToNS() As %Status
{
    set key = ""
    for {
        set item = ..ItemSetItemList.GetNext(.key)
        quit:(key="")
        if (key [ "backup/ens/defaults.xml") {
            $$$ThrowOnError(##class(Ens.Config.DefaultSettings).%Import(^Sources_"backup/ens/defaults.xml"))
            quit
        }
    }
    Quit ##super()
}

/// This method is called by the CCR Refresh logic, after the items have been refreshed into the namespace.  It is intended for any additional configuration work which 
/// may be necessary (e.g. initialization of reference tables, building of 3rd party sources, etc)
Method RefreshFinalize() As %Status
{
    $$$ThrowOnError(##class(Ens.Config.DefaultSettings).%Import(^Sources_"backup/ens/defaults.xml"))
    Quit ##super()
}

}