POJO(Plain Old Java Object) - Editable Data - DataControl.dcx

POJO(Plain Old Java Object) - Editable Data - DataControl.dcx  

  • Without using EO’s & VO’s we can create a UIPage with Java Class.

  • First we need to create a Java Classes name it as a Entity Java Classes (i,.e. DepartmentsEO, EmployeesEO, LocationsEO.)

  • Then Again create another three java classes for storing data in Department List Java class, Employee list, Location List.

  • Below image for Creating Java classes. 

  • End of the Page have a ZIP file 


  • This JAVA class for creating list of Data (Dept list, Emplye list, location list)

  • Now we have to create Another Java class for calling the All the above created java classes(This Java Class Act like APPMODULE) Name it as Session Façade.

  • After Creating Session Façade Java Class. Just Right click on the java class, in that options select the Create Data Control.
    CREATING DATA CONTROL


    After Creating Data control, All the java classes automatically created .XML files .
  • Java Code for DepartmentsEO,  EmployeesEO, LocationsEO.
  • public class Departments implements Serializable {
        private Long departmentId;
        private String departmentName;
        private Long managerId;
        private Long locationId;
        private List<Employees> employees = null;
        EmployeesList employeesList = null;
        boolean entityStateChanged = false;

        public Departments() {

        }

        public Departments(Long _departmentId, String _departmentName,
                           Long _managerId, Long _locationId, EmployeesList list) {
            departmentId = _departmentId;
            departmentName = _departmentName;
            managerId = _managerId;
            locationId = _locationId;
            employeesList = list;
        }

        public void setDepartmentId(Long _departmentId) {
            setEntityStateChanged(true);
            this.departmentId = _departmentId;
        }

        public Long getDepartmentId() {
            return departmentId;
        }

        public void setDepartmentName(String _departmentName) {
            setEntityStateChanged(true);
            this.departmentName = _departmentName;
        }

        public String getDepartmentName() {
            return departmentName;
        }

        public void setManagerId(Long _managerId) {
            setEntityStateChanged(true);
            this.managerId = _managerId;
        }

        public Long getManagerId() {
            return managerId;
        }

        public void setLocationId(Long _locationId) {
            setEntityStateChanged(true);
            this.locationId = _locationId;
        }

        public Long getLocationId() {
            return locationId;
        }

        public List<Employees> getEmployees() {
            return employeesList.getEmployeesByDepartmentId(this.getDepartmentId());
        }

        public void setEntityStateChanged(boolean entityStateChanged) {
            this.entityStateChanged = entityStateChanged;
        }

        public boolean isEntityStateChanged() {
            return entityStateChanged;
        }
    }   
  • Java Code for EmployeesEO;
  • public class Employees implements Serializable{
        
        private Long employeeId;
        private String firstName;
        private String lastName;
        private String email;
        private String phoneNumber;
        private Date hireDate;
        private String jobId;
        private Long salary;
        private Long managerId;
        private Long departmentId;
        private boolean entityStateChanged = false;
        
        public Employees() {
        }

        public Employees(Long _id,
                         String _firstName,
                         String _lastName,
                         String _email,
                         String _phoneNumber,
                         Date _hireDate,
                         String _jobId,
                         Long _salary,
                         Long _managerId,
                         Long _departmentId){
            
            employeeId = _id;
            firstName = _firstName;
            lastName = _lastName;
            email = _email;
            phoneNumber = _phoneNumber;
            hireDate = _hireDate;
            jobId = _jobId;
            salary = _salary;
            managerId = _managerId;
            departmentId = _departmentId;
        }

        public void setEmployeeId(Long _employeeId) {
            setEntityStateChanged(true);
            this.employeeId = _employeeId;
        }

        public Long getEmployeeId() {
            return employeeId;
        }

        public void setFirstName(String _firstName) {
            setEntityStateChanged(true);
            this.firstName = _firstName;
        }

        public String getFirstName() {
            return firstName;
        }

        public void setLastname(String _lastname) {
            setEntityStateChanged(true);
            this.lastName = _lastname;
        }

        public String getLastname() {
            return lastName;
        }

        public void setEmail(String _email) {
            setEntityStateChanged(true);        
            this.email = _email;
        }

        public String getEmail() {
            return email;
        }

        public void setPhoneNumber(String _phoneNumber) {
            setEntityStateChanged(true);
            this.phoneNumber = _phoneNumber;
        }

        public String getPhoneNumber() {
            return phoneNumber;
        }

        public void setHireDate(Date _hireDate) {        
            setEntityStateChanged(true);
            this.hireDate = _hireDate;
        }

        public Date getHireDate() {
            return hireDate;
        }

        public void setJobId(String _jobId) {
            setEntityStateChanged(true);
            this.jobId = _jobId;
        }

        public String getJobId() {
            return jobId;
        }

        public void setSalary(Long _salary) {
            setEntityStateChanged(true);
            this.salary = _salary;
        }

        public Long getSalary() {
            return salary;
        }

        public void setManagerId(Long _managerId) {
            setEntityStateChanged(true);
            this.managerId = _managerId;
        }

        public Long getManagerId() {
            return managerId;
        }

        public void setDepartmentId(Long _departmentId) {
            setEntityStateChanged(true);
            this.departmentId = _departmentId;
        }

        public Long getDepartmentId() {
            return departmentId;
        }

        public void setEntityStateChanged(boolean entityStateChanged) {
            this.entityStateChanged = entityStateChanged;
        }

        public boolean isEntityStateChanged() {
            return entityStateChanged;
        }
    }

  • Java Code for LocationsEO;
