Hi,

I resolved my "view -> parent table" problems.
I had think about a "general solution"; the best one could be a pluggable events 
system.

Here's why:
to switch between my view and the related table to obtain a successfull delete 
operation (choose the record from the view, delete it from its original table)*, 
I modified the DeleteEvent class.
The modification I did is (IMHO) too much related to the application I'm 
developing, so I cannot return a contribution back to the dbforms community.

The best thing to do (IMHO) is to provide a system where a developer can write 
its own event classes and then configure dbforms to:

a) set up the default event classes
b) override those settings for a particular table

For example, the configuration file of the Jakarta Struts framework defines
a set of global forward elements that can be used by all the defined actions.
Any action can define its forward elements, and those elements can ovverride the 
elements defined into the global-forwards section.

So, the dbforms-config file could be extended in this manner:

-------------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1" ?>

<dbforms-config>

  <date-format>dd/MM/yyyy</date-format>

  <!-- table configuration -->
  <table name="MYTABLE1">
    <field name="MYID" fieldType="int" size="8" isKey="true"/>
    ...

    <!-- the related interceptor -->
    <interceptor className = "my.interceptors.MyInterceptorClass"/>

    <!-- custom events used by this table -->
    <events>
      <!-- override the insert event using my own class -->
      <event type="insert" class="my.events.CustomInsertEvent" />
    </events>
  </table>

  <!-- this table will use the default event classes -->
  <table name="MYTABLE2">
    <field name="MYID2" fieldType="int" size="8" isKey="true"/>
    ...
  </table>

  ...

  <!--
     -  default event classes
     -
     -  see org.dbforms.event.EventEngine class src
     -  for the list of supported events
     -->
  <events>
    <event type="insert" class="org.dbforms.event.InsertEvent" />
    <event type="delete" class="org.dbforms.event.DeleteEvent" />
    ...
  </events>


  <!--
     -   well, the preview of the configuration of
     -   [multiple connection + connectionProvider]
     -   system
     -->
  <dbconnection
    id                      = "jakarta-commons-dbcp"
    isJndi                  = "false"
    isPow2                 = "true"
    defaultConnection       = "true"
    connectionProviderClass = "com.pow2.dao.JakartaConnectionProvider"
    connectionPoolURL       = ""
    conClass                = "org.postgresql.Driver"
    name                    = "jdbc:postgresql://myhost/mydb?charSet=ISO-8859-1"
    username                = "postgres"
    password                = ""/>

</dbforms-config>

-------------------------------------------------------


[*]
At the moment I'm using Postgresql, and it's possible to define rules
to get "updatable views". But to do that, postgresql uses its own non sql-92 
extensions...



Any comment ?

Thank you,
Luca



-------------------------------------------------------
This sf.net email is sponsored by: viaVerio will pay you up to
$1,000 for every account that you consolidate with us.
http://ad.doubleclick.net/clk;4749864;7604308;v?
http://www.viaverio.com/consolidator/osdn.cfm
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to