admin' Post

HOW TO PERFORM DEBUGGING IN ENTERPRISE 2.0 – WEB UI

Debugging allows you to run a program interactively while watching the source code and the variables during the execution.

By breakpoints in the source code you specify where the execution of the program should stop. To stop the execution only if a field is read or modified, you can specify watchpoints .

Breakpoints and watch points can be summarized as stop points.

Once the program is stopped you can investigate variables, change their content, etc.

[divider]

Now once the environment is set up in Adempiere we need to start the Product in Debug Mode of Desktop UI. In order to do that you must follow the following steps:-

  • Right Click on the Project and select the Debug As and Debug on Server which has Tomcat already selected.

image001

  • When we have entered the Debug Mode, the First Class that comes up is Adempiere Class.
  • In Case of WEB UI it goes to Web UI Servlet.java which is the class for zk Web UI
  • Then the Login Page Opens Up, now in Order to debug we need to apply debug points which signify that the compiler needs to stop here while processing the code and wait for the user confirmation such that the code stops at that point.
  • We can Apply Debug points by double clicking on the code such that the Debug Point is created and once in Debug Mode the compiler will stop there.
  • Eclipse provides buttons in the toolbar for controlling the execution of the program you are debugging. Typically it is easier to use the corresponding keys to control this execution.
  • You can use the F5, F6, F7 and F8 key to step through your coding. The meaning of these keys is explained in the following table.

 

Table 1. Debugging key bindings / shortcuts

Key Description
F5 Executes the currently selected line and goes to the next line in your program. If the selected line is a method call the debugger steps into the associated code.
F6 F6 steps over the call, i.e. it executes a method without stepping into it in the debugger.
F7 F7 steps out to the caller of the currently executed method. This finishes the execution of the current method and returns to the caller of this method.
F8 F8 tells the Eclipse debugger to resume the execution of the program code until is reaches the next breakpoint or watch point.
  • The following picture displays the buttons and their related keyboard shortcuts.

image003

 

  • The call stack shows the parts of the program which are currently executed and how they relate to each other. The current stack is displayed in the Debug view.

image004

  • Changing variable assignments in the debugger

The Variables view allows you to change the values assigned to your variable at runtime. This is depicted in the following screenshot.

image006

  • Now when we enter in Debugging Mode some classes need to be remembered in order to debug the code. For Instance we need to start with the Generic Class
  • Start by applying debug mode in the Web UI Servlet.java Class in the Init() such that the compiler stops in the method and Debug Mode is present.
  • Once in the class u can use F5, F6, F7 and F8 key to step through your coding and go through the flow.

 

For Different Processes and Windows we need to have multiple processes or classes such that when we need to Debug the process we call that Class.

The index for such is as Follows:-

Class in Eclipse Process
MInOut.javaMInOutLine.java Material Receipt, Shipment(Customer), Vendor Return, Customer Return,
MOrder.javaMOrderLine.java Purchase Order  &  Sales Order,
MInvoice.javaMInvoiceLine.java

MInvoiceTax.java

Invoice (Vendor) and Customer (Invoice) 

For Calculating Invoice Tax.

BPartner.java Business Partner in Adempiere
ALogin.java Login Class For Adempiere  such that while in case of change of login page or anything else in Login
AMenu.java To change the Menu Entries we need to change the class when we need to add entry in the Adempiere ERP.
WCreateFromWindow.java To make Menus in WEBUI and add buttons.
WCreateBatchSerialInoutLine.javaWCreateInventorySerialInOutLine.java Create batches in WebUI and edit and add CodeCreate Inventory Batches in Physical Inv and Internal Use Inventory
AbstractADWindowPanel.java Debug this Class for adding buttons and defining where buttons go on click.
Product.java To Add Products such and define parameters in it.
MInventory.javaMInventoryLine.java Inventory Management such that,  Inventory and line Qty are Managed
MRMALine.java Processing Returns such that , both Customer RMA and Vendor RMA are created here.
MPayment.javaMPaymentAllocate.java To Process Payments,  and to Allocate Payments to the InvoicesAllocate Payments , to the Invoices

 

  • If u need to debug these Processes u need to Apply Debug Points in the respective classes such that to change code there.
  • If u need to search any class in Eclipse u need to use the combination of Ctrl+Shift+T and enter the class name.
  • Use * with the name to increase your search criteria.
  • If u need to skip Debug points u can use the Button on the top of eclipse which looks like this    image008
  • Until unless u release this button the Debug won’t work.
  • Some Classes here as different from Desktop UI such that, in batch module in case of Desktop we have VCreateBatchSerialInOutLine.java while in case of Window we have WCreateBatchSerialInOutLine.java due to difference of frameworks.

 

 

