Search Results

Search found 1 results on 1 pages for 'formseleven'.

Page 1/1 | 1 

  • Creating Custom validation rule and register it

    - by FormsEleven
    What is Validation Rule? A validation rule is a piece of code that performs some check ensuring that data meets given constraints.In an enterprise application development environment, often it might require developers to have validation be performed based on some logic at several places across projects. Instead of redundant validation creation, a custom validation rule provides a library with a validation rules that can be registered and used across applications.A custom Validation is encapsulated in a reusable component so that you do not have to write it every time when you need to do input validation. Here is how we can easily implement a custom validation that checks for name of an employee to be "KING" For creating a custom Validation , 1.         Create Generic Application Workspace "CustomValidator" with the project "Model" 2.         Create an BC4J based on emp table. 3.         Create a custom validation rule.In EmpNamerule class, update the validateValue(..) method as follows:  public boolean validateValue(Object value) { EntityImpl emp = (EntityImpl)value; if(emp.getAttribute("Ename").toString().equals("KING")){ return false; } return true; } Create ADF Library: Next step would be to create ADF library. Create ADF library with name lets say testADFLibrary1.jarRegister ADF Library Next step is to register the ADF library , so that its available across the applications. Invoke the menu "Tools -> Preferences"Select the option "Business Components -> Registered Rules" from left paneClick on button "Pick Library". The dialog "Select Library" comes up with  the user library addedAdd new library' that points to the above jarCheck the checkbox "Register" and set the name for the rule Sample UsageHere is how we can easily implement a validation rule that restrict the name of the employee not to be "KING".Create new Application with BC4J based on EMP table.Create new validation under Business rule tab for Ename & select the above custom validation rule.Run the AppModule tester.

    Read the article

1