-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLab12-03 Rest API.xml
250 lines (248 loc) · 11 KB
/
Lab12-03 Rest API.xml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<channel version="3.11.0">
<id>4c783b83-4620-4d9f-9d0d-ab68ad92a4fa</id>
<nextMetaDataId>2</nextMetaDataId>
<name>Lab09-03 Rest API</name>
<description></description>
<revision>5</revision>
<sourceConnector version="3.11.0">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
<properties class="com.mirth.connect.connectors.http.HttpReceiverProperties" version="3.11.0">
<pluginProperties>
<com.mirth.connect.plugins.httpauth.NoneHttpAuthProperties version="3.11.0">
<authType>NONE</authType>
</com.mirth.connect.plugins.httpauth.NoneHttpAuthProperties>
</pluginProperties>
<listenerConnectorProperties version="3.11.0">
<host>0.0.0.0</host>
<port>7000</port>
</listenerConnectorProperties>
<sourceConnectorProperties version="3.11.0">
<responseVariable>d1</responseVariable>
<respondAfterProcessing>true</respondAfterProcessing>
<processBatch>false</processBatch>
<firstResponse>false</firstResponse>
<processingThreads>1</processingThreads>
<resourceIds class="linked-hash-map">
<entry>
<string>Default Resource</string>
<string>[Default Resource]</string>
</entry>
</resourceIds>
<queueBufferSize>1000</queueBufferSize>
</sourceConnectorProperties>
<xmlBody>true</xmlBody>
<parseMultipart>true</parseMultipart>
<includeMetadata>true</includeMetadata>
<binaryMimeTypes>application/.*(?<!json|xml)$|image/.*|video/.*|audio/.*</binaryMimeTypes>
<binaryMimeTypesRegex>true</binaryMimeTypesRegex>
<responseContentType>${responseContentType}</responseContentType>
<responseDataTypeBinary>false</responseDataTypeBinary>
<responseStatusCode>${responseCode}</responseStatusCode>
<responseHeaders class="linked-hash-map"/>
<responseHeadersVariable></responseHeadersVariable>
<useResponseHeadersVariable>false</useResponseHeadersVariable>
<charset>UTF-8</charset>
<contextPath>/pacientes</contextPath>
<timeout>30000</timeout>
<staticResources/>
</properties>
<transformer version="3.11.0">
<elements/>
<inboundDataType>XML</inboundDataType>
<outboundDataType>JSON</outboundDataType>
<inboundProperties class="com.mirth.connect.plugins.datatypes.xml.XMLDataTypeProperties" version="3.11.0">
<serializationProperties class="com.mirth.connect.plugins.datatypes.xml.XMLSerializationProperties" version="3.11.0">
<stripNamespaces>false</stripNamespaces>
</serializationProperties>
<batchProperties class="com.mirth.connect.plugins.datatypes.xml.XMLBatchProperties" version="3.11.0">
<splitType>Element_Name</splitType>
<elementName></elementName>
<level>1</level>
<query></query>
<batchScript></batchScript>
</batchProperties>
</inboundProperties>
<outboundProperties class="com.mirth.connect.plugins.datatypes.json.JSONDataTypeProperties" version="3.11.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.json.JSONBatchProperties" version="3.11.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</outboundProperties>
</transformer>
<filter version="3.11.0">
<elements/>
</filter>
<transportName>HTTP Listener</transportName>
<mode>SOURCE</mode>
<enabled>true</enabled>
<waitForPrevious>true</waitForPrevious>
</sourceConnector>
<destinationConnectors>
<connector version="3.11.0">
<metaDataId>1</metaDataId>
<name>Destination 1</name>
<properties class="com.mirth.connect.connectors.js.JavaScriptDispatcherProperties" version="3.11.0">
<pluginProperties/>
<destinationConnectorProperties version="3.11.0">
<queueEnabled>false</queueEnabled>
<sendFirst>false</sendFirst>
<retryIntervalMillis>10000</retryIntervalMillis>
<regenerateTemplate>false</regenerateTemplate>
<retryCount>0</retryCount>
<rotate>false</rotate>
<includeFilterTransformer>false</includeFilterTransformer>
<threadCount>1</threadCount>
<threadAssignmentVariable></threadAssignmentVariable>
<validateResponse>false</validateResponse>
<resourceIds class="linked-hash-map">
<entry>
<string>Default Resource</string>
<string>[Default Resource]</string>
</entry>
</resourceIds>
<queueBufferSize>1000</queueBufferSize>
<reattachAttachments>true</reattachAttachments>
</destinationConnectorProperties>
<script>var dbConn;
var result;
var patientsArray = [];
try {
dbConn = DatabaseConnectionFactory.createDatabaseConnection("com.mysql.cj.jdbc.Driver", "jdbc:mysql://localhost:3306/mydatabase", 'root', 'root');
result = dbConn.executeCachedQuery('select * from pacientes');
while (result.next()) {
const Nom = result.getString('Nombre');
const Ape = result.getString('Apellido’');
const Fechnac = result.getString('Fechnacimiento');
const patientObject = {firstname: Nom, lastname: Ape, date_of_birth: Fechnac};
patientsArray.push(patientObject);
}
channelMap.put('responseContentType', 'application/json');
channelMap.put('responseCode', '300');
return JSON.stringify(patientsArray);
} catch (e) {
logger.info(e);
return [];
} finally {
if (dbConn) {
dbConn.close();
}
}
</script>
</properties>
<transformer version="3.11.0">
<elements>
<com.mirth.connect.plugins.javascriptstep.JavaScriptStep version="3.11.0">
<sequenceNumber>0</sequenceNumber>
<enabled>true</enabled>
<script>var dbConn;
var result;
try {
dbConn = DatabaseConnectionFactory.createDatabaseConnection('driver', 'address', 'username', 'password');
result = dbConn.executeCachedQuery('expression');
} finally {
if (dbConn) {
dbConn.close();
}
}</script>
</com.mirth.connect.plugins.javascriptstep.JavaScriptStep>
</elements>
<inboundTemplate encoding="base64"></inboundTemplate>
<outboundTemplate encoding="base64"></outboundTemplate>
<inboundDataType>JSON</inboundDataType>
<outboundDataType>JSON</outboundDataType>
<inboundProperties class="com.mirth.connect.plugins.datatypes.json.JSONDataTypeProperties" version="3.11.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.json.JSONBatchProperties" version="3.11.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</inboundProperties>
<outboundProperties class="com.mirth.connect.plugins.datatypes.json.JSONDataTypeProperties" version="3.11.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.json.JSONBatchProperties" version="3.11.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</outboundProperties>
</transformer>
<responseTransformer version="3.11.0">
<elements/>
<inboundDataType>JSON</inboundDataType>
<outboundDataType>JSON</outboundDataType>
<inboundProperties class="com.mirth.connect.plugins.datatypes.json.JSONDataTypeProperties" version="3.11.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.json.JSONBatchProperties" version="3.11.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</inboundProperties>
<outboundProperties class="com.mirth.connect.plugins.datatypes.json.JSONDataTypeProperties" version="3.11.0">
<batchProperties class="com.mirth.connect.plugins.datatypes.json.JSONBatchProperties" version="3.11.0">
<splitType>JavaScript</splitType>
<batchScript></batchScript>
</batchProperties>
</outboundProperties>
</responseTransformer>
<filter version="3.11.0">
<elements/>
</filter>
<transportName>JavaScript Writer</transportName>
<mode>DESTINATION</mode>
<enabled>true</enabled>
<waitForPrevious>true</waitForPrevious>
</connector>
</destinationConnectors>
<preprocessingScript>// Modify the message variable below to pre process data
return message;</preprocessingScript>
<postprocessingScript>// This script executes once after a message has been processed
// Responses returned from here will be stored as "Postprocessor" in the response map
return;</postprocessingScript>
<deployScript>// This script executes once when the channel is deployed
// You only have access to the globalMap and globalChannelMap here to persist data
return;</deployScript>
<undeployScript>// This script executes once when the channel is undeployed
// You only have access to the globalMap and globalChannelMap here to persist data
return;</undeployScript>
<properties version="3.11.0">
<clearGlobalChannelMap>true</clearGlobalChannelMap>
<messageStorageMode>DEVELOPMENT</messageStorageMode>
<encryptData>false</encryptData>
<removeContentOnCompletion>false</removeContentOnCompletion>
<removeOnlyFilteredOnCompletion>false</removeOnlyFilteredOnCompletion>
<removeAttachmentsOnCompletion>false</removeAttachmentsOnCompletion>
<initialState>STARTED</initialState>
<storeAttachments>true</storeAttachments>
<metaDataColumns>
<metaDataColumn>
<name>SOURCE</name>
<type>STRING</type>
<mappingName>mirth_source</mappingName>
</metaDataColumn>
<metaDataColumn>
<name>TYPE</name>
<type>STRING</type>
<mappingName>mirth_type</mappingName>
</metaDataColumn>
</metaDataColumns>
<attachmentProperties version="3.11.0">
<type>None</type>
<properties/>
</attachmentProperties>
<resourceIds class="linked-hash-map">
<entry>
<string>Default Resource</string>
<string>[Default Resource]</string>
</entry>
</resourceIds>
</properties>
<exportData>
<metadata>
<enabled>false</enabled>
<lastModified>
<time>1622488426575</time>
<timezone>America/Buenos_Aires</timezone>
</lastModified>
<pruningSettings>
<archiveEnabled>true</archiveEnabled>
</pruningSettings>
</metadata>
</exportData>
</channel>