-By Adempiere Support {India Portal}

Read More

WORKING WITH JASPER REPORTS –(IREPORT 5.0.1)

Jasper Report is an open source java reporting engine, is Java based and doesn’t have its own expression syntax.

As JasperReports is a Java class library, and is not meant for end users, but rather is targeted towards Java developers , hence we use IReport for users who need to add reporting capabilities to their applications.

[divider]

Report Definition file structure (jrxml):-

Jasper design file –jrxml- contains the following elements:
<jasperReport>: the root element.
<title>: its contents are printed only once at the beginning of the report
<pageHeader> – its contents are printed at the beginning of every page in the report.
<detail> – contains the body of the report, repeated by n number of results
<pageFooter> – its contents are printed at the bottom of every page in the report.
<band> – defines a report section, all of the above elements contain a band element as its only child element.

[divider]

Only the root element is mandatory, the rest of elements are optional.

JasperReport works in a way similar to a compiler and an interpreter. See fig. 3.1. The user design a report coding it in XML in agreement to tags and attributes defined in a file called jasperreports.dtd (part of JasperReports). Using XML a user define the entire report, describing where place texts, images, lines, rectangles, how to retrive data, how to make certain calculations to show subtotals, etc…

image001

 

Fig.3.1: How JasperReports works.

This XML source file must be compiled in order to produce a real report. The compiled version of the source is named “jasper file” (it ends with .jasper). A jasper file is a compiled report source.
When we have a jasper file, we need another thing in order to produce a report: we need data. This is not always true. In some cases We could want to generate a report that don’t shows dynamic data, but i.e. only static text, but this can be reduced to a report that has only an empty record. To supply this records to the jasper engine we need to present it using a special jasperreports specific interface named JRDataSource. A datasource + a jasper file = a print. A print can then be exported in many formats like PDF, HTML, XML, XLS, CVS, etc… The export will be done using special classes the implement specific exporters. 

 

3.2 Compilation end export of reports
For a newbie, design and create the jasper file is the hardest work. When you have designed and compiled your jasper file, you can use the JasperReport library to dinamycally fill your report in several enviroments like a web application (using i.e. java servlet, but I have succesfully used JasperReports for generating PDF reports calling it from a PHP script…).
Jasper make available a special viewer to display a report preview, designed for swing based traditional java applications.

image003

Fig.3.2: JasperReports can easily integrated in a Web application as in a java swing based program.

3.3 Our first very simple report
iReport provide to jasper reports users a visual interface to build reports, generate jasper files and test prints. iReport born as development tool, but it can be used as an office tool to retrieve and print data stored in a database, without pass through another application.

image004

Fig.3.3: How JasperReports works.

iReport can read and modify both jasper XML and jasper files. Trought jasperreports, it’s able to compile XML to jasper files and “run reports” to fill it using several types of JRDataSource and export the result to PDF,HTML,XLS,CSV,…

 [divider]

