Doco Home Tools Home

Platypus Tools - DODS and Database Issues

DODS

As at Enhydra 2.2.1, Platypus tools require modifications to the the Enhydra/DODS system. These changes are primarily based upon the DODS types system. See the changes file for details on the patch archive available.

The DODS changes are used by both Squirt and Billabong. The stub code created by Squirt references the modified DODS generated code, while Billabong refers to the new type information in DODS.

Database Issues

Billabong generates code to create Pulldowns for the presentation layer. In the application base class, Billabong creates commented code that refers to a Pulldown table. This table can be used to hold static pulldown items in the system that might be used on one or more pages. The values of these pulldowns can then remain consistent across all pages in the application.

The table, whose Java name should be Pulldown, should be created using DODS as:

create table t_pulldown {
  Name VARCHAR(255) DEFAULT '' NOT NULL,
  Value VARCHAR(255) DEFAULT '' NOT NULL,
  DisplayName VARCHAR(255) DEFAULT '' NOT NULL,
  IsDefaultValue BOOLEAN DEFAULT FALSE NOT NULL,
  Position SMALLINT DEFAULT 0 NOT NULL,
  ObjectId DECIMAL(19,0) NOT NULL PRIMARY KEY,
  ObjectVersion INTEGER NOT NULL
 };

The field meanings are:

  • Name - The name of this Pulldown
  • Value - This is put in the VALUE part of the OPTION tag
  • DisplayValue - This is what the user sees
  • IsDefaultValue - True if this item is normally the default value
  • Position - If you want to force an order to the items, set this field to the item's relative position
  • When items are retrieved from this table, the order of results in based on ascending Position, then ascending DisplayValue.

    The following code is generated commented out by Billabong:

       // get the static pulldown
        PulldownDO[] pulldownDOs = pulldownBO.getPulldownDOs(pulldown_name);
    
        // any results?
        if (pulldownDOs == null || pulldownDOs.length == 0) {
    
          // no - get out of here
          return null;
    
        }
    
        // go through results and put them into the result array
        PulldownItem[] pi = new PulldownItem[pulldownDOs.length];
    
        try {
    
          for (int i=0; i
    

    The code creates the pulldown items from values in the table and stores the results in its cache. The cache is referred to first before re-running this code to get any previously setup items. The PulldownItem class can be found in src/production.

    Two more things are required for the pulldowns to work. You must create the DO section for the Pulldown table before running Billabong. See the documentation on the DO config for details on creating the section for the Pulldown table.

    The final thing to do is the create the QUERY section for the Pulldown query and run Squirt to get the stub code generated. The QUERY section required is:

    QUERY.getPulldownDOs.DO = Pulldown
    QUERY.getPulldownDOs.PARAMETERS[] = Name
    QUERY.getPulldownDOs.PARAMTYPES[] = String
    QUERY.getPulldownDOs.TYPE = EASY
    QUERY.getPulldownDOs.ORDERBY[] = Position, DisplayValue
    

    Put the code generated by Squirt into the PulldownBO class. Uncomment the code created by Billabong and you now have access to static pulldowns.