Versions Compared

Key

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

...

Written by: Pranay Pandey with feedback and contributions from Chirag Manocha, Ravindra Mandre, Rob Schapper
 Special thanks to Anil Patel and Mridul Pathak for inspiring me to write this tutorial.

...

Note - 1 :- For any additional query queries and concern concerns you can refer 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, this will help you in future developments as well.
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.

...




Refer to the "CommonScreens.xml" file in the "Example" component to see usage of main-decorator.  Two important readings at this moment are Understanding the OFBiz Widget Toolkit and "The Decorator" section in FAQ.
Step - 2 : Create a menu for this application. For this create a file by name PracticeMenus.xml in "widget" directory of you component. For this take a reference from ExampleMenus.xml file of "example" component.

...




Step - 3: Include this UI Label resource in your main decorator screen which you created earlier and use these one or two ui labels which you are having now.Step - 4 : Use those 2 UI labels at appropriate places.
Note : Always search first for any existing Ui label in ofbiz and if you don't find it there then only create new one.Output Screen:

Now its time to make this practice application secure by checking authentication (user login):

...




7.b : Create some Ui labels for showing them in fail-property like PracticeFirstNameMissingError.
7.c : Now call service createPracticePerson service by passing out map which is obtained after processing fields as a in map to the service.
OutPut Screen :

Part - 4

Java Event:

...




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 :

 

 Group Service:

    Group services are used to call more then one services as a group. Service groups are a set of services which should run when calling the initial service. You define a service using the group service engine, and include all the parameters/attributes needed for all the services in the group. The location attribute is not needed for groupservices, the invoke attribute defines the name of the group to run. When this service is invoked the group is called and the services defined in the group are called as defined.
For mor details on this visit :  http://docs.ofbiz.org/display/OFBTECH/Service+Engine+Guide
For the implementation of Group service follow these steps: 
Step - 1 : Add another menu item to applicatoin menu bar by name "Group Service".(Do the needful entries for target in controller.xml)
Step - 2 : Now create new screen and a form for creation of the person because the target for the form will be the group service which we will be defining.
Note : Now the time is to define the group service. We will be defining the group service for the services which we have implemented for this practice application.
Step - 3 : You will be defining the service group in services.xml file.(Take reference from services.xml of party component).
Just write one more service which will be setting the role "CLIENT" for the party which will be created by createPracticePerson Service. 
 Create a group service by name "partyGroup" like :

...