Points to Note in Different Types of Jasper Reports :-

  1. All fields need to be inside the band in which it is defined such that no field or label is observed with a red triangle on it. In such case report will not get compiled.
  2. Do take care of the band in Jasper Report such that Page Footer repeats on every Page while summary comes only on the end of  the report.
  3.  SQL Queries used in the IReport must be first tested on the SQL Server edition or any 3rd party Application and query shouldn’t be straight forward feeded to report.
  4. SQL Query copied in IReport should be free of Commented Code and semicolons as these will lead to non compilation of query.
  5. Just enter the column name in System Element and press Enter, the System will automatically correct the case of the name and copy this name to your report parameter.
  6. Do not give spaces in Report Name or in Parameters, as this will lead to Process Error null, or Could not find Report Error at runtime.
  7. While using Parameters in SQL in IReport, make sure while using like operator , insert “!” in the Parameter before the name.
  8. While working with subreports, provide a path which is dynamic such that when u change the location of the report the subreport doesn’t stops functioning

-Try Providing the path of WAR file such that , when u need to change u just need to change the Address of Server in the same format as defined in Report and Process

If the need of ever hiding the Parameters Arises, i.e. hardcoding them from the front, u can follow the changes and the parameter wont be displayed on running of report.

image006

  • Make the name of Parameter Blank by Just inserting a space in the name or Add the name and use Display logic
  • In the Display Logic Field, add a check of the Parameter which can not be null like Organization which will hide the field too.
  • Organization or any parameter will be used with ‘=’ sign in Display Logic and ‘is null wont work in Enterprise version’.
  • Using the current modification we can segregate many reports into one and just place a single jrxml file in the WAR and create multiple menus or even a single menu and use list parameter in it.

 [divider]

  1. CROSSTAB REPORTS
    • The crosstab must be placed in Summary Only as then only the report will Compile, Placing the Report in any other band will lead to error.
    • In case of report while getting Sub Totals and Grand Totals , just add the variable in the crosstab and change the Calculation Type to  ‘ Sum ’
    • While Creating Crosstab if all the variables are not added, we need to add them later once the crosstab is created by adding them in measures section.
    • Once added in Measures Section we just need to drag and drop the fields in the report such that it automatically gets arranged.

 

 

 

                                                                                                                                                                                                       -By Adempiere Support {India Portal}

Read More

Featured (Untitled)

Welcome to ADempiere, a commons-based peer-production of Open Source ERP Applications. This Forum is for the global community to contribute and share know-how and domain expertise. We hope you can find as much open information and participate in making it most usable for everyone. This project has a bazaar of Citizens with a Community Council Team which work in the Functional Team and Technical Team along the Software Development Procedure supported and funded by the foundation ADempiere e.V..

Read More

Featured ADempiere

ADempiere, iDempiere and Open Source ERP are quite possibly the biggest discontinuous changes and enablers for producing business efficiency and insight. ADempiere and iDempiere are not for everyone; however, if it is right for your organization, you will see the world in a more meaningful way.

The purpose of this page is to help you determine if ADempiere is right for you. Enjoy! Please provide feedback if we can make this page better in any way!

Read More

HOW TO PERFORM DEBUGGING IN ENTERPRISE 2.0 – DESKTOP UI

Debugging allows you to run a program interactively while watching the source code and the variables during the execution.

By breakpoints in the source code you specify where the execution of the program should stop. To stop the execution only if a field is read or modified, you can specify watchpoints .

Breakpoints and watchpoints can be summarized as stop points.

Once the program is stopped you can investigate variables, change their content, etc.

[divider]

Now Once the environment is set up in Adempiere we need to Start the Product in Debug Mode of Desktop UI. In order to do that you must follow the following steps:-

image001

  • Click on the Debug Mode and select the Debug Configuration already made by us at time of setting up Desktop Environment.
  • When we have entered the Debug Mode, the First Class that comes up is Adempiere Class.
  • Then the Login Page Opens Up, now in Order to Debug we need to apply debug points which signify that the compiler needs to stop here while processing the code and wait for the user confirmation such that the code stops at that point.
  • We can Apply Debug points by double clicking on the code such that the Debug Point is created and once in Debug Mode the compiler will stop there.
  • Eclipse provides buttons in the toolbar for controlling the execution of the program you are debugging. Typically it is easier to use the corresponding keys to control this execution.
  • You can use the F5, F6, F7 and F8 key to step through your coding. The meaning of these keys is explained in the following table.

 [divider]

 

