Search code examples
openbravo

Writing own method in openbravo's java class


For Openbravo's custom Initial Data Load they have given a class by which we can extend and write code to upload other custom columns.

myclass extends IdlServiceJava in that some method's are used which are of different class eg:- validator.checkNotNull(validator.checkString(values[2], 255), "JournalHeader"); which are of Validator.java

what i did is like checkNotNull() method i made my own (methodcheckCostCenter()) in Validator.java

I ran is successfully and also got wanted results but when i pack this module to install it on other Openbravo instance for testing it is giving me following error.

Bottom of error log:-

compileSqlc:
[javac] Compiling 4 source files to /opt/OpenbravoERP-3.0/openbravo-erp/build/classes
[javac]  /opt/OpenbravoERP-3.0/openbravo-erp/modules/in.pispl.idl.journal.costcentre/src/in/pispl/idl/journal/costcentre/ad_process/JournalEntriesProcessCostCentre.java:96:  cannot find symbol
[javac] symbol  : method checkCostCenter(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)
[javac] location: class org.openbravo.idl.proc.Validator
[javac]     validator.checkCostCenter(values[4], 4, ELEMENTTYPE_ACCOUNT, values[7]/* accTschema */,
[javac]              ^
[javac] Note:  /opt/OpenbravoERP-3.0/openbravo-erp/modules/in.pispl.idl.journal.costcentre/src/in/pispl/idl/journal/costcentre/ad_process/JournalEntriesProcessCostCentre.java  uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error




Any solution for this ?
Why it gave me error ?  

Solution

  • Do not add any methods to Validator.java as it does not get shipped inside package(openbravo - custom-your-module.obx)..

    Instead what you can do is , you can copy the whole Validator.java class to your module package and add your custom methods also inside of it.. In that way, when you install obx in another instance , you can get this working..

    Hope this helps !..