Purpose of Application Element in Openbravo


Hi All,
           Application Element is one really cool feature in Openbravo, that I managed to get hold of after a while. But still I feel there is no special interest shown on application element till now. So I just wanted to share the importance and the influence of the application elements as it will cause lots of problems if not handled properly.

            Application Element is mainly used for Re-Usability. It will actually reduce lots of our development time when handled properly. Whenever we create a new column, the synchronize terminology process will create a new application element(if it doesn't have any element for the same column name). Thereafter whenever we create a new column with the same dbname, it will map the same application element for that column. Because of this mapping, we can manage the display name,help/comment, description globally. That is we need not go to each and every column and change the display name,help comment or description. It will be mapped globally to all columns that uses a particular column name. Web Service is one of the most important thing in openbravo. This web service will use the name which we provide as column name in column table.

             A good example could be, think of the column ad_client_id. We should use that field in all tables. Just think what will happen if we need to give the display name, help/comment and description manually for all the tables. Its not just tables, but windows too. As of now, we are not doing that because, we have the application element that is created already for the ad_client_id column that does all these things.All these are possible only when the required application element is in your module or in any module that your module depends on. This can be set in the dependency tab of the module window.

I have attached a screen shot where AD_Client column's name is updated to 'Client' and description and help comment are added by itself. I have also attached the Application Element from which these comments are taken from.









Handling Application Element Properly:

1. Always use the common notation for column names that represents same meaning.
ie., Always remember to check whether we have any column that already have the same name. If exists, use the already existing one.
Eg: If the requirement is to create a field to store begin date, we can give the column name as begin_date, bgn_dt,begin_dt,etc.,  But we already have the column used in many places as begin_date. So use that.
2. Always use the meaningful notation for representing column names.
Eg: Though most people can understand begin_date,begin_dt,bgn_dt,bgn_date represents begin date, begin_date makes more sense.
3. Consider, you added a new column that is not present in the system.
Eg: previous_month
For this column, when you give synchronize terminology, the application element will be created as, Previous_Month. It will displayed in the application element field in the columns as Previous_Month-Previous_Month.
1. Go to Application Dictionary -> Setup -> Element.
2. Search Previous_Month
3. Rename the Name field to Previous Month.
5. Give the description and Help/Comment
4. Rename the Name field to Previous Month in the column window also.
As you can see, you only need to rename the name field in column table. The help comment/Description would have been populated automatically.
Thereafter the same name will be used when ever the same column name is used.

                           In Openbravo, if we have wrong application element,  DAL related process, procedures, callouts, etc(EVERYTHING since openbravo is completely implementing DAL from 3.0), will not work. From a developer's perspective, none of our efforts in writing any code is going to work with improper application element. I just wanted to stress out the need for better care towards it.

                         Thanks to my Colleague Pandi to gather all these points and for stressing to me the need for Application Element that made me to write this blog..:)

Comments

Popular posts from this blog

Changing Timezone in Postgresql, Ubuntu

My 10 years in Application Development

Dissecting Openbravo 3.0 UI Architecture