Table 1. Debugging key bindings / shortcuts

Key Description
F5 Executes the currently selected line and goes to the next line in your program. If the selected line is a method call the debugger steps into the associated code.
F6 F6 steps over the call, i.e. it executes a method without stepping into it in the debugger.
F7 F7 steps out to the caller of the currently executed method. This finishes the execution of the current method and returns to the caller of this method.
F8 F8 tells the Eclipse debugger to resume the execution of the program code until is reaches the next breakpoint or watch point.
  • The following picture displays the buttons and their related keyboard shortcuts.

image003

  • The call stack shows the parts of the program which are currently executed and how they relate to each other. The current stack is displayed in the Debug view .

image004

  • Changing variable assignments in the debugger

The Variables view allows you to change the values assigned to your variable at runtime. This is depicted in the following screenshot.

image006

  • Now when we enter in Debugging Mode some classes need to be remembered in order to debug the code. For Instance we need to start with the Generic Class
  • Start by applying debug mode in the ALogin.JAVA Class in the jbInit() such that the compiler stops in the method and Debug Mode is present.
  • Once in the class u can use F5, F6, F7 and F8 key to step through your coding and go through the flow.

 

For Different Processes and Windows we need to have multiple processes or classes such that when we need to Debug the process we call that Class.

The index for such is as Follows:-

Class in Eclipse Process
MInOut.java

MInOutLine.java

Material Receipt, Shipment(Customer), Vendor Return, Customer Return,
MOrder.java

MOrderLine.java

Purchase Order  &  Sales Order,
MInvoice.java

MInvoiceLine.java

MInvoiceTax.java

Invoice (Vendor) and Customer (Invoice)

For Calculating Invoice Tax.

BPartner.java Business Partner in Adempiere
ALogin.java Login Class For Adempiere  such that while in case of change of login page or anything else in Login
AMenu.java To change the Menu Entries we need to change the class when we need to add entry in the Adempiere ERP.
Product.java To Add Products such and define parameters in it.
VCreateBatchSeraialInOutLine.java

VCreateInventorySerialInOutLine.java

Create Batches in Adempiere, and edit the features in Batch Management
MInventory.java

MInventoryLine.java

Inventory Management such that,  Inventory and line Qty are Managed
MRMALine.java Processing Returns such that , both Customer RMA and Vendor RMA are created here.
MPayment.java

MpaymentAllocate.java

To Process Payments,  and to Allocate Payments to the Invoices

 

  • If u need to debug these Processes u need to Apply Debug Points in the respective classes such that to change code there.
  • If u need to search any class in Eclipse u need to use the combination of Ctrl+Shift+T and enter the class name.
  • Use * with the name to increase your search criteria.
  • If u need to skip Debug points u can use the Button on the top of eclipse which looks like thisimage008
  • Until unless u release this button the Debug Won’t work.

 

 

 

-By Adempiere Support {India Portal}

Read More

ADEMPIERE – INSTALLING TOMCAT SERVER FOR DEBUGGING OF WEB UI IN ECLIPSE

Files Needed:

  1. Apache Tomcat 6.0.41 (Or Any Version)
  2. Eclipse – IDE for Java EE Developers
  3. System Browser

[divider]

Process:-

  1. Install Tomcat Runtimes
    1. First, you need to install a Tomcat runtime for the deploying and running of the zk Web Client. Use Tomcat 5.5+
    2. To install a new Tomcat runtime, open the preferences dialog Window->Preferences and select the Server->Installed Runtimes. Use the Search button to locate your tomcat installation home folder.

image001

  1. Define a New Server

