Skip to main content

HS.HC.Callback.Manager

persistent class HS.HC.Callback.Manager extends %Library.Persistent [ Final ]

SQL Table Name: HS_HC_Callback.Manager

@API.Object

Property Inventory

Method Inventory

Parameters

parameter CALLBACKBASE = HS.HC.Callback.Handler;
Every registered callback class must extend this class.
parameter SYSTEMWIDE = *;
Namespace value denoting a registration that applies to all namespaces. There should be no restrictions as long as the event can be fired in that namespace.
parameter WRITERESOURCE = %DB_HSSYS;
Resource protecting the HSSYS database this registry lives in. Register() and Unregister() require WRITE on it.

Properties

property ApplicationContext as %String (MAXLEN = 128) [ Required ];
Identifies the callback slot (e.g. "FHIRServerEndpointLifecycle").
Property methods: ApplicationContextDisplayToLogical(), ApplicationContextGet(), ApplicationContextGetStored(), ApplicationContextIsValid(), ApplicationContextLogicalToDisplay(), ApplicationContextLogicalToOdbc(), ApplicationContextNormalize(), ApplicationContextSet()
property CallbackClassName as %Dictionary.Classname [ Required ];
The registered handler class.
Property methods: CallbackClassNameGet(), CallbackClassNameGetStored(), CallbackClassNameIsValid(), CallbackClassNameSet()
property Namespace as %String (MAXLEN = 64) [ Required ];
The namespace this registration applies to, or SYSTEMWIDE for all namespaces.
Property methods: NamespaceDisplayToLogical(), NamespaceGet(), NamespaceGetStored(), NamespaceIsValid(), NamespaceLogicalToDisplay(), NamespaceLogicalToOdbc(), NamespaceNormalize(), NamespaceSet()

Methods

classmethod FireEvent(pEvent) as %Status
Dispatch pEvent to the handler registered for the event's CALLBACKCONTEXT.

No-op returning $$$OK when no handler is registered for the event's context in the current namespace. The registry lookup is privilege-escalated, but OnCallback() itself runs with the caller's original privileges. Any error the handler returns or throws is propagated to the caller, which decides how to surface it.

@API.Method
classmethod GetCallbackClass(pContext As %String, pNamespace As %String, Output pCallbackClassName As %Dictionary.Classname) as %Status
Resolve the callback class registered for pContext into pCallbackClassName, which is set to "" when nothing is registered.

A registration for pNamespace wins over a SYSTEMWIDE one. Finding no registration is not an error - only caller misuse (an empty context or namespace) is.

@API.Method
classmethod Register(pContext As %String, pCallbackClass As %Dictionary.Classname, pNamespace As %String) as %Status
Register a callback handler class for an application context. pass SYSTEMWIDE to register for all namespaces. Replaces any existing registration for the same context and namespace. Requires %DB_HSSYS:Write.

The handler class must be compiled and extend CALLBACKBASE in pNamespace, since that is where it has to be resolvable when the event fires. For a system-wide registration the check runs in the current namespace: such handlers must live in a package mapped to all Foundation namespaces (HS.* and HS.Local.* already are), so visibility here implies visibility wherever the event fires.

@API.Method
classmethod Unregister(pContext As %String, pNamespace As %String) as %Status
Remove the callback registration for an application context, if one exists. Idempotent - returns success when nothing is registered. Requires %DB_HSSYS:Write. @API.Method

Indexes

index (ContextIdx on ApplicationContext,Namespace) [Unique];
Index methods: ContextIdxCheck(), ContextIdxCheckUnique(), ContextIdxDelete(), ContextIdxExists(), ContextIdxOpen(), ContextIdxSQLCheckUnique(), ContextIdxSQLExists(), ContextIdxSQLFindPKeyByConstraint(), ContextIdxSQLFindRowIDByConstraint()
index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()

Inherited Members

Inherited Methods

Storage

Storage Model: Storage (HS.HC.Callback.Manager)

^["HSSYS"]HS.HC.Callback.ManagerD(ID)
=
%%CLASSNAME
ApplicationContext
CallbackClassName
Namespace
FeedbackOpens in a new tab