-
Notifications
You must be signed in to change notification settings - Fork 0
/
Classes.py
47 lines (37 loc) · 1.46 KB
/
Classes.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
import json
# Task Model Definition
class Task:
def __init__(self, description: str, content, priority: int, group, due_date):
self.description = description
self.content = content
self.priority = priority
self.responsibleGroup = group
self.dueDate = due_date
def toJSON(self):
return json.dumps(self, sort_keys=True, indent=4, default=lambda x: x.__dict__)
# Scenario Model Definition
class Scenario:
def __init__(self, data):
self.alias = data.get("alias")
self.createdBy = data.get("createdBy")
self.incId = data.get("incId")
self.name = data.get("name")
self.scenarioApproved = data.get("scenarioApproved")
self.scenarioShortcut = data.get("scenarioShortcut")
self.scnId = data.get("scnId")
self.sequenceNbr = data.get("sequenceNbr")
self.type = data.get("type")
def toJSON(self):
return json.dumps(self, sort_keys=True, indent=4, default=lambda x: x.__dict__)
# Incident Model Definition
class Incident:
def __init__(self, name: str, description: str, scenario: Scenario):
self.name = name
self.description = description
self.scenarioVO = scenario
def toJSON(self):
return json.dumps(self, sort_keys=True, indent=4, default=lambda x: x.__dict__)
# Role Model Definition
class Role:
def __init__(self, data):
self.__dict__.update(data)