Skip to content

Commit d6aa65c

Browse files
authored
Merge pull request #101 from intersystems-community/event-process
Event process
2 parents aa019eb + f98cd59 commit d6aa65c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Class ZPM.Analytics.AbstractEventProcessor [ Abstract ]
2+
{
3+
4+
ClassMethod Process(event) As %Status [ Abstract ]
5+
{
6+
}
7+
8+
}

src/cls/ZPM/Analytics/Event.cls

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Class ZPM.Analytics.Event Extends (%Persistent, %JSON.Adaptor)
33

44
Parameter DSTIME = "AUTO";
55

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

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

0 commit comments

Comments
 (0)