annotate Resources/Samples/Lua/AutoroutingModification.lua @ 1295:50632b89e294

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Feb 2015 14:09:55 +0100
parents 23590917e83e
children f796207e3df1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1011
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 function OnStoredInstance(instanceId, tags, metadata)
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 -- Ignore the instances that result from a modification to avoid
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 -- infinite loops
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 if (metadata['ModifiedFrom'] == nil and
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 metadata['AnonymizedFrom'] == nil) then
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 -- The tags to be replaced
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 local replace = {}
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 replace['StationName'] = 'My Medical Device'
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 -- The tags to be removed
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 local remove = { 'MilitaryRank' }
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 -- Modify the instance, send it, then delete the modified instance
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 Delete(SendToModality(ModifyInstance(instanceId, replace, remove, true), 'sample'))
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 -- Delete the original instance
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 Delete(instanceId)
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 end
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 end