Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected some typos and grammar for clarity.

...

You can watch OFBiz videos, which are available at Framework Introduction Videos, in parallel with the development of this application.

Part - 1

Note - 1 :- For any additional query and concern you can consult to Example component. You will always find the code in example component to be the latest code of OFBiz. Take reference whenever you want to see some sample code for the development of this application.
Every new feature is first added in the Example component for the references.
Note - 2 : Before starting the development of this application you must read the contents from:
http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practiceshttp://docs.ofbiz.org/display/OFBADMIN/Coding+Conventions and http://docs.ofbiz.org/display/OFBADMIN/Best+Practices+Guide
Note - 3 : Don't copy any file from other component, as the revision number for the file is also copied. Always create a new file and, if required, then copy the contents of the file." Also be conscious about the unused code as well.
Note - 4 : For searching any of the document the best place is at : http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Documentation+Index .
Note - 5 : Right from the beginning, reading the console log must be a habit to make troubleshooting easy and understanding the system well.

...

ECA(Event Condition Action): 

ECA : Its It is a combinition of 3 things: an event, conditions per event, and Actions actions per event. It is a rule . Which is used to trigger an action on upon the execution of an event when certain conditions are met
This is much like a trigger. When a service is called , a for example a lookup is performed to see if any ECAs are defined for this event. Events include before authentication, before IN parameter validation, before actual service invocation, before OUT parameter validation, before transaction commit, or before the service returns. Next, each condition in the ECA definition is evaluated and if all come back as true, each action is performed. An action is just a service which must be defined to work with the parameters already in the service's context. There are There is no limit to the number of conditions or actions each ECA may define.
For mor more details on this visit :  http://docs.ofbiz.org/display/OFBTECH/Service+Engine+Guide
1. SECA (Service Event Condition Action) : This is used when we want to trigger another service(action) on the execution of a service when certain conditions are met.
2. EECA (Entity Event Condition Action) : This is used when we want to trigger a service on the creation of a record for an entity when certain conditions are met.
For the implementation of ECA again we will be following the same approach for screens, menus by following steps:
Step - 1 : Add one more application menu in practice menu named "ECA" to the practice application's menu bar by name "ECA".(Do the needful entries for target in controller.xml)
Step - 2 : Now create another menu with two menu item in called "EcaMenu" in the PracticeMenus.xml file by name "EcaMenu". This menu will be having 2 menu Item one will be by name have two menu items named "seca" and "eeca". For both of them 2 For each of these, two screens will be needed which will be using the form needed that use the "CreatePerson" form which we are already havingcreated above. (in personForm screen)

Code Block
<menu name="EcaMenu" default-menu-item-name="seca" default-selected-style="selected"
       type="simple" menu-container-style="button-bar button-style-2" selected-menuitem-context-field-name="headerItem">
      <menu-item name="seca" title="Create Person --- SECA">
          <link target="seca"/>
      </menu-item>
      <menu-item name="eeca" title="Create Person --- EECA">
          <link target="eeca"/>
      </menu-item>   
</menu>

...


Don't forget to restart the server after doing this entry.
Now run the service through form and check the records in PartyRole entity. You will find a role is set for the party created because synchrounously you have triggered a service by eeca rule for setting up the role for the party created.
The main difference here is that you are triggering a service when an operation is performed on the entity. In our case it is "create".
Note Here you have created a saparate menu to understand the concept separately. As you written seca for the service "createPracticePerson", so where ever in your practice application you will be calling this service that seca will trigger "createPartyRoleVisitor" and on the other hand when a party will be created "createPartyRoleCustomer" will be triggered.
Output Screen :

...