Hi all,

In core there has always been some utility classes, the main one 
org.openbravo.erpCommon.utility.Utility, with generic methods to be used 
in the servlets. Since 2.50 and the introduction of DAL it has increased 
the necessity of new methods based on this new technology.

During the last months I've seen how the same methods have been applied 
on different modules that I think should be in core.

These are some examples of methods that could be in core:

* A method that given a String it parses to return a java.util.Date 
object. With xsql this wasn't necessary as we needed strings to build 
the queries, but now using OBCriteria we need a java.util.Date object to 
filter by dates so the need to parse the String with the Dates has 
increased a lot.

* A method that given a class and a current value id it returns a String 
with the options html code, or a FieldProvider with the data to fill 
dependent combos. BPDebtConsolidation, mass advanced payments, mass 
invoicing and so on have different methods to build combos using lists 
instead of using ComboTableData. We should centralize them and make 
these modules to use them.

* This one is maybe not a good example, but it is happening, a method 
that given a OBObject class and a string with its id returns the 
corresponding object. This can be currently done with: 
"OBDal.getInstance().get(class, strId)". In recent modules we are 
building a dao class where we do all the DAL accesses. This is, if we 
have a String with an invoice id we are creating a getInvoice method in 
the dao class to get the Invoice object with the 
"OBDal.getInstance().get(Invoice.class, strInvoiceId)" code. In the last 
module that I've developed I've created a more generic method with the 
OBObject class as a parameter.

* A method that given a List with OBObjects it returns a String with the 
ids separated by commas. Currently we work with List objects, but if we 
have to create a OBQuery with an IN clause we have to convert them to a 
String.

And I'm sure that are much more examples. I can provide the code of the 
mentioned methods if needed.

As a side issue, it is almost impossible to know the currently available 
methods. Most of them are included in the mentioned Utility class 
without a specific order and there are other classes with useful 
methods. We should reorder them in different classes with friendly names 
and include the API somewhere in the wiki so it is easier to developers 
to know if it is available.

Regards
Gorka Ion

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Openbravo-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-development

Reply via email to