User:Mjeg15
From ADempiere ERP Wiki
(Difference between revisions)
(→Extending the iDempiere-Web Server) |
(→Setting up iDempiere workspace) |
||
| Line 64: | Line 64: | ||
osgi> start (some_number). | osgi> start (some_number). | ||
*The bundle should now be working, and to see if it does type in ss into the console to see the list of bundles. | *The bundle should now be working, and to see if it does type in ss into the console to see the list of bundles. | ||
| + | |||
| + | ===== Modifying existing models through Eclipse===== | ||
| + | ----- | ||
| + | *This is where I will be trying to modify existing models. And I will be using MRequisition as an example. | ||
| + | *First is to copy the MRequisition class on the new plug-in and add update as you require. | ||
| + | *Go to the MANIFEST.MF of the plug-in project. | ||
| + | *Go to the Dependencies and add required plug-ins. (e.g. org.adempiere.base) | ||
| + | *Go to the Overview Tab and click on the Extensions Link. This will enable the hidden extensions tab to appear. | ||
| + | *Go to the Extensions tab and add the extension org.adempiere.base.IModelFactory | ||
| + | *Right click on the newly created extension, go to new and create a new factory. | ||
| + | *Add a priority which is greater than 0. | ||
| + | [[File:Extension_Point_Mjeg15.jpg]] | ||
| + | *Go to the class link of the Extension Point Details to create a new class. | ||
| + | *Once created a class with the following codes should appear | ||
| + | package org.idempiere.base; | ||
| + | |||
| + | import java.sql.ResultSet; | ||
| + | |||
| + | import org.adempiere.base.IModelFactory; | ||
| + | import org.compiere.model.PO; | ||
| + | |||
| + | public class ExampleModelFactory implements IModelFactory { | ||
| + | |||
| + | public ExampleModelFactory() { | ||
| + | // TODO Auto-generated constructor stub | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public Class<?> getClass(String tableName) { | ||
| + | // TODO Auto-generated method stub | ||
| + | return null; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public PO getPO(String tableName, int Record_ID, String trxName) { | ||
| + | // TODO Auto-generated method stub | ||
| + | return null; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public PO getPO(String tableName, ResultSet rs, String trxName) { | ||
| + | // TODO Auto-generated method stub | ||
| + | return null; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | *To make use of your own MRequisition class here is an example. (Credits to [[User:Hengsin|Low Heng Sin]] for the example) | ||
| + | public Class<?> getClass (String tableName) { | ||
| + | if ("M_Requisition".equals(tableName)) { | ||
| + | return com.abc.model.MRequisition.class; | ||
| + | } else { | ||
| + | return null; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | |||
| + | public PO getPO (String tableName, int Record_ID, String trxName) { | ||
| + | if ("M_Requisition".equals(tableName)) { | ||
| + | return new com.abc.model.MRequisition(Env.getCtx(), Record_ID, trxName); | ||
| + | } else { | ||
| + | return null; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | ===== References ===== | ||
| + | ---- | ||
| + | *[http://kenai.com/projects/hengsin/pages/Building Kenai Workspace Setup] | ||
| + | *[http://www.adempiere.com/OSGI_HengSin Hengsin OSGI Project] | ||
| + | *[http://www.globalqss.com/wiki/index.php/IDempiere globalqss Workspace and Database Setup] | ||
| + | *[http://www.adempiere.com/Equinox_Integration_2/Tutorial_Plugin Equinox Integration Tutorial Plugin] | ||
| + | *[http://kenai.com/projects/hengsin/pages/ExtensionPointReference Hengsin Extension Point Reference] | ||
==== Setting up Eclipse Workspace Adempiere OpenBravo POS ==== | ==== Setting up Eclipse Workspace Adempiere OpenBravo POS ==== | ||
Revision as of 06:21, 23 February 2012
|
Contents |
About Me...
Hello Everyone! I am Michael, or you can call me Mikesz for short. :) I'm an Adempiere developer who is currently working in Makati, Philippines. I am currently known as Redhuan's apprentice here in the company and I will be documenting the things that I discover and as I go along with Adempiere. I hope this can be of help to anyone.
My Notes
- Currently Using Eclipse Indigo 3.7.1
- Operating System: OpenSUSE 11.4 64 Bit
Setting up iDempiere workspace
Followed the following manuals:
- When I was following this [Kenai Workspace Setup] I have encountered this error, during import using the Buckminster plugin of Eclipse:
ERROR [0001] : No suitable provider for component org.adempiere.sdk:eclipse.feature was found in resourceMap file:/home/mike/Desktop/Adempiere-Kenai-Hengsin-Dev/hengsin~development/org.adempiere.sdk-feature/adempiere.rmap
ERROR [0001] : No suitable provider for component org.adempiere.sdk:eclipse.feature was found in searchPath workspace.bundle.project
ERROR [0001] : Rejecting provider local({0}/{1}[/home/mike/workspace/idempiere/org.adempiere.sdk]): Components of type eclipse.feature are not supported
ERROR [0001] : No suitable provider for component org.adempiere.sdk:eclipse.feature was found in searchPath workspace.feature.project
ERROR [0001] : Resolution attempt ended with exception: Provider local(/home/mike/workspace/idempiere/org.adempiere.sdk-feature): Missing CSpec source required by component type eclipse.feature
ERROR Provider local(/home/mike/workspace/idempiere/org.adempiere.sdk-feature): Missing CSpec source required by component type eclipse.feature
- I had all the pre-requisites before this occurred and the solution for this was that the workspace project that I checked out isn't the workspace that I am currently using. I must use the workspace that I checked out, and make it the default workspace for it to work.
- When doing the final step of the tutorial, which is when running the install.app from the run configurations, there were validation errors thus preventing me from proceeding.
- This was solved by going into the configurations of the install.app, going into the plug-ins tab and pressing Add Required Plug-ins button. Then I was able to proceed to running.
- Another Error that I have encountered during the final stages of the setup was that when I was logging in as GardenAdmin the following error occured: nulljava.lang.ClassNotFoundException: org.eevolution.model.LiberoValidator global - This was because the database that I used was from the adempiere360. I was able to fix this using the database from this link. The database is inside the ExpDatOSGI.zip
Creating a new plug-in project and testing through eclipse
- Follow the manual on how to create plug-in project.
- On the MANIFEST.MF of the plug-in created, go to the Dependencies tab and add the necessary plug-ins to be able to use the classes of a separate project.
- Might also need to add on the MANIFEST.MF tab the following line: Eclipse-RegisterBuddy: org.adempiere.base. So far from my tests, this line must be included.
- Go to debug or run configurations and choose swingclient.product (server.product) for server, go into the Plug-ins tab and check the project that you will be testing and adding default values for the Start Level and Auto-Start columns, the clicking Apply. When running the idempiere, the plug-ins added will also be running.
Extending the iDempiere-Web Server
I am not yet very familiar on how p2 works, but on this section, I will show how I add a new bundle plug-in into iDempiere.
- For organization of plugins to install, first we must create a dropins folder (or any other name, I just chose dropins because I am currently attempting to try on how to make use of dropins folder of equinox) on the root folder of our iDempiere installation (e.g. $IDEMPIERE_INSTALL_HOME/adempiere_server/dropins). This folder is where we will be storing the plug-in bundles that we create. Please look into this on how to create and export bundles.
- After adding a new plug-in go to $IDEMPIERE_INSTALL_HOME/adempiere_server/configuration/org.eclipse.equinox.simpleconfigurator/ and edit the bundles.info
- After opening the bundles.info we can not add a new line for our new bundle, add the new line in this format:
- ($project_name),($version_name),dropins/($file_name).jar,4,false (e.g. org.idempiere.extend.callout,1.0.0.201202101334,dropins/org.idempiere.ioss.extend_1.0.0.201202101334.jar,4,false)
- NOTE: For idempiere client side, the next steps are no longer necessary, just restart the client to make it work.
- After adding the file into the bundles.info, we now have two options on installing the plugin.
- First is when the server is not running. We can just setup iDempiere again through setup.sh and the plug-in should install right away.
- The other is installing it via osgi console when the server is running. Just input the following commands:
osgi> install file:$IDEMPIERE_INSTALL_HOME/adempiere_server/dropins/(file_name).jar
- An output something like Bundle id is (some_number) should appear. Then input the following command
osgi> start (some_number).
- The bundle should now be working, and to see if it does type in ss into the console to see the list of bundles.
Modifying existing models through Eclipse
- This is where I will be trying to modify existing models. And I will be using MRequisition as an example.
- First is to copy the MRequisition class on the new plug-in and add update as you require.
- Go to the MANIFEST.MF of the plug-in project.
- Go to the Dependencies and add required plug-ins. (e.g. org.adempiere.base)
- Go to the Overview Tab and click on the Extensions Link. This will enable the hidden extensions tab to appear.
- Go to the Extensions tab and add the extension org.adempiere.base.IModelFactory
- Right click on the newly created extension, go to new and create a new factory.
- Add a priority which is greater than 0.
- Go to the class link of the Extension Point Details to create a new class.
- Once created a class with the following codes should appear
package org.idempiere.base;
import java.sql.ResultSet;
import org.adempiere.base.IModelFactory;
import org.compiere.model.PO;
public class ExampleModelFactory implements IModelFactory {
public ExampleModelFactory() {
// TODO Auto-generated constructor stub
}
@Override
public Class<?> getClass(String tableName) {
// TODO Auto-generated method stub
return null;
}
@Override
public PO getPO(String tableName, int Record_ID, String trxName) {
// TODO Auto-generated method stub
return null;
}
@Override
public PO getPO(String tableName, ResultSet rs, String trxName) {
// TODO Auto-generated method stub
return null;
}
}
- To make use of your own MRequisition class here is an example. (Credits to Low Heng Sin for the example)
public Class<?> getClass (String tableName) {
if ("M_Requisition".equals(tableName)) {
return com.abc.model.MRequisition.class;
} else {
return null;
}
}
public PO getPO (String tableName, int Record_ID, String trxName) {
if ("M_Requisition".equals(tableName)) {
return new com.abc.model.MRequisition(Env.getCtx(), Record_ID, trxName);
} else {
return null;
}
}
References
- Kenai Workspace Setup
- Hengsin OSGI Project
- globalqss Workspace and Database Setup
- Equinox Integration Tutorial Plugin
- Hengsin Extension Point Reference
Setting up Eclipse Workspace Adempiere OpenBravo POS
Plugins Needed for Eclipse - MercurialEclipse
- Cloning the project using eclipse (adempiere361)
- Create a new workspace.
- On you new and empty workspace go 'File' and 'Import'
- On the import window choose the 'Mercurial Folder' and choose the 'Clone Existing Mercurial Repository' from the menu.
- On the clone repository window in the 'URL' field. Paste the following: http://adempiere.hg.sourceforge.net:8000/hgroot/adempiere/adempiere361, name the Clone directory name as you wish and then press Next and wait for it to clone. Might take a while depending on the connection. The following is the screenshot on the clone repository window:


