<!--
  -
  - "-//AIS.PL//DTD Mapping Description 0.4//EN"
  - "http://www.ais.pl/dtds/mapping_0_4.dtd"
  -
  - Warlock, last modified on 2002.04.23
  -
  - base 0.4 version created on 2002.03.04
  -
  - Changes since base 0.4 version:
  - 2002.03.07, probably Warlock:
  -             'where' attribute for 'sql-query' changed from required to 
  -             implied
  - 2002.04.11, probably Warlock: 
  -             'order-by' and 'distinct' attributes for 'sql-query' added
  - 2002.??.??, Pikus:
  -             'insert', 'select' and 'update' attributes added for 'sql-table'
  -             element
  - 2002.05.16, Warlock:
  -             BigDecimal added to allowed_java_types entity
  - 2002.05.23, pikus
  -             onInsert attribute added to sql-field definition
  - 2002.07.08, Milosz
  -             removed plus signs from
  -             <!ELEMENT select (sql-query+, java-method+)>
  - 2002.11.??  wswiatek
  -             Array support
  - 2002.11.29, Milosz
  -             'delete', 'update' elements added to 'operations',
  -             'select+' changed to '(select | ...)*'
  - 2002.12.02, Milosz
  -             'set' attribute added to 'sql-query'
  - 2002.12.03, Milosz
  -             'count' element added to 'operations'
  - 2003.05.19, Milosz
  -             'columns' attribute added to 'sql-query'
  -             'returnType' attribute added to 'java-method'
  -             'aggregate' element added to 'operations'
  - 2003.05.28, Milosz
  -             'from' attribute added to 'sql-query'
  - 2003.06.03, Milosz
  -             'multipleRows' attribute added to 'select'
  - 2003.09.08, Milosz
  -             'body' attribute added to 'sql-query'
  -             'call' element added to 'operations'
  -             'call-params' element added to 'call'
  -             'call-param' element added to 'call-params'
  - 2003.09.15, Milosz
  -             'propertyChangeSupport' attribute added to 'java-class'
  - 2004.07.02, Milosz
  -             'group-by', 'having' and 'other' attributes added to 'sql-query'
  - 2004.12.17  maciejk
  -             Blob support
  -             
  -->

<!ENTITY % allowed_java_types "BigDecimal|Double|Float|Integer|Long|String|Timestamp|Array|Blob">
<!ENTITY % boolean_value "false|true">
<!ENTITY % access_types  "in|out|inout">

<!ELEMENT database (structure+)>

<!ELEMENT structure (sql-table, java-class, fields, operations?)>

<!ATTLIST structure 
          name      CDATA #REQUIRED>

<!ELEMENT sql-table EMPTY>
<!ATTLIST sql-table 
          name      CDATA #REQUIRED
          insert    (%boolean_value;) 'true'
          select    (%boolean_value;) 'true'
          delete    (%boolean_value;) 'true'
          update    (%boolean_value;) 'true'>

<!ELEMENT java-class EMPTY>
<!ATTLIST java-class 
          name                  CDATA #REQUIRED
          propertyChangeSupport (%boolean_value;) 'false'>

<!ELEMENT fields (field+)>

<!ELEMENT field (sql-field, java-field)>
<!ATTLIST field 
          name       CDATA #REQUIRED
          notNull    (%boolean_value;) #REQUIRED
          primaryKey (%boolean_value;) #REQUIRED>

<!ELEMENT sql-field EMPTY>
<!ATTLIST sql-field 
          default   CDATA #IMPLIED
          name      CDATA #REQUIRED
          type      CDATA #REQUIRED
          onInsert  (use|omit) 'use'>

<!ELEMENT java-field EMPTY>
<!ATTLIST java-field 
          default    CDATA #IMPLIED
          name       CDATA #REQUIRED
          type       (%allowed_java_types;) #REQUIRED>

<!ELEMENT operations (aggregate | call | count | delete | select | update)*>

<!ELEMENT aggregate  (sql-query, java-method)>
<!ATTLIST aggregate 
          multipleRows (%boolean_value;) 'false'>

<!ELEMENT call   (sql-query, java-method, call-params)>
<!ELEMENT count  (sql-query, java-method)>
<!ELEMENT delete (sql-query, java-method)>
<!ELEMENT select (sql-query, java-method)>
<!ATTLIST select 
          multipleRows (%boolean_value;) 'true'>

<!ELEMENT update (sql-query, java-method)>

<!ELEMENT sql-query EMPTY>
<!ATTLIST sql-query 
          distinct  (%boolean_value;) 'false'
          columns   CDATA #IMPLIED
          from      CDATA #IMPLIED
          where     CDATA #IMPLIED
          group-by  CDATA #IMPLIED
          having    CDATA #IMPLIED
          order-by  CDATA #IMPLIED
          other     CDATA #IMPLIED
          set       CDATA #IMPLIED
          body      CDATA #IMPLIED>

<!ELEMENT java-method (java-param*)>
<!ATTLIST java-method 
          name        CDATA #REQUIRED
          returnType  CDATA #IMPLIED>

<!ELEMENT java-param EMPTY>
<!ATTLIST java-param 
          name       CDATA #REQUIRED
          type       (%allowed_java_types;) #REQUIRED>

<!ELEMENT call-params (call-param*)>

<!ELEMENT call-param EMPTY>
<!ATTLIST call-param 
          accessType (%access_types;)       'in'
          fieldRef   CDATA                  #IMPLIED
          methodRef  CDATA                  #IMPLIED
          type       (%allowed_java_types;) #IMPLIED>


