Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For running the java event make an entry <classpath type="jar" location="build/lib/*"/> in ofbiz-component.xml file.

ECA(Event Condition Action): 

...

Don't forget to restart the server after this implementation.

Creating new entity:

 For the creation of new entity you can again take a referecne from example component for this you can have a look in entitymodel.xml file of example component. You can create new entities by following these steps:

Step - 1 : Create a new subdirectory by name entitydef in hot-deploy/practice/.

Step - 2 : Create new file by name  entitymodel.xml. This file will contain the defintions of entities which you want to define.

Step - 3 : For loading the defintion you need to do an entry in your ofbiz-component.xml file like:

Code Block

    <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>


           That implies that when ever you do a change you need to restart the server to have those changes in effect.

At this place an important reading is at http://docs.ofbiz.org/display/OFBTECH/General+Entity+Overview.

You will rarely find this way to define new entity because you are already having entities there in OFBiz already defined which will be useful for the conduction of your business process. Though you may feel at some place to add more fields to an existing entity so how can you do that? The next  step will show you the way how you can extend an entity for your customized needs.

Earlier we used to have one more file in same directory by name entitygroup.xml which not needed any more because code is checked in to the trunk for this.

Extending an existing entity:

Yes you can extend an existing entity for adding more fields to for your custom needs. This can be done in following way:

Step - 1 :  For extending an entity use

Code Block

    <extend-entity entity-name="">
        <field name="" type=""/>
    </extend-entity>


This is the simplest form it can be more complex. This will add up one more field to the entity you already have. Now it depends which field you want for your custom needs. Here you can also defined relation of this field with other entities you want. But before doing this you should search extesively may be you will be adding a field for a purpose and there is already a field which will serve the purpose, so be concisous about this. Also go for a extensive study of data model then do this.
 

For entity engine configuration dont forget to read : Entity Engine Configuration Guide
 

Conclusion:

If you have followed all the steps and developed practice application from this application then this will really help you in understanding other implementations in OFBiz. These things are basic foundation of working in OFBiz. Now you know that how you can start the development in OFBiz. Don't leave the extra links provided in this tutorial as they will really help you a lot in understanding the things which are there. Parallaly with the development of this application you can watch OFBiz videos which are available at Framework Introduction Videos.

...