Skip to content

Commit

Permalink
Merge pull request #101 from intersystems-community/event-process
Browse files Browse the repository at this point in the history
Event process
  • Loading branch information
nsolov authored Aug 9, 2023
2 parents aa019eb + f98cd59 commit d6aa65c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/cls/ZPM/Analytics/AbstractEventProcessor.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Class ZPM.Analytics.AbstractEventProcessor [ Abstract ]
{

ClassMethod Process(event) As %Status [ Abstract ]
{
}

}
8 changes: 5 additions & 3 deletions src/cls/ZPM/Analytics/Event.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Class ZPM.Analytics.Event Extends (%Persistent, %JSON.Adaptor)

Parameter DSTIME = "AUTO";

/// Server date and time, saving the data
/// Server date and time, saving the data
Property TS As %PosixTime(%JSONINCLUDE = "none") [ SqlComputeCode = {set {*}=##class(%Library.PosixTime).CurrentTimeStamp()}, SqlComputed, SqlComputeOnChange = %%INSERT ];

/// Event type: download, install, uninstall
Expand Down Expand Up @@ -48,8 +48,10 @@ ClassMethod SaveEvent(action As %String, ip As %String = "", json As %DynamicObj
Set event.IP = ip
Do event.%JSONImport(json)
$$$ThrowOnError(event.%Save())
If ##class(%Dictionary.CompiledClass).%ExistsId("ZPM.Analytics.IP") {
Do ##class(ZPM.Analytics.IP).SetGeo(event, ip)
// get all ZPM.Analytics.AbstractEventProcessor subclasses
set rs = ##class(%Dictionary.ClassDefinitionQuery).SubclassOfFunc("ZPM.Analytics.AbstractEventProcessor")
while (rs.%Next()) {
do $classmethod(rs.%GetData(1), "Process", event)
}
$$$ThrowOnError(event.%Save())
Return $$$OK
Expand Down

0 comments on commit d6aa65c

Please sign in to comment.