View source | View content page | Page history | Printable version   

Projects:Reference Extension/Technical Documentation


Data Reference Interface

Openbravo ERP is composed by different systems, each of them makes use of data references in different ways. Below it is specified for each system the usage that is done for references, therefore which is the interface extensible references should implement to be able to interact with these systems.


The DAL has a class: Reference and other Ref* classes in the same package which are used to feed the runtime model with type information.


  public abstract class ReferenceLogic {
    public enum BaseType { PRIMITIVE, FOREIGN_KEY, ENUMERATION }  
    Class getPrimitiveType(String idRef);
    Column getFK (String idRef, Column col);
    Set<Object> getEnumerateValues();
    void setReferenceId(String refId);
    String getReferenceId();
    BaseType getBaseType();


Open discussion items

Closed discussion items


General WAD Refactoring

The following refactoring is applicable to all components in WAD.

Action Button


In case we decide not to include, by the moment, combo realoads for new references no refactoring would be needed.

Tab Java

    boolean isNumericType();
    boolean has2UIFields();
    boolean is2ndUIFieldCalculated();

Currently there's some hardcoded logic for YesNo reference (id 20), this would be kept as it is now.


The following cases are used for generating the SQL queries.

  String columnIdentifier(ConnectionProvider conn, String tableName,
      boolean required, FieldsData fields, Vector<String> vecCounters, boolean translated,
      Vector<String> vecFields, Vector<String> vecTable, Vector<Object> vecWhere,
      Vector<String> vecParameters, Vector<String> vecTableParameters, String sqlDateFormat);
  String getDefaultValueXSQL();

Tab Edition HTML

  String getDisplayedValueFieldName();

Use the getActualValueFieldName method to obtain the first field focused.

Tab Edition XML


No new interface nor refactoring would be needed in this case.

Grid View

DataGrid class:

The following reference uses are done by TableSQLData and ModelSQLGeneration classes. They are used as utility classes by the grid view, but they are also used from WAD generated windows.


  boolean isNumericType();
  DecimalFormat numericTypeFormat();
  boolean has2UIFields();
  void setReferenceQuery();
  String formatField();
  String getGridType();
  String formatFilter(String tablename, String columnname, boolean first);
  boolean filterDefinesRange();


Filter pop-up

It is the pop-up that is opened when the filter icon is clicked in the toolbar, it retrieves the fields that are used when the filter is generated by ModelSQLGenartion class. It is implemented by the Buscador class.


  String getFilterDefaultValue();
  String getFilterHTML();


In Buscador class.

Linked items

Implemented by UsedByLink class.

Open discussion items

Direct Navigation

Implemented by ReferencedLink and ReferencedTables classes. WAD generates the link which invokes ReferencedLink servlet, in this link it is included the table to navigate to.

In ReferencedLink reference is used just for special cases (Debt Payments).




Use numericTypeFormat method defined in grid.

Implementation general details

Java classes

There are 3 different interfaces (abstract classes) to implement:

Model and UI-RunTime can be implemented as regular classes within src module's directory. But WAD-BuildTime, because of the current dependencies cannot be under this directory. For this case it is needed to allow modules to extend src-wad directory, these classes will be compiled and packaged into openbravo-wad.jar by the wad.lib ant task.

AD Model

AD_Reference table is where references are defined, it will require the addition of the following columns:

General Open Discussion Items

Combo Reloads

Combo reloads are used to automatically reload combo options for combos depending on other fields. They are used in WAD window, in WAD generated parameter windows for report and processes and in filter pop-up. Combo reloads are generated for fields with combo references (TableDir, Table and List) that have a Validation Rule. And are triggered whenever the value of one of the fields participating in the validation rule is changed. Because of this definition validation rules can only be associated to columns using one of the 3 references mentioned above.

Now the question is whether we should allow new references to make use of validation rules, and therefore force them to implement an interface to generate combo reloads; or if combo reloads cannot be used within new references limiting them to the pre-defined ones.

Standalone references

Now it is possible to call directly from menu to the pop-up defined in the Search references. This makes search references usable without associating it to a column in a table. Currently this is the only reference that can be used in this way.

Should we allow to create new references that are callable directly from menu?

Retrieved from ""

This page has been accessed 8,570 times. This page was last modified on 8 June 2012, at 05:30. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.