2 |
|
|
3 |
<mappings title="A first test"> |
<mappings title="A first test"> |
4 |
<sources> |
<sources> |
5 |
<datasource name="in" table="buch" database="gnue"/> |
<datasource name="in" table="book" database="gnue"/> |
6 |
<datasource name="out" table="buchneu" database="gnue"/> |
<datasource name="out" table="book_new" database="gnue"/> |
7 |
</sources> |
</sources> |
8 |
<mapping id="no" title="simple Mapping" source="in" destination="out"> |
<mapping name="start" source="in" destination="out"> |
9 |
<action type="copy"> |
<trigger type="PRE-ROW"> |
10 |
<field type="src" name="author"/> |
print "\n_____________________________________ (Trigger Pre-Row)" |
11 |
<field type="dest" name="author"/> |
# x=getField('author') |
12 |
</action> |
</trigger> |
13 |
<action type="merge" mergemask="@2 @1"> |
<action type="copy"> |
14 |
<field type="src" name="title"/> |
<field type="src" name="id"/> |
15 |
<field type="src" name="year"/> |
<field type="dest" name="id"/> |
16 |
<field type="dest" name="title"/> |
</action> |
17 |
</action> |
<action type="copy"> |
18 |
<action type="split" splitmask="(.*):(.*)"> |
<field type="src" name="author"/> |
19 |
<field type="src" name="year"/> |
<field type="dest" name="author"/> |
20 |
<field type="dest" name="year"/> |
</action> |
21 |
<field type="dest" name="year"/> |
<action type="copy"> |
22 |
</action> |
<field type="src" name="title"/> |
23 |
<trigger type="PRE-ROW"> |
<field type="dest" name="title"/> |
24 |
print "PRE-ROW" |
</action> |
25 |
# print getField('author') |
<action type="merge" mergemask="@2: @1 @3"> |
26 |
|
<field type="src" name="title"/> |
27 |
|
<field type="src" name="author"/> |
28 |
|
<field type="src" name="entry"/> |
29 |
|
<field type="dest" name="fullentry"/> |
30 |
|
</action> |
31 |
|
<action type="split" splitmask="^([^:]*):[^,]*,[ ]*([0123456789]*)"> |
32 |
|
<trigger type="ON-FAIL"> |
33 |
|
setField('publisher','unknown') |
34 |
</trigger> |
</trigger> |
35 |
<trigger type="POST-ROW"> |
<field type="src" name="entry"/> |
36 |
print "POST-ROW" |
<field type="dest" name="publisher"/> |
37 |
# print getField("author") |
<field type="dest" name="year"/> |
38 |
# setField("year","200") |
</action> |
39 |
</trigger> |
<action type="split" splitmask="(.*) ISBN (.*)"> |
40 |
|
<trigger type="ON-FAIL"> |
41 |
|
print "Trigger On-Fail: Entry has no ISBN field. Setting ISBN to 'unknown'." |
42 |
|
setField('isbn','unknown') |
43 |
|
</trigger> |
44 |
|
<field type="src" name="entry"/> |
45 |
|
<field type="dest" name="isbn"/> |
46 |
|
<field type="dest" name="isbn"/> |
47 |
|
<trigger type="POST-ACTION"> |
48 |
|
print 'Trigger Post-Action: Entry has ISBN field.' |
49 |
|
</trigger> |
50 |
|
</action> |
51 |
|
<trigger type="POST-ROW"> |
52 |
|
print 'Processed Record of author %s' % getField("author") |
53 |
|
print "------------------------------------- (Trigger Post-Row)" |
54 |
|
</trigger> |
55 |
</mapping> |
</mapping> |
56 |
<mapping title="XXX" id="ar" source="in" destination="out"> |
|
57 |
<submapping> |
<!-- # submappings still have to be defined |
58 |
|
<mapping name="XXX" id="ar" source="in" destination="out"> |
59 |
|
<submapping name='first'> |
60 |
</submapping> |
</submapping> |
61 |
</mapping> |
</mapping> |
62 |
|
--> |
63 |
</mappings> |
</mappings> |