Skip to content

Commit 5291a4e

Browse files
authored
Merge pull request #58 from psteiwer/dev
v1.2.2
2 parents ef9facb + d8e4791 commit 5291a4e

10 files changed

Lines changed: 1180 additions & 913 deletions

File tree

PivotSubscriptions/EventLog.cls

Lines changed: 146 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,146 @@
1-
/// Event Log is a log for every action performed by Pivot Subscriptions, covering five event types: creation, update, deletion, sent email subscriptions by Task, and immediately sent emails.
2-
Class PivotSubscriptions.EventLog Extends %Persistent
3-
{
4-
5-
/// Event Type covers: creation, update, deletion and sent email subscriptions
6-
/*
7-
* Only possible values are creation, update, deletion, send, and tableError
8-
*/
9-
Property EventType As %String (VALUELIST=",creation,update,deletion,send,tableError");
10-
11-
Property TimeStamp As %TimeStamp [ InitialExpression = {$zdt($h, 3, 1)} ];
12-
13-
Property UserName As %String(MAXLEN = 128) [ InitialExpression = {$username} ];
14-
15-
Property Pivot As %String(MAXLEN = 512);
16-
17-
Property DayOfWeek As %String;
18-
19-
Property Hour As %Integer(MINVAL=0, MAXVAL=23);
20-
21-
Property Minute As %Integer (MINVAL=0, MAXVAL=59);
22-
23-
Property Format As %String(VALUELIST = ",Excel,PDF");
24-
25-
Property Emails As %String;
26-
27-
Property Name As %String;
28-
29-
/// Takes in info about an Alert Task and logs the information to the TaskLog
30-
ClassMethod LogEvent(pEvent, pUser, pPivot, pDayOfWeek, pHour, pMinute, pFormat, pEmails, pName) As %Status
31-
{
32-
Set tSC=$$$OK
33-
34-
Set tEventLog=##class(PivotSubscriptions.EventLog).%New()
35-
Set tEventLog.EventType=pEvent
36-
Set tEventLog.TimeStamp=$zdt($h, 3, 1)
37-
Set tEventLog.UserName=pUser
38-
Set tEventLog.Pivot=pPivot
39-
Set tEventLog.Name=pName
40-
41-
Set tEventLog.DayOfWeek=pDayOfWeek
42-
Set tEventLog.Hour=pHour
43-
Set tEventLog.Minute=pMinute
44-
45-
Set tEventLog.Format=pFormat
46-
Set tEventLog.Emails=pEmails
47-
48-
Set tSC=tEventLog.%Save()
49-
50-
Quit tSC
51-
}
52-
53-
Storage Default
54-
{
55-
<Data name="EventLogDefaultData">
56-
<Value name="1">
57-
<Value>%%CLASSNAME</Value>
58-
</Value>
59-
<Value name="2">
60-
<Value>EventType</Value>
61-
</Value>
62-
<Value name="3">
63-
<Value>TimeStamp</Value>
64-
</Value>
65-
<Value name="4">
66-
<Value>UserName</Value>
67-
</Value>
68-
<Value name="5">
69-
<Value>Pivot</Value>
70-
</Value>
71-
<Value name="6">
72-
<Value>SubscriptionId</Value>
73-
</Value>
74-
<Value name="7">
75-
<Value>DayOfWeek</Value>
76-
</Value>
77-
<Value name="8">
78-
<Value>Hour</Value>
79-
</Value>
80-
<Value name="9">
81-
<Value>Minute</Value>
82-
</Value>
83-
<Value name="10">
84-
<Value>Format</Value>
85-
</Value>
86-
<Value name="11">
87-
<Value>Emails</Value>
88-
</Value>
89-
<Value name="12">
90-
<Value>Name</Value>
91-
</Value>
92-
</Data>
93-
<DataLocation>^PivotSubscriptions.EventLogD</DataLocation>
94-
<DefaultData>EventLogDefaultData</DefaultData>
95-
<IdLocation>^PivotSubscriptions.EventLogD</IdLocation>
96-
<IndexLocation>^PivotSubscriptions.EventLogI</IndexLocation>
97-
<StreamLocation>^PivotSubscriptions.EventLogS</StreamLocation>
98-
<Type>%Storage.Persistent</Type>
99-
}
100-
101-
}
1+
/// Event Log is a log for every action performed by Pivot Subscriptions, covering five event types: creation, update, deletion, sent email subscriptions by Task, and immediately sent emails.
2+
Class PivotSubscriptions.EventLog Extends %Persistent
3+
{
4+
5+
/*
6+
* Only possible values are creation, update, deletion, send, and tableError
7+
*/
8+
/// Event Type covers: creation, update, deletion and sent email subscriptions
9+
Property EventType As %String(VALUELIST = ",create,update,delete,sendSubscription,sendError,tableError");
10+
11+
Property StartTime As %TimeStamp [ InitialExpression = {$zdt($h, 3, 1)} ];
12+
13+
Property EndTime As %TimeStamp;
14+
15+
Property UserName As %String(MAXLEN = 128) [ InitialExpression = {$username} ];
16+
17+
Property Pivot As %String(MAXLEN = 512);
18+
19+
Property DayOfWeek As %String;
20+
21+
Property Hour As %Integer(MAXVAL = 23, MINVAL = 0);
22+
23+
Property Minute As %Integer(MAXVAL = 59, MINVAL = 0);
24+
25+
Property Format As %String(VALUELIST = ",Excel,PDF");
26+
27+
Property Emails As %String(MAXLEN = "");
28+
29+
Property Name As %String(MAXLEN = 100);
30+
31+
Property Status As %Status;
32+
33+
/// Takes in info about an Alert Task and logs the information to the TaskLog
34+
ClassMethod LogEvent(pType, pUser, pPivot, pDayOfWeek, pHour, pMinute, pFormat, pEmails, pName, ByRef pEvent) As %Status
35+
{
36+
Set tSC=$$$OK
37+
38+
Set tEventLog=##class(PivotSubscriptions.EventLog).%New()
39+
Set tEventLog.EventType=pType
40+
Set tEventLog.UserName=pUser
41+
Set tEventLog.Pivot=pPivot
42+
Set tEventLog.Name=pName
43+
44+
Set tEventLog.DayOfWeek=pDayOfWeek
45+
Set tEventLog.Hour=pHour
46+
Set tEventLog.Minute=pMinute
47+
48+
Set tEventLog.Format=pFormat
49+
Set tEventLog.Emails=pEmails
50+
51+
If pType="tableError" {
52+
Set tEventLog.Status=$$$OK
53+
Set tEventLog.EndTime=$zdt($h,3,1)
54+
}
55+
56+
Set tSC=tEventLog.%Save()
57+
Set pEvent=tEventLog
58+
59+
Quit tSC
60+
}
61+
62+
Method LogUpdate(pStatus) As %Status
63+
{
64+
Set tSC=$$$OK
65+
66+
Set ..EndTime=$zdt($h,3,1)
67+
Set ..Status=pStatus
68+
Set tSC=..%Save()
69+
70+
Quit tSC
71+
}
72+
73+
ClassMethod DayOfWeekDisplay(pDayOfWeek) As %String [ SqlProc ]
74+
{
75+
Set pDayOfWeek=$Replace(pDayOfWeek,0,"Sunday")
76+
Set pDayOfWeek=$Replace(pDayOfWeek,1,"Monday")
77+
Set pDayOfWeek=$Replace(pDayOfWeek,2,"Tuesday")
78+
Set pDayOfWeek=$Replace(pDayOfWeek,3,"Wednesday")
79+
Set pDayOfWeek=$Replace(pDayOfWeek,4,"Thursday")
80+
Set pDayOfWeek=$Replace(pDayOfWeek,5,"Friday")
81+
Set pDayOfWeek=$Replace(pDayOfWeek,6,"Saturday")
82+
Quit pDayOfWeek
83+
}
84+
85+
Query GetEvents() As %SQLQuery
86+
{
87+
SELECT StartTime,EndTime,EventType,Name,Pivot,UserName,PivotSubscriptions.EventLog_DayOfWeekDisplay(DayOfWeek) As DayOfWeek,Format,"Hour","Minute",Emails,Status
88+
FROM PivotSubscriptions.EventLog
89+
ORDER BY ID DESC
90+
}
91+
92+
Storage Default
93+
{
94+
<Data name="EventLogDefaultData">
95+
<Value name="1">
96+
<Value>%%CLASSNAME</Value>
97+
</Value>
98+
<Value name="2">
99+
<Value>EventType</Value>
100+
</Value>
101+
<Value name="3">
102+
<Value>StartTime</Value>
103+
</Value>
104+
<Value name="4">
105+
<Value>UserName</Value>
106+
</Value>
107+
<Value name="5">
108+
<Value>Pivot</Value>
109+
</Value>
110+
<Value name="6">
111+
<Value>SubscriptionId</Value>
112+
</Value>
113+
<Value name="7">
114+
<Value>DayOfWeek</Value>
115+
</Value>
116+
<Value name="8">
117+
<Value>Hour</Value>
118+
</Value>
119+
<Value name="9">
120+
<Value>Minute</Value>
121+
</Value>
122+
<Value name="10">
123+
<Value>Format</Value>
124+
</Value>
125+
<Value name="11">
126+
<Value>Emails</Value>
127+
</Value>
128+
<Value name="12">
129+
<Value>Name</Value>
130+
</Value>
131+
<Value name="13">
132+
<Value>EndTime</Value>
133+
</Value>
134+
<Value name="14">
135+
<Value>Status</Value>
136+
</Value>
137+
</Data>
138+
<DataLocation>^PivotSubscriptions.EventLogD</DataLocation>
139+
<DefaultData>EventLogDefaultData</DefaultData>
140+
<IdLocation>^PivotSubscriptions.EventLogD</IdLocation>
141+
<IndexLocation>^PivotSubscriptions.EventLogI</IndexLocation>
142+
<StreamLocation>^PivotSubscriptions.EventLogS</StreamLocation>
143+
<Type>%Storage.Persistent</Type>
144+
}
145+
146+
}
Lines changed: 73 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,73 @@
1-
Class PivotSubscriptions.Subscription Extends %Persistent
2-
{
3-
4-
Parameter DEFAULTGLOBAL = "^PivotSubscriptions.Sub";
5-
6-
Property CreatedBy As %String;
7-
8-
Property Pivot As %String(MAXLEN="");
9-
10-
Property DayOfWeek As %String;
11-
12-
Property Hour As %Integer(MINVAL=0, MAXVAL=23);
13-
14-
Property Minute As %Integer(VALUELIST=",0,15,30,45");
15-
16-
Property Format As %String(VALUELIST = ",Excel,PDF");
17-
18-
Property Emails As %String(MAXLEN="");
19-
20-
Property Version As %String [ InitialExpression = {##class(PivotSubscriptions.Utility).GetVersion()} ];
21-
22-
Property Name As %String(MAXLEN=100);
23-
24-
Storage Default
25-
{
26-
<Data name="SubscriptionDefaultData">
27-
<Value name="1">
28-
<Value>%%CLASSNAME</Value>
29-
</Value>
30-
<Value name="2">
31-
<Value>CreatedBy</Value>
32-
</Value>
33-
<Value name="3">
34-
<Value>Pivot</Value>
35-
</Value>
36-
<Value name="4">
37-
<Value>DayOfWeek</Value>
38-
</Value>
39-
<Value name="5">
40-
<Value>Hour</Value>
41-
</Value>
42-
<Value name="6">
43-
<Value>Minute</Value>
44-
</Value>
45-
<Value name="7">
46-
<Value>Format</Value>
47-
</Value>
48-
<Value name="8">
49-
<Value>Emails</Value>
50-
</Value>
51-
<Value name="9">
52-
<Value>Version</Value>
53-
</Value>
54-
<Value name="10">
55-
<Value>Name</Value>
56-
</Value>
57-
</Data>
58-
<DataLocation>^PivotSubscriptions.SubD</DataLocation>
59-
<DefaultData>SubscriptionDefaultData</DefaultData>
60-
<IdLocation>^PivotSubscriptions.SubD</IdLocation>
61-
<IndexLocation>^PivotSubscriptions.SubI</IndexLocation>
62-
<StreamLocation>^PivotSubscriptions.SubS</StreamLocation>
63-
<Type>%Storage.Persistent</Type>
64-
}
65-
66-
}
1+
Class PivotSubscriptions.Subscription Extends %Persistent
2+
{
3+
4+
Parameter DEFAULTGLOBAL = "^PivotSubscriptions.Sub";
5+
6+
Property CreatedBy As %String;
7+
8+
Property Pivot As %String(MAXLEN = "");
9+
10+
Property DayOfWeek As %String;
11+
12+
Property Hour As %Integer(MAXVAL = 23, MINVAL = 0);
13+
14+
Property Minute As %Integer(VALUELIST = ",0,15,30,45");
15+
16+
Property Format As %String(VALUELIST = ",Excel,PDF");
17+
18+
Property Emails As %String(MAXLEN = "");
19+
20+
Property Version As %String [ InitialExpression = {##class(PivotSubscriptions.Utils).GetVersion()} ];
21+
22+
Property Name As %String(MAXLEN = 100);
23+
24+
Property CustomFilters As array Of %String(MAXLEN = "");
25+
26+
Storage Default
27+
{
28+
<Data name="CustomFilters">
29+
<Attribute>CustomFilters</Attribute>
30+
<Structure>subnode</Structure>
31+
<Subscript>"CustomFilters"</Subscript>
32+
</Data>
33+
<Data name="SubscriptionDefaultData">
34+
<Value name="1">
35+
<Value>%%CLASSNAME</Value>
36+
</Value>
37+
<Value name="2">
38+
<Value>CreatedBy</Value>
39+
</Value>
40+
<Value name="3">
41+
<Value>Pivot</Value>
42+
</Value>
43+
<Value name="4">
44+
<Value>DayOfWeek</Value>
45+
</Value>
46+
<Value name="5">
47+
<Value>Hour</Value>
48+
</Value>
49+
<Value name="6">
50+
<Value>Minute</Value>
51+
</Value>
52+
<Value name="7">
53+
<Value>Format</Value>
54+
</Value>
55+
<Value name="8">
56+
<Value>Emails</Value>
57+
</Value>
58+
<Value name="9">
59+
<Value>Version</Value>
60+
</Value>
61+
<Value name="10">
62+
<Value>Name</Value>
63+
</Value>
64+
</Data>
65+
<DataLocation>^PivotSubscriptions.SubD</DataLocation>
66+
<DefaultData>SubscriptionDefaultData</DefaultData>
67+
<IdLocation>^PivotSubscriptions.SubD</IdLocation>
68+
<IndexLocation>^PivotSubscriptions.SubI</IndexLocation>
69+
<StreamLocation>^PivotSubscriptions.SubS</StreamLocation>
70+
<Type>%Storage.Persistent</Type>
71+
}
72+
73+
}

0 commit comments

Comments
 (0)