-
Notifications
You must be signed in to change notification settings - Fork 1
/
SqlEvent.py
78 lines (69 loc) · 2.61 KB
/
SqlEvent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from utils import time2Str
class SqlEventSubject(object):
uri = '' # type: str
interpretation = '' # type: str
manifestation = '' # type: str
origin_uri = '' # type: str
mimetype = '' # type: str
text = '' # type: str
storage_uri = '' # type: str
current_uri = '' # type: str
def __init__(self,
uri: str,
interpretation: str,
manifestation: str,
origin_uri: str,
mimetype: str,
text: str,
storage_uri: str,
current_uri: str):
self.uri = uri
self.interpretation = interpretation
self.manifestation = manifestation
self.origin_uri = origin_uri
self.mimetype = mimetype
self.text = text
self.storage_uri = storage_uri
self.current_uri = current_uri
def __str__(self):
return ("\t\turi: %s\n\t\tinterpretation: %s\n"
"\t\tmanifestation: %s\n\t\tmime type: %s\n"
"\t\ttext: %s\n\t\tstorage: %s\n\t\tcurrent uri: %s\n" % (
self.uri, self.interpretation, self.manifestation,
self.mimetype, self.text, self.storage_uri, self.current_uri))
class SqlEvent(object):
id = 0 # type: int
pid = 0 # type: int
timestamp = 0 # type: int
interpretation = '' # type: str
manifestation = '' # type: str
origin_uri = '' # type: str
actor_uri = '' # type: str
subjects = [] # type: list
def __init__(self,
id: int,
pid: int,
timestamp: int,
interpretation: str,
manifestation: str,
origin_uri: str,
actor_uri: str):
self.id = id
self.pid = pid
self.timestamp = timestamp
self.interpretation = interpretation
self.manifestation = manifestation
self.origin_uri = origin_uri
self.actor_uri = actor_uri
self.subjects = []
def addSubject(self, subj: SqlEventSubject):
self.subjects.append(subj)
def __str__(self):
prnt = ("Sql Event: %d\n\tpid: %d\n\ttime: %s\n\tinterpretation: %s\n"
"\tmanifestation: %s\n\tactor: %s\n\tsubjects:\n" % (
self.id, self.pid, time2Str(self.timestamp),
self.interpretation, self.manifestation,
self.actor_uri))
for subject in self.subjects:
prnt += "%s\n" % subject.__str__()
return prnt + "\n"