Moved nested #includes out of osrf_prefork.h and into the implementation files.
[OpenSRF.git] / examples / gen-fieldmapper.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <fieldmapper
3         xmlns="http://opensrf.org/xmlns/opensrf"
4         xmlns:cdbi="http://opensrf.org/xmlns/opensrf/cdbi"
5         xmlns:database="http://opensrf.org/xmlns/opensrf/database"
6         xmlns:perl="http://opensrf.org/xmlns/opensrf/perl"
7         xmlns:javascript="http://opensrf.org/xmlns/opensrf/javascript"
8         xmlns:c="http://opensrf.org/xmlns/opensrf/c">
9
10         <classes>
11                 <!-- template class definition -->
12                 <!--
13                 <class
14                         id=""
15                         perl:class=""
16                         cdbi:class=""
17                         javascript:class="">
18         
19                         <database:table rdbms="Pg">
20                                 <database:name></database:name>
21                                 <database:sequence></database:sequence>
22                         </database:table>
23                         <database:table rdbms="MySQL">
24                                 <database:name></database:name>
25                         </database:table>
26         
27                         <javascript:superclass>Fieldmapper</javascript:superclass>
28                         <perl:superclass>Fieldmapper</perl:superclass>
29                         <cdbi:superclass>OpenILS::Storage::CDBI</cdbi:superclass>
30                         
31                         <fields>
32                                 <field name="" datatype="" database:primary="" database:required="" default="" database:default=""/>
33                         </fields>
34                         
35                         <links>
36                                 <link field="" source="" javascript:list="" type=""/>
37                         </links>
38         
39                 </class>
40                 -->
41         
42                 <class
43                         id="asvr"
44                         virtual="0"
45                         perl:class="Fieldmapper::action::survey_response"
46                         cdbi:class="action::survey_response"
47                         javascript:class="asvr"
48                         c:class="asvr">
49                         <database:table rdbms="Pg">
50                                 <database:name>action.survey_response</database:name>
51                                 <database:sequence>action.survey_response_id_seq</database:sequence>
52                         </database:table>
53                         <database:table rdbms="MySQL">
54                                 <database:name>action_survey_response</database:name>
55                         </database:table>
56         
57                         <javascript:superclass>Fieldmapper</javascript:superclass>
58                         <perl:superclass>Fieldmapper</perl:superclass>
59                         <cdbi:superclass>OpenILS::Storage::CDBI</cdbi:superclass>
60                         
61                         <fields>
62                                 <field
63                                         name="id"
64                                         datatype="int"
65                                         database:primary="true" />
66                                         
67                                 <field
68                                         name="survey"
69                                         datatype="int"
70                                         database:required="true" />
71
72                                 <field
73                                         name="question"
74                                         datatype="int"
75                                         database:required="true" />
76
77                                 <field
78                                         name="answer"
79                                         datatype="int"
80                                         database:required="true" />
81
82                                 <field
83                                         name="usr"
84                                         datatype="int"
85                                         database:required="true" />
86
87                                 <field
88                                         name="response_group_id"
89                                         datatype="int"
90                                         database:required="true" />
91
92                                 <field
93                                         name="answser_date"
94                                         datatype="timestamp"
95                                         database:required="true" />
96
97                                 <field
98                                         name="effective_date"
99                                         datatype="timestamp"
100                                         database:required="true" />
101
102                         </fields>
103
104                         <links>
105                                 <link field="survey" source="asv" type="has_a"/>
106                                 <link field="question" source="asvq" type="has_a"/>
107                                 <link field="answer" source="asva" type="has_a"/>
108                                 <!-- <link field="usr" source="au" type="has_a"/> -->
109                         </links>
110
111                 </class>
112
113                 <class
114                         id="asvq"
115                         perl:class="Fieldmapper::action::survey_question"
116                         cdbi:class="action::survey_question"
117                         javascript:class="asvq"
118                         c:class="asvq">
119                         <database:table rdbms="Pg">
120                                 <database:name>action.survey_question</database:name>
121                                 <database:sequence>action.survey_question_id_seq</database:sequence>
122                         </database:table>
123                         <database:table rdbms="MySQL">
124                                 <database:name>action_survey_question</database:name>
125                         </database:table>
126         
127                         <javascript:superclass>Fieldmapper</javascript:superclass>
128                         <perl:superclass>Fieldmapper</perl:superclass>
129                         <cdbi:superclass>OpenILS::Storage::CDBI</cdbi:superclass>
130                         
131                         <fields>
132                                 <field
133                                         name="id"
134                                         datatype="int"
135                                         database:primary="true" />
136                                         
137                                 <field
138                                         name="survey"
139                                         datatype="int"
140                                         database:required="true" />
141
142                                 <field
143                                         name="question"
144                                         datatype="text"
145                                         database:required="true" />
146
147                         </fields>
148
149                         <links>
150                                 <link field="survey" source="asv" type="has_a"/>
151                                 <link field="answers" source="asva" type="has_many"/>
152                         </links>
153                 </class>
154
155                 <class
156                         id="asva"
157                         perl:class="Fieldmapper::action::survey_answer"
158                         cdbi:class="action::survey_answer"
159                         javascript:class="asva"
160                         c:class="asva">
161                         <database:table rdbms="Pg">
162                                 <database:name>action.survey_answer</database:name>
163                                 <database:sequence>action.survey_answer_id_seq</database:sequence>
164                         </database:table>
165                         <database:table rdbms="MySQL">
166                                 <database:name>action_survey_answer</database:name>
167                         </database:table>
168         
169                         <javascript:superclass>Fieldmapper</javascript:superclass>
170                         <perl:superclass>Fieldmapper</perl:superclass>
171                         <cdbi:superclass>OpenILS::Storage::CDBI</cdbi:superclass>
172                         
173                         <fields>
174                                 <field
175                                         name="id"
176                                         datatype="int"
177                                         database:primary="true" />
178                                         
179                                 <field
180                                         name="question"
181                                         datatype="int"
182                                         database:required="true" />
183
184                                 <field
185                                         name="answer"
186                                         datatype="text"
187                                         database:required="true" />
188
189                         </fields>
190
191                         <links>
192                                 <link field="question" source="asvq" type="has_a"/>
193                                 <link field="responses" source="asvr" type="has_many"/>
194                         </links>
195                 </class>
196
197                 <class
198                         id="aou"
199                         perl:class="Fieldmapper::actor::org_unit"
200                         cdbi:class="actor::org_unit"
201                         javascript:class="aou"
202                         c:class="aou">
203                         <database:table rdbms="Pg">
204                                 <database:name>actor.org_unit</database:name>
205                                 <database:sequence>actor.org_unit_id_seq</database:sequence>
206                         </database:table>
207                         <database:table rdbms="MySQL">
208                                 <database:name>actor_org_unit</database:name>
209                         </database:table>
210         
211                         <javascript:superclass>Fieldmapper</javascript:superclass>
212                         <perl:superclass>Fieldmapper</perl:superclass>
213                         <cdbi:superclass>OpenILS::Storage::CDBI</cdbi:superclass>
214                         
215                         <fields>
216                                 <field
217                                         name="id"
218                                         datatype="int"
219                                         database:primary="true" />
220                         </fields>
221                 </class>
222         
223                 <!-- Survey class definition -->
224                 <class
225                         id="asv"
226                         perl:class="Fieldmapper::action::survey"
227                         cdbi:class="action::survey"
228                         javascript:class="asv"
229                         c:class="asv">
230                         <database:table rdbms="Pg">
231                                 <database:name>action.survey</database:name>
232                                 <database:sequence>action.survey_id_seq</database:sequence>
233                         </database:table>
234                         <database:table rdbms="MySQL">
235                                 <database:name>action_survey</database:name>
236                         </database:table>
237         
238                         <javascript:superclass>Fieldmapper</javascript:superclass>
239                         <perl:superclass>Fieldmapper</perl:superclass>
240                         <cdbi:superclass>OpenILS::Storage::CDBI</cdbi:superclass>
241
242                         <methods interface='authenticated' service='open-ils.proxy'>
243                                 <create method='open-ils.storage.direct.action.survey.create'/>
244                                 <retrieve method='open-ils.storage.direct.action.survey.retrieve'/>
245                                 <search method='open-ils.storage.direct.action.survey.search'/>
246                                 <update method='open-ils.storage.direct.action.survey.update'/>
247                                 <delete method='open-ils.storage.direct.action.survey.delete'/>
248                         </methods>
249                         
250                         <methods interface='trusted' service='open-ils.storage'>
251                                 <create method='open-ils.storage.direct.action.survey.create'/>
252                                 <retrieve method='open-ils.storage.direct.action.survey.retrieve'/>
253                                 <search method='open-ils.storage.direct.action.survey.search'/>
254                                 <update method='open-ils.storage.direct.action.survey.update'/>
255                                 <delete method='open-ils.storage.direct.action.survey.delete'/>
256                         </methods>
257                         
258                         <fields>
259                                 <field
260                                         name="id"
261                                         datatype="int"
262                                         database:primary="true" />
263                                         
264                                 <field
265                                         name="name"
266                                         datatype="text"
267                                         database:required="true" />
268                                         
269                                 <field
270                                         name="description"
271                                         datatype="text"
272                                         database:required="true" />
273                                         
274                                 <field
275                                         name="owner"
276                                         datatype="int"
277                                         database:required="true" />
278                                         
279                                 <field
280                                         name="start_date"
281                                         datatype="timestamp"
282                                         database:required="true"
283                                         database:default="now()" />
284                                         
285                                 <field
286                                         name="end_date"
287                                         datatype="timestamp"
288                                         database:required="true"
289                                         database:default="now() + '1 month'" />
290                                         
291                                 <field
292                                         name="usr_summary"
293                                         datatype="bool"
294                                         database:required="true"
295                                         default="t" />
296                                         
297                                 <field
298                                         name="opac"
299                                         datatype="bool"
300                                         database:required="true"
301                                         default="f" />
302                                         
303                                 <field
304                                         name="poll"
305                                         datatype="bool"
306                                         database:required="true"
307                                         default="f" />
308
309                                 <field
310                                         name="required"
311                                         datatype="bool"
312                                         database:required="true"
313                                         default="f" />
314
315                         </fields>
316         
317                         <links>
318                                 <link field="questions" source="asvq" type="has_many"/>
319                                 <link field="responses" source="asvr" type="has_many"/>
320                                 <link field="owner" source="aou" type="has_a"/>
321                         </links>
322         
323                 </class>
324
325         </classes>
326 </fieldmapper>
327