public class Locations implements Serializable{
    
    private Long locationId;
    private String streetAddress;
    private String postalCode;
    private String city;
    private String stateProvince;
    private List departments = null;
    private DepartmentsList departmentsList = null;
    private boolean  entityStateChanged = false;
    
    public Locations() {        
    }
    
    public Locations (Long _locationId,
                      String _streetAddress,
                      String _postalCode,
                      String _city,
                      String _stateProvince,
                      DepartmentsList list){
   
    locationId = _locationId;
    streetAddress = _streetAddress;
    postalCode = _postalCode;
    city=_city;
    stateProvince = _stateProvince;
    departments = null;
    departmentsList = list;                      
   }

    public void setLocationId(Long _locationId) {
        setEntityStateChanged(true);
        this.locationId = _locationId;
    }

    public Long getLocationId() {
        return locationId;
    }

    public void setStreetAddress(String _streetAddress) {
        this.streetAddress = _streetAddress;
        setEntityStateChanged(true);
    }

    public String getStreetAddress() {
        return streetAddress;
    }

    public void setPostalCode(String _postalCode) {
        setEntityStateChanged(true);
        this.postalCode = _postalCode;
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setCity(String _city) {
        this.city = _city;
        setEntityStateChanged(true);
    }

    public String getCity() {
        return city;
    }

    public void setStateProvince(String _stateProvince) {
        this.stateProvince = _stateProvince;
        setEntityStateChanged(true);
    }

    public String getStateProvince() {
        return stateProvince;
    }

    public void setDepartments(List _departmentsList) {
    }

    public List<Departments> getDepartments() {
        return departmentsList.getDepartmentsByLocationId(this.getLocationId());
    }
/*
    public void setDepartmentsList(DepartmentsList departmentsList) {
        this.departmentsList = departmentsList;
    }
*/
    public DepartmentsList getDepartmentsList() {
        return departmentsList;
    }

    public void setEntityStateChanged(boolean entityStateChanged) {
        this.entityStateChanged = entityStateChanged;
    }

    public boolean isEntityStateChanged() {
        return entityStateChanged;
    }
}


Comments

Popular posts from this blog

Programmatically invoke a Popup to create a new row.

Dynamic Tabs in ADF