<?xml version='1.0'?>
<configuration>
  
  <perl-module name='ARDB::Plugin::Processing::ACIS_UD'/>
  
  <table name='acis.names'>
    <field name='id'      sql-type=' char(200) not null primary key '/>
    <field name='names'   sql-type=' text not null ' />
    
  </table>

  <table name='acis.records'>
  
    <field name='shortid' sql-type=' char(10) not null primary key '/>
    <field name='id'      sql-type=' char(200) not null '/>
    <field name='login'   sql-type=' char(100) not null ' />
    <field name='user_data_file'
                          sql-type=' char(200) not null ' />
                          
    <create-table-sql line=' index (login) '/>
    
  </table>

  <table name='acis.users'>
  
    <field name='login'    sql-type=' char(100) not null primary key ' />
    <field name='password' sql-type=' char(20) not null '/>
    <field name='user_data_file'
                           sql-type=' char(200) not null ' />
                          
  </table>
  
  <put-processing record-type='acis-user'>

    <store-to-table table='acis.users'>
      <field-attribute-mapping>
        <field-associations
          login='login' 
          password='password'
          user_data_file='FILENAME'/>
      </field-attribute-mapping>
    </store-to-table>
    
  </put-processing>

  <delete-processing record-type='acis-user'>
    <delete-from-table table='acis.users' by='login' />
  </delete-processing>

  <put-processing record-type='acis-record-person'>

    <call-perl-function name='ARDB::Plugin::Processing::ACIS_UD::generate_nameset'/>
    
    <store-to-table table='acis.names'>
      <field-attribute-mapping>
        <field-associations
          id='handle'
          names='nameset'/>
      </field-attribute-mapping>
    </store-to-table>
    
    <store-to-table table='acis.records'>
      <field-attribute-mapping>
        <field-associations
          shortid='short-id'
          id='handle'
          login='LOGIN' 
          user_data_file='FILENAME'/>
      </field-attribute-mapping>
    </store-to-table>
    
    <build-forward-relation 
      type="affiliated-with" 
      attributes="affiliations"
      />

  </put-processing>


  <delete-processing record-type='acis-record-person'>

    <delete-from-table table='acis.records' by='id' />
    <delete-from-table table='acis.names'   by='id' />

  </delete-processing>
  
</configuration>