At the Servers view, right click to open the context menu and select New->Server.

If server view is not visible then you can use Window→Show View→Others … to open it. 

 image003

  1. Select the correct server type and the server runtime you have setup earlier.

image005

  1. Add your project to the server instance to be created

  image007

  1. The created server instance is now ready for use. Just Start the server once and then stop it. Do not try to debug it at this moment.

  image009

  1. Define location of ADempiere property file (NotePad File …available in your base folder )and ADempiere home (Place where your code is kept)

 

Now you have to define the location of your existing working ‘Adempiere.properties’ file and ADEMPIERE_HOME as system parameter for your Tomcat Instance. To do so, select Run->Open Run Dialog… and select the server instance you have created.

 

 

Note that the entries for your server instance in the Run dialog will only be created after you have start it for at least one time. Select the arguments tab and append your property file path and home parameter at the end of VM arguments.

It is highlighted in the pictures below:

 image011

 

  1. In Run Config Add in it in the same series, do not change the series.

Go to classpath section at user entries add external libs from tomcatlib (or tomcatserverlib) than add project – AdempiereTrunk

Apache jars needs to be at the first place in the classpath. See the image carefully along with the description below.

 

  • Bootstrap Entries
  • JRE Library
  • User Entries
  • tomcat_dir/bin/*.jar
  • tomcat_dir/server/lib/*.jar
  • E2 Project or Trunk
  • Adempiere Libraries i.e. add jasperreport 5.6.0 jar, if not available download, it from Internet

 image013

  1. Now Run in Debug Mode, by Right Clicking on the  Project and selecting Run in Debug Mode
  2. Choose the Browser such that, the browser can be used internal or External Browser.
  3. In case Run of the Project in WebUI, right Click on the project and select run project on Web Server.
  4. Your Version will then open in Debug Mode and in order to learn debugging do follow the next document on Debugging.

[divider]

DO REMEMBER

  1. If u need to change the Database of the WebUI you can do by Changing in the Adempire Properties File , just replace the Username and Password.
  2. Run Configuration is not created till u once start and stop the server.
  3. If your Build is getting failed , observe the errors completely such that you should know which WEB classes are interacting with Desktop Classes and separate them.

 

 

-By Adempiere Support {India Portal}

Read More

CREATING DEVELOPMENT ENVIRONMENT IN ECLIPSE (Desktop VERSION)

  1. Debugging the client version is pretty straightforward and quick. In this recipe, we will see how to configure the project in Eclipse so that we can debug ADempiere when we run it as a client application (the Swing version).

 [divider]

Getting ready

  1. Before we can run ADempiere, there are properties, specific to ADempiere, which need to be configured properly for example, JDK location detail, application server detail, database detail, SMTP detail (for e-mails), and so on. The following steps must be completed to ensure that these properties are set up correctly:

[divider]

Tools Needed:

  1. Eclipse – IDE for Java EE Developers
  2. Working Internet Connection( For download of Source Code)

[divider]

Process:-

  1. Download the Source Code of the latest E2 build.
  2. Once you have the Source Code, add in eclipse in the ‘New Project window’ in the Java Project menu.

image1

 

 

  1. Create a new Java project and define the fields as Follows:-

image2

 

  1. Enter the Project name and uncheck the use default location and enter the path of your source code here.
  2. Once done click on Finish and you will notice the E2 code will be started adding to the Eclipse.
  3. Once that’s done we need to create Run configuration for the E2 project such that the main class of project is defined here.

image4

  1. Enter Project name in the name and in main class enter the main class of Adempiere i.e. org.compiere.Adempiere.
  2. Click OK and run the Run Configuration.
  3. You can run in Debug Mode also by selecting the Debug Option from the top.

image3

 

  1. For Further Debugging we can refer to the “How to Perform Debugging in Desktop UI” and take a complete look at the Debugging and as to what can we further do in it.

 

 

 

 

-By Adempiere Support {India Portal}

 

 

Read More