rev |
line source |
bsw/jbe@1309
|
1 function _G.ontomap_get_instances(event)
|
bsw/jbe@1309
|
2 if true then return {} end
|
bsw/jbe@1309
|
3 local url = config.ontomap.base_url .. "instances/Issue?geometries=true&descriptions=true"
|
bsw/jbe@1309
|
4 print("OnToMap>>")
|
bsw/jbe@1309
|
5
|
bsw/jbe@1309
|
6 local output, err, status = extos.pfilter(doc, "curl", "-X", "GET", "-H", "Content-Type: application/json", "--cert", config.ontomap.client_cert_file, "-d", "@-", url)
|
bsw/jbe@1309
|
7 print(output)
|
bsw/jbe@1309
|
8
|
bsw/jbe@1309
|
9 local data = json.import(output)
|
bsw/jbe@1309
|
10
|
bsw/jbe@1309
|
11 if not data then
|
bsw/jbe@1309
|
12 return {}
|
bsw/jbe@1309
|
13 end
|
bsw/jbe@1309
|
14
|
bsw/jbe@1309
|
15 if data.type ~= "FeatureCollection" or not data.features then
|
bsw/jbe@1309
|
16 return {}
|
bsw/jbe@1309
|
17 end
|
bsw/jbe@1309
|
18
|
bsw/jbe@1309
|
19 local instances = {}
|
bsw/jbe@1309
|
20 for i, feature in ipairs(data.features) do
|
bsw/jbe@1309
|
21 if feature.geometry then
|
bsw/jbe@1309
|
22 table.insert(instances, {
|
bsw/jbe@1309
|
23 application = feature.applicationName,
|
bsw/jbe@1309
|
24 title = feature.hasName,
|
bsw/jbe@1309
|
25 description = slot.use_temporary(function()
|
bsw/jbe@1309
|
26 ui.link{ external = feature.properties.external_url, text = feature.properties.hasName or "" }
|
bsw/jbe@1309
|
27 ui.container{ content = feature.hasDescription }
|
bsw/jbe@1309
|
28 end),
|
bsw/jbe@1309
|
29 lon = feature.geometry.coordinates[1],
|
bsw/jbe@1309
|
30 lat = feature.geometry.coordinates[2],
|
bsw/jbe@1309
|
31 label = "IMC" .. feature.properties.hasID,
|
bsw/jbe@1309
|
32 type = "Improve My City"
|
bsw/jbe@1309
|
33 })
|
bsw/jbe@1309
|
34 print(feature.applicationName, feature.properties.hasName, feature.properties.hasDescription)
|
bsw/jbe@1309
|
35 end
|
bsw/jbe@1309
|
36 end
|
bsw/jbe@1309
|
37 return instances
|
bsw/jbe@1309
|
38
|
bsw/jbe@1309
|
39 end
|
bsw/jbe@1309
|
40
|
bsw/jbe@1309
|
41
|
bsw/jbe@1309
|
42 local function new_log_event(event, actor, activity_type)
|
bsw/jbe@1309
|
43 local e = json.object{
|
bsw/jbe@1309
|
44 activity_type = activity_type,
|
bsw/jbe@1309
|
45 activity_objects = json.array(),
|
bsw/jbe@1309
|
46 references = json.array(),
|
bsw/jbe@1309
|
47 visibility_details = json.array(),
|
bsw/jbe@1309
|
48 details = json.object()
|
bsw/jbe@1309
|
49 }
|
bsw/jbe@1309
|
50 e.actor = actor
|
bsw/jbe@1309
|
51 e.timestamp = math.floor(event.occurrence_epoch * 1000)
|
bsw/jbe@1309
|
52 return e
|
bsw/jbe@1309
|
53 end
|
bsw/jbe@1309
|
54
|
bsw/jbe@1309
|
55 local function new_activity_object(attr)
|
bsw/jbe@1309
|
56 return json.object{
|
bsw/jbe@1309
|
57 type = "Feature",
|
bsw/jbe@1309
|
58 geometry = attr.geometry or json.null,
|
bsw/jbe@1309
|
59 properties = json.object{
|
bsw/jbe@1309
|
60 hasType = attr.type,
|
bsw/jbe@1309
|
61 external_url = attr.url
|
bsw/jbe@1309
|
62 }
|
bsw/jbe@1309
|
63 }
|
bsw/jbe@1309
|
64 end
|
bsw/jbe@1309
|
65
|
bsw/jbe@1309
|
66 local function new_reference_object(url, application)
|
bsw/jbe@1309
|
67 return json.object{
|
bsw/jbe@1309
|
68 application = application or config.ontomap.application_ident,
|
bsw/jbe@1309
|
69 external_url = url
|
bsw/jbe@1309
|
70 }
|
bsw/jbe@1309
|
71 end
|
bsw/jbe@1309
|
72
|
bsw/jbe@1309
|
73 local function log_to_ontomap(log_events)
|
bsw/jbe@1309
|
74 if json.type(log_events) == "object" then
|
bsw/jbe@1309
|
75 log_events = json.array{ log_events }
|
bsw/jbe@1309
|
76 end
|
bsw/jbe@1309
|
77 for i, log_event in ipairs(log_events) do
|
bsw/jbe@1309
|
78 if #(log_event.activity_objects) == 0 then
|
bsw/jbe@1309
|
79 log_event.activity_objects = nil
|
bsw/jbe@1309
|
80 end
|
bsw/jbe@1309
|
81 if #(log_event.references) == 0 then
|
bsw/jbe@1309
|
82 log_event.references = nil
|
bsw/jbe@1309
|
83 end
|
bsw/jbe@1309
|
84 if #(log_event.visibility_details) == 0 then
|
bsw/jbe@1309
|
85 log_event.visibility_details = nil
|
bsw/jbe@1309
|
86 end
|
bsw/jbe@1309
|
87 if not (next(log_event.details)) then -- TODO
|
bsw/jbe@1309
|
88 log_event.details = nil
|
bsw/jbe@1309
|
89 end
|
bsw/jbe@1309
|
90 end
|
bsw/jbe@1309
|
91
|
bsw/jbe@1309
|
92 local doc = json.export(json.object{
|
bsw/jbe@1309
|
93 event_list = log_events
|
bsw/jbe@1309
|
94 }, " ")
|
bsw/jbe@1309
|
95
|
bsw/jbe@1309
|
96 local url = config.ontomap.base_url .. "logger/events"
|
bsw/jbe@1309
|
97 print("OnToMap<<")
|
bsw/jbe@1309
|
98 print(doc)
|
bsw/jbe@1309
|
99
|
bsw/jbe@1309
|
100 local output, err, status = extos.pfilter(doc, "curl", "-X", "POST", "-H", "Content-Type: application/json", "--cert", config.ontomap.client_cert_file, "-d", "@-", url)
|
bsw/jbe@1309
|
101
|
bsw/jbe@1309
|
102 print("---------")
|
bsw/jbe@1309
|
103 print(output)
|
bsw/jbe@1309
|
104 print("---------")
|
bsw/jbe@1309
|
105
|
bsw/jbe@1309
|
106 if err then
|
bsw/jbe@1309
|
107 -- TODO log error
|
bsw/jbe@1309
|
108 end
|
bsw/jbe@1309
|
109 end
|
bsw/jbe@1309
|
110
|
bsw/jbe@1309
|
111 local function url_for(relation, id)
|
bsw/jbe@1309
|
112 return config.absolute_base_url .. relation .. "/show/" .. id .. ".html"
|
bsw/jbe@1309
|
113 end
|
bsw/jbe@1309
|
114
|
bsw/jbe@1309
|
115
|
bsw/jbe@1309
|
116 local function unit_updated(event, event_type)
|
bsw/jbe@1309
|
117 local log_event = new_log_event(event, 0, event_type == "created" and "object_created" or "object_updated")
|
bsw/jbe@1309
|
118 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
119 type = "unit",
|
bsw/jbe@1309
|
120 url = url_for("unit", event.unit_id)
|
bsw/jbe@1309
|
121 })
|
bsw/jbe@1309
|
122 log_event.details.active = event.unit.active
|
bsw/jbe@1309
|
123 log_event.details.name = event.unit.name
|
bsw/jbe@1309
|
124 log_event.details.description = event.unit.description
|
bsw/jbe@1309
|
125 log_event.details.external_reference = event.unit.external_reference
|
bsw/jbe@1309
|
126 log_event.details.region = event.unit.region
|
bsw/jbe@1309
|
127 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
128 end
|
bsw/jbe@1309
|
129
|
bsw/jbe@1309
|
130 local function area_updated(event, event_type)
|
bsw/jbe@1309
|
131 local log_event = new_log_event(event, 0, event_type == "created" and "object_created" or "object_updated")
|
bsw/jbe@1309
|
132 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
133 type = "area",
|
bsw/jbe@1309
|
134 url = url_for("area", event.area_id)
|
bsw/jbe@1309
|
135 })
|
bsw/jbe@1309
|
136 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
137 url_for("unit", event.area.unit_id)
|
bsw/jbe@1309
|
138 ))
|
bsw/jbe@1309
|
139 log_event.details.active = event.area.active
|
bsw/jbe@1309
|
140 log_event.details.name = event.area.name
|
bsw/jbe@1309
|
141 log_event.details.description = event.area.description
|
bsw/jbe@1309
|
142 log_event.details.external_reference = event.area.external_reference
|
bsw/jbe@1309
|
143 log_event.details.region = event.area.region
|
bsw/jbe@1309
|
144 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
145 end
|
bsw/jbe@1309
|
146
|
bsw/jbe@1309
|
147 local function policy_updated(event, event_type)
|
bsw/jbe@1309
|
148 local log_event = new_log_event(event, 0, event_type == "created" and "object_created" or "object_updated")
|
bsw/jbe@1309
|
149 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
150 type = "policy",
|
bsw/jbe@1309
|
151 url = url_for("policy", event.policy_id)
|
bsw/jbe@1309
|
152 })
|
bsw/jbe@1309
|
153 log_event.details.active = event.policy.active
|
bsw/jbe@1309
|
154 log_event.details.name = event.policy.name
|
bsw/jbe@1309
|
155 log_event.details.description = event.policy.description
|
bsw/jbe@1309
|
156 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
157 end
|
bsw/jbe@1309
|
158
|
bsw/jbe@1309
|
159 local mapper = {
|
bsw/jbe@1309
|
160
|
bsw/jbe@1309
|
161 unit_created = function(event)
|
bsw/jbe@1309
|
162 unit_updated(event, "created")
|
bsw/jbe@1309
|
163 end,
|
bsw/jbe@1309
|
164
|
bsw/jbe@1309
|
165 unit_updated = function(event)
|
bsw/jbe@1309
|
166 unit_updated(event, "updated")
|
bsw/jbe@1309
|
167 end,
|
bsw/jbe@1309
|
168
|
bsw/jbe@1309
|
169 area_created = function(event)
|
bsw/jbe@1309
|
170 area_updated(event, "created")
|
bsw/jbe@1309
|
171 end,
|
bsw/jbe@1309
|
172
|
bsw/jbe@1309
|
173 area_updated = function(event)
|
bsw/jbe@1309
|
174 area_updated(event, "updated")
|
bsw/jbe@1309
|
175 end,
|
bsw/jbe@1309
|
176
|
bsw/jbe@1309
|
177 policy_created = function(event)
|
bsw/jbe@1309
|
178 policy_updated(event, "created")
|
bsw/jbe@1309
|
179 end,
|
bsw/jbe@1309
|
180
|
bsw/jbe@1309
|
181 policy_updated = function(event)
|
bsw/jbe@1309
|
182 policy_updated(event, "updated")
|
bsw/jbe@1309
|
183 end,
|
bsw/jbe@1309
|
184
|
bsw/jbe@1309
|
185 issue_state_changed = function(event)
|
bsw/jbe@1309
|
186 local log_event = new_log_event(event, 0, "issue_status_updated")
|
bsw/jbe@1309
|
187 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
188 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
189 ))
|
bsw/jbe@1309
|
190 log_event.details.new_issue_state = event.state
|
bsw/jbe@1309
|
191 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
192 end,
|
bsw/jbe@1309
|
193
|
bsw/jbe@1309
|
194 initiative_created_in_new_issue = function(event)
|
bsw/jbe@1309
|
195 local log_events = json.array()
|
bsw/jbe@1309
|
196
|
bsw/jbe@1309
|
197 local log_event = new_log_event(event, 0, "object_created")
|
bsw/jbe@1309
|
198 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
199 type = "issue",
|
bsw/jbe@1309
|
200 url = url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
201 })
|
bsw/jbe@1309
|
202 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
203 url_for("policy", event.issue.policy_id)
|
bsw/jbe@1309
|
204 ))
|
bsw/jbe@1309
|
205 log_event.details.new_issue_state = event.state
|
bsw/jbe@1309
|
206 table.insert(log_events, log_event)
|
bsw/jbe@1309
|
207
|
bsw/jbe@1309
|
208 local log_event = new_log_event(event, event.member_id, "object_created")
|
bsw/jbe@1309
|
209 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
210 type = "initiative",
|
bsw/jbe@1309
|
211 url = url_for("initiative", event.initiative_id),
|
bsw/jbe@1309
|
212 geometry = event.initiative.location
|
bsw/jbe@1309
|
213 })
|
bsw/jbe@1309
|
214 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
215 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
216 ))
|
bsw/jbe@1309
|
217 log_event.details.name = event.initiative.name
|
bsw/jbe@1309
|
218 table.insert(log_events, log_event)
|
bsw/jbe@1309
|
219
|
bsw/jbe@1309
|
220 log_to_ontomap(log_events)
|
bsw/jbe@1309
|
221 end,
|
bsw/jbe@1309
|
222
|
bsw/jbe@1309
|
223 initiative_created_in_existing_issue = function(event)
|
bsw/jbe@1309
|
224 local log_event = new_log_event(event, event.member_id, "object_created")
|
bsw/jbe@1309
|
225 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
226 type = "initiative",
|
bsw/jbe@1309
|
227 url = url_for("initiative", event.initiative_id),
|
bsw/jbe@1309
|
228 geometry = event.initiative.location
|
bsw/jbe@1309
|
229 })
|
bsw/jbe@1309
|
230 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
231 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
232 ))
|
bsw/jbe@1309
|
233 log_event.details.name = event.initiative.name
|
bsw/jbe@1309
|
234 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
235 end,
|
bsw/jbe@1309
|
236
|
bsw/jbe@1309
|
237 initiative_revoked = function(event)
|
bsw/jbe@1309
|
238 -- TODO -> which activity?
|
bsw/jbe@1309
|
239 end,
|
bsw/jbe@1309
|
240
|
bsw/jbe@1309
|
241 new_draft_created = function(event)
|
bsw/jbe@1309
|
242 local log_event = new_log_event(event, event.member_id, "object_updated")
|
bsw/jbe@1309
|
243 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
244 type = "initiative",
|
bsw/jbe@1309
|
245 url = url_for("initiative", event.issue_id)
|
bsw/jbe@1309
|
246 })
|
bsw/jbe@1309
|
247 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
248 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
249 ))
|
bsw/jbe@1309
|
250 log_event.details.name = event.initiative.name
|
bsw/jbe@1309
|
251 log_event.details.location = event.initiative.current_draft.location
|
bsw/jbe@1309
|
252 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
253 end,
|
bsw/jbe@1309
|
254
|
bsw/jbe@1309
|
255 interest = function(event)
|
bsw/jbe@1309
|
256 local activity_type = event.boolean_value and "interest_added" or "interest_removed"
|
bsw/jbe@1309
|
257 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
258 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
259 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
260 ))
|
bsw/jbe@1309
|
261 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
262 end,
|
bsw/jbe@1309
|
263
|
bsw/jbe@1309
|
264 initiator = function(event)
|
bsw/jbe@1309
|
265 local activity_type = event.boolean_value and "initiator_added" or "initiator_removed"
|
bsw/jbe@1309
|
266 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
267 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
268 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
269 ))
|
bsw/jbe@1309
|
270 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
271 end,
|
bsw/jbe@1309
|
272
|
bsw/jbe@1309
|
273 support = function(event)
|
bsw/jbe@1309
|
274 local activity_type = event.boolean_value and "support_added" or "support_removed"
|
bsw/jbe@1309
|
275 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
276 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
277 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
278 ))
|
bsw/jbe@1309
|
279 log_event.details.draft_id = event.draft_id
|
bsw/jbe@1309
|
280 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
281 end,
|
bsw/jbe@1309
|
282
|
bsw/jbe@1309
|
283 support_updated = function(event)
|
bsw/jbe@1309
|
284 local log_event = new_log_event(event, event.member_id, "support_updated")
|
bsw/jbe@1309
|
285 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
286 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
287 ))
|
bsw/jbe@1309
|
288 log_event.details.draft_id = event.draft_id
|
bsw/jbe@1309
|
289 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
290 end,
|
bsw/jbe@1309
|
291
|
bsw/jbe@1309
|
292 suggestion_created = function(event)
|
bsw/jbe@1309
|
293 local log_event = new_log_event(event, event.member_id, "object_created")
|
bsw/jbe@1309
|
294 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
295 type = "suggestion",
|
bsw/jbe@1309
|
296 url = url_for("suggestion", event.suggestion_id)
|
bsw/jbe@1309
|
297 })
|
bsw/jbe@1309
|
298 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
299 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
300 ))
|
bsw/jbe@1309
|
301 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
302 end,
|
bsw/jbe@1309
|
303
|
bsw/jbe@1309
|
304 suggestion_removed = function(event)
|
bsw/jbe@1309
|
305 local log_event = new_log_event(event, 0, "object_removed")
|
bsw/jbe@1309
|
306 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
307 type = "suggestion",
|
bsw/jbe@1309
|
308 url = url_for("suggestion", event.suggestion_id)
|
bsw/jbe@1309
|
309 })
|
bsw/jbe@1309
|
310 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
311 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
312 ))
|
bsw/jbe@1309
|
313 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
314 end,
|
bsw/jbe@1309
|
315
|
bsw/jbe@1309
|
316 suggestion_rated = function(event)
|
bsw/jbe@1309
|
317 local log_event = new_log_event(event, event.member_id, "suggestion_rated")
|
bsw/jbe@1309
|
318 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
319 url_for("suggestion", event.suggestion_id)
|
bsw/jbe@1309
|
320 ))
|
bsw/jbe@1309
|
321 log_event.details.degree = event.numeric_value
|
bsw/jbe@1309
|
322 log_event.details.fulfilled = event.boolean_value or json.null
|
bsw/jbe@1309
|
323 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
324 end,
|
bsw/jbe@1309
|
325
|
bsw/jbe@1309
|
326 delegation = function(event)
|
bsw/jbe@1309
|
327 -- TODO
|
bsw/jbe@1309
|
328 end,
|
bsw/jbe@1309
|
329
|
bsw/jbe@1309
|
330 member_activated = function(event)
|
bsw/jbe@1309
|
331 local log_event = new_log_event(event, event.member_id, "account_registered")
|
bsw/jbe@1309
|
332 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
333 end,
|
bsw/jbe@1309
|
334
|
bsw/jbe@1309
|
335 member_removed = function(event)
|
bsw/jbe@1309
|
336 -- TODO -> which activity to log?
|
bsw/jbe@1309
|
337 end,
|
bsw/jbe@1309
|
338
|
bsw/jbe@1309
|
339 member_active = function(event)
|
bsw/jbe@1309
|
340 -- TODO -> which activity to log?
|
bsw/jbe@1309
|
341 end,
|
bsw/jbe@1309
|
342
|
bsw/jbe@1309
|
343 member_name_updated = function(event)
|
bsw/jbe@1309
|
344 local log_event = new_log_event(event, event.member_id, "screen_name_changed")
|
bsw/jbe@1309
|
345 log_event.details.screen_name = event.text_value
|
bsw/jbe@1309
|
346 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
347 end,
|
bsw/jbe@1309
|
348
|
bsw/jbe@1309
|
349 member_profile_updated = function(event)
|
bsw/jbe@1309
|
350 local log_event = new_log_event(event, event.member_id, "profile_updated")
|
bsw/jbe@1309
|
351 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
352 end,
|
bsw/jbe@1309
|
353
|
bsw/jbe@1309
|
354 member_image_updated = function(event)
|
bsw/jbe@1309
|
355 local log_event = new_log_event(event, event.member_id, "avatar_changed")
|
bsw/jbe@1309
|
356 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
357 end,
|
bsw/jbe@1309
|
358
|
bsw/jbe@1309
|
359 contact = function(event)
|
bsw/jbe@1309
|
360 local activity_type = event.boolean_value and "contact_published" or "contact_unpublished"
|
bsw/jbe@1309
|
361 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
362 log_event.details.other_member_id = event.other_member_id
|
bsw/jbe@1309
|
363 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
364 end
|
bsw/jbe@1309
|
365
|
bsw/jbe@1309
|
366 }
|
bsw/jbe@1309
|
367
|
bsw/jbe@1309
|
368 function _G.ontomap_log_event(event)
|
bsw/jbe@1309
|
369
|
bsw/jbe@1309
|
370 if mapper[event.event] then
|
bsw/jbe@1309
|
371 local e = Event:new_selector()
|
bsw/jbe@1309
|
372 :add_where{ "id = ?", event.id }
|
bsw/jbe@1309
|
373 :add_field("extract(epoch from occurrence)", "occurrence_epoch")
|
bsw/jbe@1309
|
374 :optional_object_mode()
|
bsw/jbe@1309
|
375 :exec()
|
bsw/jbe@1309
|
376 if e then
|
bsw/jbe@1309
|
377 mapper[event.event](e)
|
bsw/jbe@1309
|
378 end
|
bsw/jbe@1309
|
379 end
|
bsw/jbe@1309
|
380
|
bsw/jbe@1309
|
381
|
bsw/jbe@1309
|
382 end
|