-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlex_input.py
47 lines (42 loc) · 1.92 KB
/
dlex_input.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
from .input_type import InputType
from .input import Input
from .layout_data_resource import LayoutDataResource
class DlexInput(Input):
'''
Represents a Dlex input
'''
def __init__(self, resource, layout_data):
'''
Initializes a new instance of the DlexInput class by posting the
DLEX file and the JSON data file or
DLEX file path that is present in the cloud environment and the JSON data file or
DLEX file path and DLEX data file path that is present in the cloud environment
from the client to the API to create the PDF report.
Args:
DlexResource (string): Resource dlex file created as per the desired PDF report layout design. | The DLEX file path present in the resource manager.
LayoutDataResource (string): LayoutData json data file used to create the PDF report. | The JSON data file path present in the resource manager used to create the PDF report.
'''
super().__init__()
if type(resource) != str:
self.resource_name = resource.resource_name
self._resources.append(resource)
else:
self.resource_name = resource
if type(layout_data) != str:
self.layout_data_resource_name = layout_data.layout_data_resource_name
self._resources.append(layout_data)
else:
layout_data_resource = LayoutDataResource(layout_data)
self.layout_data_resource_name = layout_data_resource.layout_data_resource_name
self._resources.append(layout_data_resource)
self._Type = InputType.Dlex
def to_json(self):
json = {
"id": self.id,
"type": InputType.Dlex,
"resourceName": self.resource_name,
"layoutDataResourceName": self.layout_data_resource_name
}
if self._template_id:
json["templateId"] = self._template_id
return json