Soft Delete


SQL Query : ALTER TABLE EMPLOYEES
ADD (DELETE_FLAG VARCHAR2(20) );


Environment: JDeveloper 11.1.1.6.0
Database: Oracle XE
Download svn Link

Running Sequence with groovy expression




Environment: JDeveloper 11.1.1.6.0
Database: Oracle XE
Download svn Link


1. Create model project from XE schema.





















2. Association between Department entity and Employee entity looks like below.
















3. Create a transient attribute (ChildMaxID) in Departments EO and give default vale as (Employees.max("EmployeeId") == null)? 1 : (Employees.max("EmployeeId") + 1). Employees is the association accessor name.














4. Open Employee EO and set value property of EmployeeId as Departments.ChildMaxId, Departments is the the association accessor name.













5. Run Business component tester.
















Environment: JDeveloper 11.1.1.6.0
Database: Oracle XE
Download svn Link

Access child table data inside parent table using groovy expression.


I have described how to populate parent table's date inside child table in my previous post. Same way we can access child data in parent table.

Create model project form XE schema.



























Open EmpDeptFkLink view link accessor and click edit accssors  icon on the top right corner of accessors scction.

















Change source accessor name and destination accessor name.























Generate View Row class for DepartmentsView and generate accessor methods also ( here Emp is my child accessor name and getEmp() is the accessor method in DepartmentsViewRowImpl.java).

Create java method for accessing child data.
   
public String getAllSalaries() {

        RowIterator rItr = getEmp(); 
        StringBuilder sb = new StringBuilder();
        while (rItr.hasNext()) {
            Row row = rItr.next();
            String sal =
                (row.getAttribute("Salary") != null) ? ((Number)row.getAttribute("Salary")).stringValue().trim() :
                null;

            if ((sb.length() > 0) && (sal != null)) {
                sb.append(", ");
            }
            sb.append(sal);
        }
        return sb.toString();
    }

Create a transient attribute called Salaries in Departments view object. Give default value as adf.object.allSalaries ( Grovy expression for accessing our custom method from View Row class ). adf.object points DepartmentsViewRowImpl object.

















Then run BC tester.















Environment : Jdeveloper 11.1.1.6.0
Database : Oracle XE
Download : Link

Access parent row data inside child table using Groovy expression.

Groovy script is the powerful scripting language and ADFBc has a good support with Groovy. Below article shows how to access parent row data in child table. Create model objects from the XE schema.




















Open the EmployeesView view object and go to structure panel.You can see all the view link accessors related to EmployeesView. 


Create a transient attribute called DeptName in EmployeesView and give the default value as groovy expression DepartmentsView.DepartmentName     ( <View_Link_Accessors_Name>.<Parent_Attribute_Name> ) .








Run the BC tester.

 


Environment : Jdeveloper 11.1.1.6.0
Database : Oracle XE
Download : Link