0% found this document useful (0 votes)
65 views307 pages

MCA Project Report

The document outlines the development of a Human Resource Management System (HRMS) aimed at improving the management of employee data, attendance, payroll, and other HR functions. It includes sections on system analysis, design, coding, testing, and security measures, emphasizing the need for an efficient solution to streamline HR processes. The project is guided by a structured approach, including feasibility studies and project planning, to ensure successful implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views307 pages

MCA Project Report

The document outlines the development of a Human Resource Management System (HRMS) aimed at improving the management of employee data, attendance, payroll, and other HR functions. It includes sections on system analysis, design, coding, testing, and security measures, emphasizing the need for an efficient solution to streamline HR processes. The project is guided by a structured approach, including feasibility studies and project planning, to ensure successful implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Abstract

Every organization has their own human resources in order to perform the internal
and external human resource activities. Among the total human resource activities,
managing the human capital i.e., employees are the significant task to any HR.

The main function of HR is to recruit, manage and store the employee data which
includes their personal information including their job roles, attendance, leaves,
salaries and many more which allows them to face huge workload.

In order to support the HR's work, this project is being developed to help HR’s to
manage the task very easily.
Acknowledgment
It is a genuine pleasure to express my profound gratitude and deep regards to my
guide Mr. Pratik Ramesh Chandgaonkar for his exemplary guidance, monitoring
and constant encouragement. I would like to express my special thanks to IGNOU
who gave me the golden opportunity to do this wonderful project on the topic
Human Resource Management System, which helped me in doing a lot of
Research and I came to know about so many new things.
Table of Contents
Chapter 1: Introduction

1.1 Introduction …………………………………………………………………… 1-1


1.2 Objectives …………………………………………………………………… 1-3

Chapter 2: System Analysis

2.1 Identification of need …………………................................................... 4-4

2.2 Preliminary Investigation ……………………………………………. 4-5

2.3 Feasibility Study …………………………………………………………. 5-7

2.4 Project Planning …………………………………………………………. 7-9

2.5 Project Scheduling ……………………………………………………. 9-12

2.6 Software Requirements Specification (SRS)………………… 12-14

2.7 Software Engineering Paradigm Applied……………………... 14-14

2.8 Data Flow Diagram (DFD)……………………................................ 15-17

2.9 Entity Relationship Diagram (ER-Diagram) ………………… 18-18

2.10 Activity Diagram ………………………………………………………… 19-19

2.11 Class Diagram ……………………………………………………………. 20-22

Chapter 3: System Design

3.1 Modularization details ………………………………………………. 23-25

3.2 Database design with Data Integrity and Constraints ……. 25-30

3.3 Procedural Design ……………………………………………………… 31-35

3.4 User Interface Design …………………………………………………… 36-51

3.5 Test Cases (Unit Test & System Test Cases) …………………… 51-52
Chapter 4: Coding

4.1 Coding at Database side …………………………………………………. 53-86

4.2 Complete Project Coding with Required Comments & Description…. 86-285

Chapter 5: Standardization of the coding

5.1 Code Efficiency …………………………………………………………………… 286-286

5.2 Error Handling ……………………………………………………………………. 286-287

5.3 Parameters calling/passing ………………………………………………… 287-287

5.4 Validation Checks ……………………………………………………………… 287-287

Chapter 6: Testing

6.1 Testing Techniques & Testing Strategies used ………………………. 287-290

6.2 Testing Plan used ……………………………………………………………… 290-290

6.3 Test Reports ……………………………………………………………………... 291-293

Chapter 7: System Security Measures

7.1 Database/ Data Security ……………………………………………………… 294-294

7.2 Creation of User Profiles & Access Rights ………………………………. 294-294

Chapter 8: Reports

8.1.1 Employee Details Report [Parameters Input Page] …………………. 295-295

8.1.2 Employee Details Report [Report Output] ……………………………… 295-295

8.2.1 Employee Attendance Details [Parameters Input Page] ………… 295-295

8.2.2 Employee Attendance Details [Report Output] ……………………… 296-296

8.3.1 Payroll Process Details [Parameters Input Page] …………………. 296-296


8.3.2 Payroll Process Details [Report Output] ……………………………… 296-297

Chapter 9: Future Scope …………………………………………………………………………… 298-298

Chapter 10: Conclusion ……………………………………………………………………………… 299-299

Bibliography ………………………………………………………………………………………………… A
List of Figures
Fig 1: Iterative Enhancement Model

Fig 2: PERT Chart

Fig 3: Gantt Chart

Fig 4: DFD 0 Level

Fig 5: DFD 1 Level

Fig 6: DFD 2 Level

Fig 7: ER-Diagram

Fig 8: Activity Diagram

Fig 9: Login Module Class Diagram

Fig 10: Employee Information Class Diagram

Fig 11: Payroll Management Class Diagram

Fig 12: Process Logic of Login Module

Fig 13: Process Logic of Employee Information

Fig 14: Process Logic of Attendance Management

Fig 15: Process Logic of Leave Management

Fig 16: Process Logic of Payroll Management


Human Resource Management System

Chapter 1: Introduction
1.1 Introduction
Nowadays, companies try to enhance their management and have a better
control over their employees. In order to fulfil these requirements in a more
efficient way they need software called Human Resource Management
System (HRMS).

Human Resource Management System is software which satisfies the needs


of the Human Resources Department of a company to manage employee’s
personal data (Employee Id, name, surname, birthdate, birthplace,
educational information etc.), employee attendance, annual leaves, payroll,
trainings, performance evaluations and so on.

We develop the Human Resource Management System that will meet the
needs for managing the employee personal data, daily attendance, leave
management, payroll processing, employee self-services, system
authentication and authorization of an employee.

Our HRMS application would be a web-based application that can be


accessed online by the HR department or Employees of the company who
have access to this application.

1.2 Objectives
The main function of an HRMS is to standardize and consolidate the core
processes related to the Human Resource Management. Below are the
Objectives which we are going to implement into this HRMS project.

▪ The application basically starts by asking the user to sign in by entering


the user-id and password. The given user-id and password would be

Master of Computer Application


1
Human Resource Management System

validated against the user and based on the validation, home page of the
application would be display with various options like Employee
Information Management, Time and Attendance, Leave, Payroll, System
settings etc.

▪ In Employee Information Management option, the HR of the company


will register the new employee by entering the basic information’s related
to the employee like employee first name, last name, date of birth, date of
joining, department Id, manager Id etc. and then finally the system will
generate the employee id. This employee id will be used for each and
every process for the employee within the system and the organization.

▪ Time and Attendance option allows the employees of the company to


submit their daily attendance Time-In and Time-Out data as per rules
specified by the HR of the company. The related manager of the
employees will approve/reject this submitted Time-In and Time-out data
to mark the employee daily attendance into the system.

▪ The HR of the company will run the leave process in the beginning of
each financial year. This leave process will credit the leave balance of all
category of leaves to the employees leave account. Input for this process
would be taken from the system that is entered by the HR of the
company.

▪ The payroll process would be done based on the employee daily


attendance marked into the system. This payroll process automatically
generates the salary for the employees when HR of the company will run
the payroll process at the end of every month. This process will take the
inputs from the system that is set by the HR for each and every employee
whose salary is to be generated.

Master of Computer Application


2
Human Resource Management System

▪ The HR/Admin of this HRMS application are allow to do the system


settings that is required by some modules into the system.
▪ All modules of this HRMS system are secured and access only based on
the user access privileges saved in the database.

Master of Computer Application


3
Human Resource Management System

Chapter 2: System Analysis


2.1 Identification of Need
The first step in the project life cycle involves determining the needs of
the project. What is the problem that we are trying to resolve? Why are
we starting this project? The need could be identified as a result of a
problem or an opportunity to improve. The overall goal of the project will
always be to improve or take advantage of a particular situation.

So, In our HRMS application the need are as follows…


• As we are trying to resolve the problem related to human resources
management in the company, so if we have a system that takes
input through user and process it in a real time so that the user of
the system can get benefits.
• They can view their information, process the information online.

2.2 Preliminary Investigation


Preliminary investigation is the first phase. In this phase, the system is
investigated. The objective of this phase is to conduct an initial analysis
and findings of the system.

System Identification: This phase is used to recognize the need for a


new system. The system is identified at this stage. It is very important
step. Everything performed in future depends on this definition and
identification.
As we have done the investigation on the management of employee’s
information, attendance, leave, Payroll and several other services and
found that it is very complex task that is done by the HR of the company
daily. So having a good system will save the time and maximize the
benefits to the company.

Master of Computer Application


4
Human Resource Management System

The proposed system that is identified at this stage will work as follows
• It will collect the employee information details from the employee
information management module. In first step, the HR of the
company will register the employee into the system and system
will produce one unique employee identification number.
• In above step, the generated unique employee identification
number will be used in each and every module to work with the
employee information like managing attendance, leave, payroll
and system access and authorization.

System Scope: The scope of the system is also recognized at this stage. A
system can be reduced in its scope due to financial, political or time problems.

Alternate Solutions: This phase is also used to find out alternate solutions for
developing the system. The best available solution must be used. The best way
to do this is to interview the concerned people in the organization. It may
include the clients, customer, supplier and consultants etc. The competitors can
also be an important source to find the best way to develop new system.

2.3 Feasibility Study


Feasibility study means to check whether the project is feasible or not,
that means possible or not. Some feasibility study regarding this project is
as follows: -

Economic Feasibility
The project has shown the economic feasibility by the study of the fact
that by using this software the increased number of the employees in a
company who is going to be a user of this application, can be given
service effectively and efficiently. Hence it will save a lot of time and

Master of Computer Application


5
Human Resource Management System

saving time means saving money. The cost and benefit analysis has
shown that cost that have incurred in developing the project is less than
the benefits that the project is going to provide once it is developed, so
this project has passed the feasibility test.

Technical Feasibility
Technical feasibility centers on the existing computer system (Hardware,
Software etc.) and to what extent it supports the existing system. As the
existing system computer system is viable so there is no matter of
technical feasibility that is the system is technically feasible. In this type
of feasibility study, it is checked whether there is a need of new
hardware/software or not. What are the basic requirements of the project?
If there is need then how it can be fulfilled. In this context, this project
doesn’t need any special hardware or software.

Behavioral Feasibility
The User also interested in this project, as it will help them to do work
with ease and efficiently without complexity, so they supported the
development of this project with full enthusiasm. This shows the
behavioral feasibility of the project.

Time Feasibility
It is the determination of whether a proposed project can be implemented
fully within stipulated time frame. The project was decided to be done in
three months and was thought to be feasible.

Operational Feasibility
In this feasibility study it is determined whether there is need of well
qualified operator or simple user. Is there need to train the operator or
not? This project is supporting the Graphical User Interface; hence

Master of Computer Application


6
Human Resource Management System

operating this project is so simple. Even a person who has a little


knowledge of computer can easily handle this well. There is no need of
trained operator.

2.4 Project Planning


A software project plan is a collection of documents that outline the tasks
and timeline of the software development. Software project plans
typically include projected start and end dates, launch plans,
requirements, configurations, installation procedures, databases and
training standards. Project managers are usually the members of the team
that develop and implement these plans, collaborating with clients and
team members to ensure the success of the project.

Software project plans usually follow flexible progressions that allow


project managers to make adjustments for project success. Because a
large part of software development is testing and troubleshooting, a
flexible project plan allows software developers to move forward and
back in the process of creating error-free programs. Software project
plans also include risk assessment and contingency plans to prepare for
potential setbacks.

Creating an organized software project plan before beginning the work


can increase efficiency and reduce errors. These are some important
aspects of software project plans:
• Defining role and responsibilities: When planning the software
project, we include information about which members of our team
can address each aspect of the software development. By assigning
roles early and documenting those assignments, we can ensure
accountability for each task.

Master of Computer Application


7
Human Resource Management System

• Determining client requirements: By creating a software project


plan, we determine the exact parameters of the client requirements.
When creating our plan, be sure to ask for constant feedback from
clients and stakeholders to ensure the software meets their needs.
• Meeting project deadlines: Planning for software projects can
help us to meet project deadlines by providing a clear time frame
for the completion of each aspect of the project. Including time-
based objectives in our plan allows every member of the team to
understand project milestones.
• Staying under project budget: Detailed project plans include
budgetary information, including the allocation of funds for each
facet of the project. Because of that, creating a software project
plan can help our team stay under the project budget.
• Ensuring high-quality work: Software project plans are important
because they allow us to implement quality assurance and find
viruses or defects in the code before delivering to the client. By
defining quality and delegating quality assurance duties, we can
ensure and deliver high-quality software to your client.
Considering all the above key points of the project planning, we have selected
the best suited SDLC (Software Development Life Cycle) model for our Human
Resource Management System Project that is Iterative Enhancement Model
also known as Incremental Model.

Iterative Enhancement Model: This model removes the shortcoming of


waterfall model. Since many facts of this system are already known. It is not a
new concept and hence no research is required. A working version can be easily
created and hence the system can start working. Rest of the functionalities can
be implemented in the next iteration and can be delivered later. As the
requirement analysis is also not required. It not being a new technology risk

Master of Computer Application


8
Human Resource Management System

involved is also less. So, one need not perform detailed risk analysis. If
redevelopment Admin is less than development can be started with a smaller
number of people and in next increments others can be involved. As this model
combines the advantage of waterfall model and prototyping, clients are always
aware of the product being delivered and can always suggest changes and
enhancements and can get them implemented. As less amount of customer
communication is required one need not apply spiral model in which all types of
analysis are done in detail. As the deadline is affordable one need not to for
Rapid Application Development model. Iterative enhancement model is useful
when less manpower is available for software development and the release
deadlines are specified. It is best suited for in house product development,
where it is ensured that the user has something to start with. The complete
product is divided into releases and the developer delivers the product release
by release.

Fig 1: Iterative Enhancement Model

2.5 Project Scheduling


In project management, a schedule consists of a list of a project's terminal
elements with intended start and finish dates. Terminal elements are the lowest

Master of Computer Application


9
Human Resource Management System

element in a schedule, which is not further subdivided. Those items are often
estimated in terms of resource requirements, budget and duration, linked by
dependencies and scheduled.

PERT Chart
The Program Evaluation Review Technique (PERT) is the cost and time
management system. PERT organizes that project is complex that some tasks
must be completed before other can be stated and that the appropriate way to
manage a project is to define and control each task. Because projects often fall
behind schedules, PERT is designed to facilitate getting a project back on
schedule. The PERT chart gives a graphical representation of this information.

Depending on the working priorities, the entire project can be subdivided into
the following main modules, those are: -

• Login Module
• Employee information management
• Absence and leave management
• Time and attendance management
• Payroll management
• Employee self-services
We can construct our activity plan as follows: -

Activity Activity Name


A Login
B Employee Information Management
C Time and Attendance Management
D Absence and Leave Management
E Payroll Management
F Employee Self Services

Master of Computer Application


10
Human Resource Management System

Chart: -

Activity Predecessor Activity Time Estimated Weeks


(Individual)
A ……… 1
B A 2
C B 2
D, E C 5
F D, E 2

Critical Path Method (CPM): -

Time line path: -

Path Length Of Time


Start-A-B-C-D-F-Finish 1+2+2+5+2= 12WEEKS
Start-A-B-C-E-F-Finish 1+2+2+5+2= 12 WEEKS

Master of Computer Application


11
Human Resource Management System

Gantt Chart
A Gantt chart is a popular type of bar chart that illustrates a project schedule.
Gantt charts illustrate the start and finish dates of the terminal elements and
summary elements of a project. Terminal elements and summary elements
comprise the work breakdown structure of the project.

Fig 3: Gantt Chart

2.6 Software Requirements Specification (SRS)

A software requirements specification is a document that captures


complete description about how the system is expected to perform. It is
usually signed off at the end of requirements engineering phase.

Product perspective
The software product is a Web application. The application will be made
up of two parts, one administrator who has all the rights and the other
user who has limited rights to work with the application. The two users of
the system, namely the HR Manager or Employee Manager or System
Admin and Employees interact with the system in different ways.

Product Functions
When URL of the application is invoked then first it will display the login
page then if user is not registered then user can register itself into the
system. By default, user will have access with attendance and leave

Master of Computer Application


12
Human Resource Management System

module for submit and view the attendance and leave. Another access
privileges are given by admin on request.

Once user is registered into the system then they can access the full
system based on the outcome of system authentication and authorization.

Admin user will have all the access, they can create, modify and view any
kind of information in system.

HR Manager/Manager can manage the employee information, Process the


Leave request, Employee Attendance and Payroll etc.

Specific Requirements
• Software Requirement Specification
Operating System Microsoft Windows 10 (64 bit)

Java Oracle JDK 1.8

Oracle WebLogic Server 12.1.2 or Glassfish


Application Server
Server 5.0.1

Database Server Oracle Database 12c

Application Development IDE JDeveloper 12c

Database Design &


SQL Developer
Development IDE

Browser Google Chrome, Microsoft Edge, Firefox

Master of Computer Application


13
Human Resource Management System

• Hardware Requirement Specification


Type Minimum Recommended

Processors 4 CPU cores 4 CPU cores or more

Memory
4 GB 8 GB or more
(RAM)

30 GB or more, depending on
Disk space 10 GB
usage

2.7 Software Engineering Paradigm applied

Software paradigm refers to method and steps, which are taken while designing
the software programming paradigm is a subset of software design paradigm
which is future for other a subset of software development paradigm. Software
is considered to be a collection of executable programming code, associated
libraries, and documentation. Software development paradigm is also known as
software engineering, all the engineering concepts pertaining to developments
software applied. It consists of the following parts as Requirement Gathering,
Software design, Programming, etc. The software design paradigm is a part of
software development. It includes design, maintenance, programming.

To develop our proposed system, we have selected the Iterative Enhancement


Model also known as Incremental Model. It is repetition incarnate. In short, it
is breaking down the software development of large applications into smaller
pieces.

Master of Computer Application


14
Human Resource Management System

2.8 Data Flow Diagram (DFD)

Data flow diagram is graphical representation of flow of data in an information


system. It uses defined symbols like rectangles, circles and arrows, plus short
text labels, to show data inputs, outputs, storage points and the routes between
each destination. Data flowcharts can range from simple, even hand-drawn
process overviews, to in-depth, multi-level DFDs that dig progressively deeper
into how the data is handled.

2.8.1 DFD 0 Level

The 0 Level DFD shows flow of data of application. DFD Level 0 is also called
a Context Diagram. It’s a basic overview of the whole system or process being
analyzed or modeled.

Fig 4: DFD 0 Level

Master of Computer Application


15
Human Resource Management System

2.8.2 DFD 1 Level

DFD Level 1 provides a more detailed breakout of pieces of the Context Level
Diagram. This DFD describes main functions carried out by the system, as we
break down the high-level process of the Context Diagram into its sub-
processes.

Fig 5: DFD 1 Level

Master of Computer Application


16
Human Resource Management System

2.8.3 DFD 2 Level

The DFD 2 Level describes flow of data in more detail. DFD Level 2 goes one
step deeper into parts of Level 1. It may require more text to reach the necessary
level of detail about the system’s functioning.

Fig 6: DFD 2 Level

Master of Computer Application


17
Human Resource Management System

2.9 Entity Relationship Diagram (ER-Diagram)

An Entity Relationship Diagram (ERD) is a visual representation of different


entities within a system and how they relate to each other. Entity relationship
diagrams are used in software engineering during the planning stages of the
software project. They help to identify different system elements and their
relationships with each other.

Fig 7: ER-Diagram

Master of Computer Application


18
Human Resource Management System

2.10 Activity Diagram

Fig 8: Activity Diagram

Master of Computer Application


19
Human Resource Management System

2.11 Class Diagram

• Login Module Class Diagram

Fig 9: Login Module Class Diagram

Master of Computer Application


20
Human Resource Management System

• Employee Information Management Class Diagram

Fig 10: Employee Information Class Diagram

Master of Computer Application


21
Human Resource Management System

• Payroll Management Class Diagram

Fig 11: Payroll Management Class Diagram

Master of Computer Application


22
Human Resource Management System

Chapter 3: System Design


3.1 Modularization details

Number of modules and their descriptions: The system contains number of


modules, of which main modules are shown

• Login Module
• Employee Information Management
• Time and Attendance Management
• Leave Management
• Payroll Management

1. Login Module: This module provides security to the application. The HR


of the company will register the employee in the employee information
management module first, after that system will have basic information
about the user and then based on this information, the user of the system
will have to register ourself by selecting the employee Id from the list.
User login details like User id, password etc. would be saved in the
database.
2. Employee Information Management: In this module, the HR of the
company will register the new employee by entering the basic
information’s related to the employee like employee first name, last
name, date of birth, date of joining, department Id, manager Id etc. and
then finally the system will generate the employee id. This employee id
will be used for each and every process for the employee within the
system and the organization.
3. Time and Attendance Management: In this module, the registered
employees of the company will be logged-in to the system and they will
enter the Time-In and Time-out data of his/her daily attendance and
submit it to his/her manager for the approval. The manager will also

Master of Computer Application


23
Human Resource Management System

logged-in to the system and then they will see the pending Time-in and
Time out data and then they will approve this attendance data.
4. Leave Management: In this module, the HR of the company will assign
the different types of leaves to their employees leave account at the
beginning of each financial year. As per the government rule and
company policy, the HR of the company will assign the following types
of leaves to the employee leave account.

• Privilege leave (PL)


• Casual leave (CL)
• Sick leave (SL)
• Maternity leave (ML)
• Compensatory off (Comp-off)
• Paternity leave (FL)
• Leave without pay (LWP)

As per the company policy, The HR of the company will initialize the
above leaves to their employees leave account. The HR will also mark
which leave would be carry forward for the next financial year leave
account of the employee and they will also decide the maximum limit for
the leave type which would be carry forwarded.

Now after initializing the leave balances to each and every employee’s
account in the beginning of financial year, the employees can use this
module to apply the leave into the system and then this applied leave
would be forwarded to the manager of the employee for the approval.
Once the leave approved then system will mark this leave into the
employee daily attendance for their payroll process.

5. Payroll Management: In this module, the HR of the company will make


the entry of the CTC (Cost to Company) offered at the time of employee

Master of Computer Application


24
Human Resource Management System

hiring. The CTC would be break into different Earning & Deduction head
as per the company policy. The CTC of the employee would be re-
structured time to time when required by the company like when
appraisal is done or any policy changes in the salary structure. Once the
CTC structure defined into the system for the employee then that CTC
structure would be used for the monthly payroll process.

The salary for the current month would be calculated automatically based
on the formula and salary structure defined into the system. If HR wants
to deduct some other amount from the employee salary or they want to
give some additional amount into the salary then they can make this
additional entry before the payroll process in each month. Example if
employees have taken any loan from the company, then this loan amount
can be deducted from the employee monthly salary until the total loan
amount is deducted by the company. In the same way if company wants
to give bonus in the employee salary, then HR can make this additional
entry in the employee salary for that month.

3.2 Database design with Data integrity and constraints

In Database Management Systems, integrity constraints are pre-defined set of


rules that are applied on the table fields(columns) or relations to ensure that the
overall validity, integrity, and consistency of the date present in the database
table is maintained. Evaluation of all the conditions or rules mentioned in the
integrity constraint is done every time a table insert, update, delete, or alter
operation is performed. The data can be inserted, updated, deleted, or altered
only if the result of the constraint comes out to be True. Thus, integrity
constraints are useful in preventing any accidental damage to the database by an
authorized user.

Master of Computer Application


25
Human Resource Management System

Below is the list of tables based on ER-Diagram which shows the data integrity
and constraints to be applied on each and every tables as required.

Table Name HRM_EMPLOYEES


Purpose To store Employee Details
Field Name Data Type Size Constraints
employee_id varchar2 11 Primary Key
first_name varchar2 75
middle_name varchar2 75
last_name varchar2 75
date_of_birth date
mobile_no varchar2 13
email_id varchar2 55
Joining_date date
end_date date
dept_id number Foreign key
designation_id number Foreign key
manager_id varchar2 Foreign key
created_date date
created_by varchar2 11
updated_date date
updated_by varchar2 11

Table Name HRM_DEPARTMENTS


Purpose To store department details
Field Name Data Type Size Constraints
dept_id number Primary Key
dept_name varchar2 100
dept_head varchar2 11
dept_head_start_date date
dept_location_id number Foreign key

Table Name HRM_DESIGNATION


Purpose To store employee designation
Field Name Data Type Size Constraints
designation_id number Primary Key
designation_name varchar2 100

Table Name HRM_LOCATION

Master of Computer Application


26
Human Resource Management System

Purpose To store dept location


Field Name Data Type Size Constraints
location_id number Primary Key
location_name varchar2 75
city varchar2 75
state varchar2 75
country varchar2 75

Table Name HRM_LEAVE_CATEGORY


Purpose To store all type of leave available
Field Name Data Type Size Constraints
leave_code varchar2 5 Primary Key
leave_type varchar2 25
leave_value_in_days number
max_limit number
is_active varchar2 1

Table Name HRM_LEAVE_ACCOUNT


Purpose Keep details of leave for an employee
Field Name Data Type Size Constraints
emp_leave_code_key varchar2 16 Primary Key
employee_id varchar2 11 Foreign key
leave_code varchar2 5 Foreign key
closing_balance number
opening_balance number
total_opening_balance number
leave_used number
available_balance number
fin_year varchar2 9

Table Name HRM_LEAVE


Purpose Leave transaction table for leave application
Field Name Data Type Size Constraints
emp_leave_code_key varchar2 16 Foreign key
leave_from_date date
leave_to_date date
no_of_days number
is_approved varchar2 1
created_date date
approved_date date
approved_by varchar2 11

Master of Computer Application


27
Human Resource Management System

Table Name HRM_ATTENDANCE


Purpose Daily Attendance transaction table
Field Name Data Type Size Constraints
employee_id varchar2 11 Primary Key
attendance_period varchar2 15 Foreign key
attendance_date date Primary Key
Time_in date
Time_out date
present_hours number
present_status varchar2 11
is_attendance_approved varchar2 1
Create_date date

Table Name HRM_ATTENDANCE_PERIOD


Store attendance period open/closed status for a
Purpose month
Field Name Data Type Size Constraints
Attendance_Year varchar2 4
attendance_period varchar2 15 Primary Key
is_period_open varchar2 1
period_closed_date date

Table Name HRM_PAY_ED_CODE


Purpose Store earning/deduction code and details
Field Name Data Type Size Constraints
ed_code varchar2 11 Primary Key
description varchar2 100
is_taxable varchar2 1
is_active varchar2 1
created_date date
closed_date date

Table Name HRM_CTC_STRUCTURE


Purpose Store employee CTC structure for payroll process
Field Name Data Type Size Constraints
employee_id varchar2 11 Foreign key
ed_code varchar2 11 Foreign key
amount number
created_date date

Table Name HRM_PAY_CHANGE


Store current month pay change details for payroll
Purpose process
Field Name Data Type Size Constraints

Master of Computer Application


28
Human Resource Management System

employee_id varchar2 11 Foreign key


ed_code varchar2 11 Foreign key
amount number
payroll_period varchar2 7
created_date date

Table Name HRM_PAY_DETAILS


Purpose Store ED code wise payroll processed details
Field Name Data Type Size Constraints
Composite
employee_id varchar2 11 Key
Composite
ed_code varchar2 11 Key
amount number
Composite
payroll_period varchar2 7 Key
created_date date

Table Name HRM_PAY_MASTER


Store payroll processed details in short as a master
Purpose record
Field Name Data Type Size Constraints
Composite
employee_id varchar2 11 Key
Composite
payroll_period varchar2 7 Key
gross_earning number
total_deduction number
net_salary number
created_date date

Table Name HRM_SYSTEM_USER


Purpose Store system user details
Field Name Data Type Size Constraints
user_id varchar2 11 Primary Key
user_name varchar2 75
login_password varchar2 11
created_date date
last_login_date date
password_updated_date date
end_date date

Table Name HRM_MENU_ACCESS


Purpose Store user wise menu access details

Master of Computer Application


29
Human Resource Management System

Field Name Data Type Size Constraints


user_id varchar2 11 Foreign key
menu_id number Foreign key
is_active varchar2 1
created_date date
created_by varchar2 11
updated_date date
updated_by varchar2 11

Table Name HRM_SYSTEM_MENUS


Purpose Store system menu details
Field Name Data Type Size Constraints
menu_id number Primary Key
menu_name varchar2 100
menu_type varchar2 15
is_active varchar2 1
created_date date
created_by varchar2 11
updated_date date
updated_by varchar2 11

Master of Computer Application


30
Human Resource Management System

3.3 Procedural Design

Process Logic of each module

• Login

Fig 12: Process Logic of Login Module

Master of Computer Application


31
Human Resource Management System

• Employee Information Management

Fig 13: Process Logic of Employee Information

Master of Computer Application


32
Human Resource Management System

• Time and Attendance Management

Fig 14: Process Logic of Attendance Management

Master of Computer Application


33
Human Resource Management System

• Leave Management

Fig 15: Process Logic of Leave Management

Master of Computer Application


34
Human Resource Management System

• Payroll Management

Fig 16: Process Logic of Payroll Management

Master of Computer Application


35
Human Resource Management System

3.4 User Interface Design


3.4.1 Login Module

Interface: Login Screen

Interface: Register New User Screen

Master of Computer Application


36
Human Resource Management System

Interface: Home page

3.4.2 Employee Information Management Module

Interface: Search Employees

Master of Computer Application


37
Human Resource Management System

Interface: Register New Employee

Interface: Edit Employee Information

Master of Computer Application


38
Human Resource Management System

Interface: Department Information

Interface: Search & Edit Locations

Master of Computer Application


39
Human Resource Management System

Interface: Create New Location

Interface: Create & Update Employee Designation

3.4.3 Time & Attendance Management Module

Master of Computer Application


40
Human Resource Management System

Interface: Employee Attendance Detail

Interface: Attendance Approval or Rejection

Master of Computer Application


41
Human Resource Management System

Interface: Attendance Time-In and Time-Out Entry

Interface: Attendance Period Open

Master of Computer Application


42
Human Resource Management System

Interface: Attendance Period Closed

Interface: Attendance Process

3.4.4 Leave Management Module

Master of Computer Application


43
Human Resource Management System

Interface: Leave Category

Interface: View Leave Balance

Master of Computer Application


44
Human Resource Management System

Interface: Submit Leave Application

Master of Computer Application


45
Human Resource Management System

Interface: Approve/Reject Leave Application

Interface: Annual Leave Process

3.4.5 Payroll Management Module

Master of Computer Application


46
Human Resource Management System

Interface: Payroll Home

Interface: Earning/Deduction Master View

Master of Computer Application


47
Human Resource Management System

Interface: Earning/Deduction Master Entry

Interface: Employee CTC Earning

Master of Computer Application


48
Human Resource Management System

Interface: Employee CTC Deduction

Interface: Employee CTC Details

Master of Computer Application


49
Human Resource Management System

Interface: Employee Pay Change

Interface: Payroll Processed Details

Master of Computer Application


50
Human Resource Management System

Interface: Payroll Process

3.5 Test Cases (Unit Test Cases and System Test Cases)

Unit Testing: Unit Testing is a software verification and validation method,


where the programmer gains confidence that individual units of source codes
are fit for use. A unit is the smallest testable part of an application. In procedural
programming, a unit may be an individual program, function, procedure, etc.,
while in object-oriented programming, the smallest unit is a method, which may
belong to a base/super class, abstract class or derived/child class. Unit testing
can be done by something as simple as stepping through code in a debugger;
modern applications include the use of a test framework.

Ideally, each test case is independent from the others: substitutes like method
stubs, mock objects, fakes and test harnesses can be used to assist testing a
module in isolation. Unit tests are typically written and run by software
developers to ensure that code meets its requirements and behaves as intended.

Master of Computer Application


51
Human Resource Management System

Its implementation can vary from being very manual (pencil and paper) to being
formalized as part of build automation.

System Testing: System Testing (sometimes called System and Testing,


abbreviated I&T) is the activity of software testing in which individual software
modules are combined and tested as a group. It occurs after unit testing and
before system testing.

System testing takes as its input modules that have been unit tested, groups
them in larger aggregates, applies tests defined in a System test plan to those
aggregates, and delivers as its output the integrated system ready for system
testing.

The purpose of System testing, is to verify functional, performance and


reliability requirements placed on major design items. These "design items",
i.e., assemblages (or groups of units), are exercised through their interfaces
using Black box testing, success and error cases being simulated via appropriate
parameter and data inputs. Simulated usage of shared data areas and inter-
process communication is tested and individual subsystems are exercised
through their input interface. Test cases are constructed to test that all
components within assemblages interact correctly, for example across procedure
calls or process activations, and this is done after testing individual modules,
i.e., unit testing.

Master of Computer Application


52
Human Resource Management System

Chapter 4: Coding

4.1 Coding at Database side

4.1.1 Database Creation

--Tables for Employee Information Management

Master of Computer Application


53
Human Resource Management System

---Tables for Leave Management

Master of Computer Application


54
Human Resource Management System

--Tables for Attendance Management

Master of Computer Application


55
Human Resource Management System

--Tables for Payroll Management

Master of Computer Application


56
Human Resource Management System

Master of Computer Application


57
Human Resource Management System

---Tables for Login & Menu Access

Master of Computer Application


58
Human Resource Management System

---Tables for Reports Printing

Master of Computer Application


59
Human Resource Management System

4.1.2 Database Programming to handle the transactions and processes

Procedures
• ANUAL_LEAVE_ACCOUNT_PROCESS.sql

Master of Computer Application


60
Human Resource Management System

Master of Computer Application


61
Human Resource Management System

Master of Computer Application


62
Human Resource Management System

• APPROVE_REJECT_LEAVE_APP.sql

Master of Computer Application


63
Human Resource Management System

Master of Computer Application


64
Human Resource Management System

• SUBMIT_LEAVE.sql

Master of Computer Application


65
Human Resource Management System

Master of Computer Application


66
Human Resource Management System

• SUBMIT_TIME_IN_OUT.sql

Master of Computer Application


67
Human Resource Management System

Functions
• GET_ATTENDANCE_SUBMISSION_STATUS.sql

• GET_EMP_DEPT_NAME.sql

Master of Computer Application


68
Human Resource Management System

• GET_EMP_DESIGNATION.sql

• GET_EMP_GROSS_EARNING.sql

• GET_EMP_NAME.sql

Master of Computer Application


69
Human Resource Management System

• GET_NEW_ED_CODE.sql

Master of Computer Application


70
Human Resource Management System

• GET_NEW_EMP_ID.sql

• GET_TIME.sql

Master of Computer Application


71
Human Resource Management System

• VALIDATE_USER_LOGIN.sql

Triggers

• CTC_PAY_CHANGE_TRG.sql

• CTC_STR_BEFORE_DML_TRG.sql

Master of Computer Application


72
Human Resource Management System

• DEPT_BEFORE_DML_TRG.sql

Master of Computer Application


73
Human Resource Management System

• DESIG_BEFORE_DML_TRG.sql

• LOCATION_BEFORE_DML_TRG.sql

Packages

• ATTENDANCE_PROCESS.sql [Package Specifications]

Master of Computer Application


74
Human Resource Management System

• ATTENDANCE_PROCESS.sql [Package Body]

Master of Computer Application


75
Human Resource Management System

Master of Computer Application


76
Human Resource Management System

Master of Computer Application


77
Human Resource Management System

Master of Computer Application


78
Human Resource Management System

• PAYROLL_PROCESS.sql [Package Specifications]

Master of Computer Application


79
Human Resource Management System

• PAYROLL_PROCESS.sql [Package Body]

Master of Computer Application


80
Human Resource Management System

Master of Computer Application


81
Human Resource Management System

Master of Computer Application


82
Human Resource Management System

Master of Computer Application


83
Human Resource Management System

Master of Computer Application


84
Human Resource Management System

Master of Computer Application


85
Human Resource Management System

4.2 Complete Project Coding with Required Comments & Description

Common Util Classes

MyADFUtils.java [Utility class for all modules]

package hrms.view.util;
import hrms.model.common.AppModuleAM;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

Master of Computer Application


86
Human Resource Management System

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.math.BigDecimal;
import oracle.jbo.ApplicationModule;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.el.ValueExpression;

Master of Computer Application


87
Human Resource Management System

import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.ServletContext;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.RichQuery;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.view.rich.model.FilterableQueryDescriptor;
import oracle.adf.view.rich.model.QueryDescriptor;
import oracle.adf.view.rich.model.QueryModel;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;

Master of Computer Application


88
Human Resource Management System

import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.DBTransactionImpl;
import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.SequenceImpl;
import oracle.jbo.server.ViewRowImpl;
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.event.SelectionEvent;
import org.apache.myfaces.trinidad.model.UploadedFile;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;

public class MyADFUtils


{
/*********************** Private Methods Section****************/

public static Object resolveExpression(String expression)


{
FacesContext ctx = getFacesContext();
ELContext elContext = ctx.getELContext();
ValueExpression ve =
ctx.getApplication().getExpressionFactory().createValueExpression(elContext,
expression, Object.class);
return ve.getValue(elContext);
}

private static BindingContainer getBindings()


{
return BindingContext.getCurrent().getCurrentBindingsEntry();

Master of Computer Application


89
Human Resource Management System

private static UIComponent findComponent(UIComponent base, String id)


{
if (id.equals(base.getId()))
{
return base;
}
UIComponent children = null;
UIComponent result = null;
Iterator childrens = base.getFacetsAndChildren();
while ((childrens.hasNext()) && (result == null))
{
children = (UIComponent) childrens.next();
if (id.equals(children.getId()))
{
result = children;
}
else
{
result = findComponent(children, id);
if (result == null)
{
continue;
}
}
}

Master of Computer Application


90
Human Resource Management System

return result;
}

private static void writeJavaScriptToClient(String script)


{
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = Service.getRenderKitService(fctx,
ExtendedRenderKitService.class);
erks.addScript(fctx, script);
}

private static String getStringSafely(ResourceBundle bundle, String key,


String defaultValue)
{
String resource = null;
try
{
resource = bundle.getString(key);
}
catch (MissingResourceException mrex)
{
if (defaultValue != null)
{
resource = defaultValue;
}
else
{
resource = "Missing resource: " + key;

Master of Computer Application


91
Human Resource Management System

}
}
return resource;
}

private static ResourceBundle getBundle(String baseName)


{
FacesContext ctx = getFacesContext();
UIViewRoot uiRoot = ctx.getViewRoot();
Locale locale = uiRoot.getLocale();
ClassLoader ldr = Thread.currentThread().getContextClassLoader();
return ResourceBundle.getBundle(baseName, locale, ldr);
}

private static Object invokeMethod(String expr, Class returnType, Class[]


argTypes, Object[] args)
{
FacesContext fc = FacesContext.getCurrentInstance();
ELContext elctx = fc.getELContext();
ExpressionFactory elFactory = fc.getApplication().getExpressionFactory();
MethodExpression methodExpr = elFactory.createMethodExpression(elctx,
expr, returnType, argTypes);
return methodExpr.invoke(elctx, args);
}

private static ServletContext getContext()


{
return (ServletContext) getFacesContext().getExternalContext().getContext();

Master of Computer Application


92
Human Resource Management System

}
/************************************************** End Private
Methods Section
**************************************************/

/** function return application facesContext */


public static FacesContext getFacesContext()
{
return FacesContext.getCurrentInstance();
}

/** function return ApplicationModule Object */


public static ApplicationModule getDefaultApplicationModule()
{
return (ApplicationModule)
resolveExpression("#{data.AppModuleAMDataControl.dataProvider}");
}

/** function take iterator name and return iterator object */


public static DCIteratorBinding getIterator(String iteratorName)
{
DCIteratorBinding iter = (DCIteratorBinding)
getBindings().get(iteratorName);
if (iter == null)
{
throw new RuntimeException("Iterator '" + iteratorName + "' not found");
}
return iter;
}

Master of Computer Application


93
Human Resource Management System

/** function take operation name (from page definition) and execute this
operation (e.g Commit, Rollback, Next, CreateInsert, Delete, .....) */
public static void executeOperation(String operationName)
{
OperationBinding operationBinding =
getBindings().getOperationBinding(operationName);
operationBinding.execute();
}
/**
* Function return the operation binding
* @param operationName
*/
public static OperationBinding getOperationBinding(String operationName){
OperationBinding operationBinding =
getBindings().getOperationBinding(operationName);
return operationBinding;
}

/** function used to commit changes to database*/


public static void commit()
{
getDefaultDBTransaction().commit();
}

/** function used to rollback any changes to the last commit point*/
public static void rollback()
{

Master of Computer Application


94
Human Resource Management System

executeOperation("Rollback");
}

/** function used to rollback any changes to the last commit point without
changing current row of the passed iterator*/
public static void rollbackAndBeInTheCurrentRow(String iteratorName)
{
try
{
DCIteratorBinding locationsIter = getIterator(iteratorName);
Row lRow = locationsIter.getCurrentRow();
Key key = null;
if (lRow != null)
{
key = lRow.getKey();
}
rollback();
if (key != null)
{
locationsIter.setCurrentRowWithKey(key.toStringFormat(true));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}

Master of Computer Application


95
Human Resource Management System

/** function return application database transaction object */


public static DBTransaction getDefaultDBTransaction()
{
return (DBTransaction) getDefaultApplicationModule().getTransaction();
}

/** function take the component id and will return the component object */
public static UIComponent findComponentInRoot(String componentId)
{
UIComponent component = null;
FacesContext context = FacesContext.getCurrentInstance();
if (context != null)
{
UIComponent root = context.getViewRoot();
component = findComponent(root, componentId);
}
return component;
}

///** function take popup id and will show this popup */


// public static void showPopup(String popupName)
// {
// StringBuilder strb = new
StringBuilder("AdfPage.PAGE.findComponentByAbsoluteId(\"" + popupName
+ "\").show();");
// writeJavaScriptToClient(strb.toString());
// }

Master of Computer Application


96
Human Resource Management System

public static void showPopup(RichPopup popup) {


RichPopup.PopupHints hints = new RichPopup.PopupHints();
popup.show(hints);
}

///** function take popup id and component id and will show this popup behind
with this component */
// public static void showPopup(String popupName, String alignId)
// {
// StringBuilder strb = new StringBuilder("var pop =
AdfPage.PAGE.findComponentByAbsoluteId(" + popupName + ");");
// strb.append("var hints = {};\n");
// strb.append("hints[AdfRichPopup.HINT_ALIGN_ID] = '" + alignId + "';");
// strb.append("pop.show(hints);");
// writeJavaScriptToClient(strb.toString());
// }

/** function take iterator name and attribute name and value then set this value
to the attribute in the current row of the iterator */
public static void setAttributeInIterator(String iteratorName, String
attributeName, Object value)
{
if (getIterator(iteratorName).getCurrentRow() != null)
{
getIterator(iteratorName).getCurrentRow().setAttribute(attributeName,
value);
}
}

Master of Computer Application


97
Human Resource Management System

/** function take iterator name and attribute name then return the value of the
attribute from the current row of the iterator */
public static Object getAttributeFromIterator(String iteratorName, String
attributeName)
{
if (getIterator(iteratorName).getCurrentRow() != null)
{
return
getIterator(iteratorName).getCurrentRow().getAttribute(attributeName);
}
return null;
}

/** function take URL and open it in new window */


public static void openUrlInNewWindow(String url)
{
StringBuilder strb = new StringBuilder("window.open('" + url + "');");
writeJavaScriptToClient(strb.toString());
}

/** function return current application database connection */


public static Connection getConnection()
{
DBTransactionImpl dbt = (DBTransactionImpl) getDefaultDBTransaction();
Connection conn = dbt.getPersistManagerConnection();
return conn;
}

Master of Computer Application


98
Human Resource Management System

/** function take session variable name and object then save this object inside
the variable name in the session scope */
public static void putInSession(String key, Object object)
{
try
{
FacesContext ctx = getFacesContext();
HttpSession session = (HttpSession)
ctx.getExternalContext().getSession(true);
session.setAttribute(key, object);
}
catch (Exception e)
{
System.err.println("storeOnSession -- " + e);
}
}

/** function take session variable name and return the value inside this variable
name from the session scope */
public static Object getFromSession(String key)
{
try
{
FacesContext ctx = getFacesContext();
Map sessionState = ctx.getExternalContext().getSessionMap();
return sessionState.get(key);
}

Master of Computer Application


99
Human Resource Management System

catch (Exception e)
{
e.printStackTrace();
}
return null;
}

/** function take request variable name and object then save this object inside
the variable name in the request scope */
public static void putInRequest(String name, Object value)
{
getFacesContext().getExternalContext().getRequestMap().put(name, value);
}

/**
* Put value in page flow scope
*/
public static void putInPageFlowScope(String name, Object value){
AdfFacesContext.getCurrentInstance().getPageFlowScope().put(name,
value);
}

/**
* Get value from page flow scope
*/
public static Object getFromPageFlowScope(String name){
return
AdfFacesContext.getCurrentInstance().getPageFlowScope().get(name);

Master of Computer Application


100
Human Resource Management System

/** function take request variable name and return the value inside this variable
name from the request scope */
public static Object getFromRequest(String name)
{
return getFacesContext().getExternalContext().getRequestMap().get(name);
}

/** function take the resource bundle base Name and the key and return the
value from resource bundle */
public static String getStringFromBundle(String baseName, String key)
{
ResourceBundle bundle = getBundle(baseName);
return getStringSafely(bundle, key, null);
}

/** function return current application locale */


public static Locale getLocale()
{
return getFacesContext().getViewRoot().getLocale();
}

/** function return the current jsp name */


public static String getPageName()
{
FacesContext context = getFacesContext();
String viewId = context.getViewRoot().getViewId();

Master of Computer Application


101
Human Resource Management System

int dotIndex = viewId.indexOf(".");


if (dotIndex < 0)
{
return viewId;
}
String fileName = viewId.substring(1, dotIndex);
return fileName;
}

/** function used to refresh the hole jsp page */


public static void refreshPage()
{
FacesContext context = FacesContext.getCurrentInstance();
String currentView = context.getViewRoot().getViewId();
ViewHandler vh = context.getApplication().getViewHandler();
UIViewRoot UIV = vh.createView(context, currentView);
UIV.setViewId(currentView);
context.setViewRoot(UIV);
}

/** function take outcome and will navigate to the page */


public static void navigateToPage(String outcome)
{
FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null,
outcome);
}

Master of Computer Application


102
Human Resource Management System

/** function For Cancelling any Changes Happened In The Row (Create New
Row or Update Row) */
public static void cancelChangesInCurrentRow(String iteratorName)
{
DCIteratorBinding iterBinding = getIterator(iteratorName);
ViewObject vo = iterBinding.getViewObject();
Row currentRow = vo.getCurrentRow();
currentRow.refresh(Row.REFRESH_REMOVE_NEW_ROWS |
Row.REFRESH_WITH_DB_FORGET_CHANGES);
}

/** function take a message and display it as error message (error icon will
appear) */
public static void showErrorMessage(String message)
{
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR,
null, null);
fm.setDetail(message);
FacesContext.getCurrentInstance().addMessage(null, fm);
}

/** function take a message and display it as information message (information


icon will appear) */
public static void showSuccessfulMessage(String message)
{
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO,
null, null);
fm.setDetail(message);
FacesContext.getCurrentInstance().addMessage(null, fm);

Master of Computer Application


103
Human Resource Management System

/** function take a message and display it as warning message (warn icon will
appear) */
public static void showWarnMessage(String message)
{
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_WARN,
null, null);
fm.setDetail(message);
FacesContext.getCurrentInstance().addMessage(null, fm);
}

/** function take viewobject name and refresh this view object */
public static void refreshViewObject(String viewObjectName)
{
ViewObject vo =
getDefaultApplicationModule().findViewObject(viewObjectName);
vo.executeQuery();
}

/** function take iterator name and refresh the view object of that iterator
without losing the current row */
public static void refreshVOByIteratorName(String iteratorName)
{
try
{
DCIteratorBinding locationsIter = getIterator(iteratorName);
Row lRow = locationsIter.getCurrentRow();
Key key = null;

Master of Computer Application


104
Human Resource Management System

if (lRow != null)
{
key = lRow.getKey();
}
locationsIter.getViewObject().executeQuery();
if (key != null)
{
locationsIter.setCurrentRowWithKey(key.toStringFormat(true));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}

/** function take iterator name and refresh this iterator */


public static void refreshIterator(String iteratorName)
{
DCIteratorBinding dciter = getIterator(iteratorName);
dciter.executeQuery();
dciter.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED);
}

/** function take iterator name and the attribute name then sum all the attribute
values for all rows in the iterator */
public static double getSumOfAttribute(String iteratorName, String
attributeName)

Master of Computer Application


105
Human Resource Management System

{
DCIteratorBinding dciter = getIterator(iteratorName);
double sum = 0;
Row[] rows = dciter.getViewObject().getAllRowsInRange();
for (Row r : rows)
{
if (r != null && r.getAttribute(attributeName) != null)
{
sum = sum +
Double.parseDouble(r.getAttribute(attributeName).toString());
}
}
return sum;
}

/** function take iterator name and the attribute name then sum all the attribute
values for all rows in the iterator and return long value*/
public static long getSumOfAttributeAsLong(String iteratorName, String
attributeName)
{
DCIteratorBinding dciter = getIterator(iteratorName);
long sum = 0;
Row[] rows = dciter.getViewObject().getAllRowsInRange();
for (Row r : rows)
{
if (r != null && r.getAttribute(attributeName) != null)
{
sum = sum + Long.parseLong(r.getAttribute(attributeName).toString());

Master of Computer Application


106
Human Resource Management System

}
}
return sum;
}

/** function take component object and refresh this component */


public static void refreshComponent(UIComponent component)
{
RequestContext.getCurrentInstance().addPartialTarget(component);
}

/** function used to set current local*/


public static void setBrowserLocal(String locale)
{
FacesContext ctx = FacesContext.getCurrentInstance();
UIViewRoot uiRoot = ctx.getViewRoot();
Locale bLocale = new Locale(locale);
uiRoot.setLocale(bLocale);
}

/** function return the current browser local ( e.g. "ar" - "en" - ....) */
public static String getBrowserLocal()
{
FacesContext ctx = FacesContext.getCurrentInstance();
UIViewRoot uiRoot = ctx.getViewRoot();
return uiRoot.getLocale().toString();
}

Master of Computer Application


107
Human Resource Management System

/** function used for uploading file */


public static void uploadFile(ValueChangeEvent valueChangeEvent, String
fileLocation, String fileName)
{
UploadedFile file = (UploadedFile) valueChangeEvent.getNewValue();
if (fileLocation == null)
{
fileLocation = "c:/";
}
InputStream in;
FileOutputStream out;
boolean exists = (new File(fileLocation)).exists();
if (!exists)
{
(new File(fileLocation)).mkdirs();
}
if (file != null && file.getLength() > 0)
{
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage("File Uploaded " +
file.getFilename() + " (" + file.getLength() + " bytes)");

context.addMessage(valueChangeEvent.getComponent().getClientId(context),
message);
try
{
out = new FileOutputStream(fileLocation + "" + fileName);
in = file.getInputStream();

Master of Computer Application


108
Human Resource Management System

for (int bytes = 0; bytes < file.getLength(); bytes++)


{
out.write(in.read());
}
in.close();
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
else
{
String filename = file != null? file.getFilename(): null;
String byteLength = file != null? "" + file.getLength(): "0";
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new
FacesMessage(FacesMessage.SEVERITY_WARN, " " + " " + filename + " (" +
byteLength + " bytes)", null);

context.addMessage(valueChangeEvent.getComponent().getClientId(context),
message);
}
}

/** function used for downloading file */


public static void downloadFile(java.io.OutputStream outputStream, String
fileName) throws IOException

Master of Computer Application


109
Human Resource Management System

{
try
{
File file = new File(fileName);
byte[] b = new byte[(int) file.length()];
FileInputStream fileInputStream = new FileInputStream(file);
fileInputStream.read(b);
outputStream.write(b);
outputStream.flush();
}
catch (Exception e)
{
FacesMessage fm = new
FacesMessage(FacesMessage.SEVERITY_ERROR, null, null);
fm.setDetail("No file found");
FacesContext.getCurrentInstance().addMessage(null, fm);
}
}

/** function take database sequence name and return the next value for this
sequence */
public static BigDecimal getSequenceNextValue(String sequenceName)
{
SequenceImpl seq = new SequenceImpl(sequenceName,
getDefaultDBTransaction());
return new BigDecimal(seq.getSequenceNumber().toString());
}

Master of Computer Application


110
Human Resource Management System

/** function take view object name and delete all rows in this viewobject */
public static void clearViewObject(String viewObjectName)
{
ViewObject vo =
getDefaultApplicationModule().findViewObject(viewObjectName);
vo.executeQuery();
while (vo.hasNext())
{
vo.next().remove();
if (vo.getEstimatedRowCount() > 0)
{
vo.first();
}
}
if (vo.getEstimatedRowCount() > 0)
{
vo.getCurrentRow().remove();
}
}

/** function used to close preparedStatement */


public static void close(PreparedStatement stat)
{
try
{
if(stat != null)
{
stat.close();

Master of Computer Application


111
Human Resource Management System

}
}
catch (Exception e)
{
e.printStackTrace();
}
}

/** function used to close ResultSet */


public static void close(ResultSet rs)
{
try
{
if(rs != null)
{
rs.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}

/** function used to close CallableStatement */


public static void close(java.sql.CallableStatement cstat)
{

Master of Computer Application


112
Human Resource Management System

try
{
if(cstat != null)
{
cstat.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}

/** function take a double number and integer number then round the double
number with the integer number (e.g roundToDecimals(15.22545112, 3) then
the output will be 15.225) */
public static double roundToDecimals(double d, int c)
{
int temp = (int) ((d * Math.pow(10, c)));
return (((double) temp) / Math.pow(10, c));
}

/** function take sql statement and return the result value e.g
(getSqlDescription("select username from users where user_id=10") function
will return username value) */
public static String getSqlDescription(String sql)
{
PreparedStatement stat = null;
ResultSet rs = null;

Master of Computer Application


113
Human Resource Management System

try
{
stat = getDefaultDBTransaction().createPreparedStatement(sql, 1);
rs = stat.executeQuery();
while (rs.next())
{
return rs.getString(1);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
close(rs);
close(stat);
}
return "";
}

/** function take sql statement and return the result as double */
public static double getSqlAsDuoble(String sql)
{
PreparedStatement stat = null;
ResultSet rs = null;
try

Master of Computer Application


114
Human Resource Management System

{
stat = getDefaultDBTransaction().createPreparedStatement(sql, 1);
rs = stat.executeQuery();
while (rs.next())
{
return rs.getDouble(1);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
close(rs);
close(stat);
}
return 0;
}

/** function take sql statement and return the result as long */
public static long getSqlAsLong(String sql)
{
PreparedStatement stat = null;
ResultSet rs = null;
try

Master of Computer Application


115
Human Resource Management System

{
stat = getDefaultDBTransaction().createPreparedStatement(sql, 1);
rs = stat.executeQuery();
while (rs.next())
{
return rs.getLong(1);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
close(rs);
close(stat);
}
return 0;
}

/** function take dml sql statement and execute this statement then return
number of records affects during the execution */
public static int executeDML(String sql)
{
PreparedStatement stat = null;
try
{
stat = getDefaultDBTransaction().createPreparedStatement(sql, 1);

Master of Computer Application


116
Human Resource Management System

int result = stat.executeUpdate();


return result;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
close(stat);
}
return 0;
}

/** function take the name of the view object and return this view object */
public static ViewObject getViewObjectByName(String viewObjectName)
{
return getDefaultApplicationModule().findViewObject(viewObjectName);
}

/** function take iterator name and return the view object associated to this
iterator */
public static ViewObject getViewObjectFromIterator(String iteratorName)
{
return getIterator(iteratorName).getViewObject();
}

Master of Computer Application


117
Human Resource Management System

/** function can be called when the user override table selectionListener and
want to make the selected row is the current row (e.g
makeTableSelectedRowCurrentRow("#{bindings.UsersView1.treeModel.make
Current}", selectionEvent)) */
public static void makeTableSelectedRowCurrentRow(String exp,
SelectionEvent selectionEvent)
{
invokeMethod(exp, null, new Class[] { SelectionEvent.class }, new Object[]
{ selectionEvent });
}

/** function take iterator name and attribute name and value then set the
attribute with the value for all rows in the iterator */
public static void setValueToAllRowsInTheIterator(String iteratorName,
String attributeName, Object value)
{
DCIteratorBinding itemIter = getIterator(iteratorName);
for (int i = 0; i < itemIter.getViewObject().getEstimatedRowCount(); i++)
{
Row r = itemIter.getRowAtRangeIndex(i);
r.setAttribute(attributeName, value);
}
}

/** function take the folder name (which is located inside Web Content folder)
and will return the real path of that folder */
public static String getContextRealPath(String folderName)
{
String path = "";
try

Master of Computer Application


118
Human Resource Management System

{
path = getContext().getRealPath("/" + folderName);
}
catch (Exception e)
{
System.out.println(e);
}
return path;
}

/** function take af:table component (RichTable object) and clear all columns
filters */
public static void clearTableFilters(RichTable tableComponent)
{
FilterableQueryDescriptor q = (FilterableQueryDescriptor)
tableComponent.getFilterModel();
Map<String, Object> m = q.getFilterCriteria();
if (m != null)
{
m.clear();
}
}

/** function take af:query component (RichQuery object) and reset query fields
*/
public static void resetQueryFields(RichQuery queryComponent)
{
QueryModel queryModel = queryComponent.getModel();

Master of Computer Application


119
Human Resource Management System

QueryDescriptor queryDescriptor = queryComponent.getValue();


queryModel.reset(queryDescriptor);
}

/** function take componentId and set focus of this component */


public static void setFocus(String componentId)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExtendedRenderKitService service =
Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, "comp =
AdfPage.PAGE.findComponent('"+componentId+"'); comp.focus();");
}

public static void createNewFile(String filePath)


{
Writer writer = null;
try
{
writer = new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(filePath), "utf-8"));
}
catch (IOException ex)
{
}
finally
{
try

Master of Computer Application


120
Human Resource Management System

{
writer.close();
}
catch (Exception ex)
{
}
}
}

public static void editPropertyFile(String filePath, String key, String value)


{
try
{
FileInputStream in = new FileInputStream(filePath);
Properties props = new Properties();
props.load(in);
in.close();

FileOutputStream out = new FileOutputStream(filePath);


props.setProperty(key, value);
props.store(out, null);
out.close();
}
catch (Exception e)
{
}
}

Master of Computer Application


121
Human Resource Management System

public static String readValueFromPropertyFile(String filePath, String key)


{
Properties prop = new Properties();
InputStream input = null;
try
{
input = new FileInputStream(filePath);
prop.load(input);
String value = prop.getProperty(key);
return value;
}
catch (Exception e)
{
}
finally
{
if (input != null)
{
try
{
input.close();
}
catch (IOException e)
{
}
}

Master of Computer Application


122
Human Resource Management System

}
return null;
}

/** function take iterator name then return the current row of the iterator */
public static Row getCurrentRow(String iteratorName)
{
if (getIterator(iteratorName).getCurrentRow() != null)
{
return getIterator(iteratorName).getCurrentRow();
}
return null;
}

/** function to cancel changes in ViewObject */


public static void cancelChangesInViewObject(String voName)
{
cancelChangesForRows(voName, true);
}

/** function to cancel changes in Iterator */


public static void cancelChangesInIter(String Iter)
{
cancelChangesForRows(Iter, false);
}

private static void cancelChangesForRows(String name, boolean isVo)

Master of Computer Application


123
Human Resource Management System

{
ViewObject vo = null;
if(isVo)
{
vo = getViewObjectByName(name);
}
else
{
vo = getIterator(name).getViewObject();
}

if(vo == null)
{
return;
}

Row[] rows = vo.getAllRowsInRange();


if(rows == null)
{
return;
}

for (int i = 0; i < rows.length; i++)


{
Row r = rows[i];
if(r != null)
{

Master of Computer Application


124
Human Resource Management System

r.refresh(Row.REFRESH_REMOVE_NEW_ROWS |
Row.REFRESH_UNDO_CHANGES);
}
}
}

public static boolean isRowStatusNew(Row rw)


{
return EntityImpl.STATUS_NEW == getRowStatus(rw);
}

public static boolean isRowStatusUpdate(Row rw)


{
return EntityImpl.STATUS_MODIFIED == getRowStatus(rw);
}

public static byte getRowStatus(Row rw)


{
if (rw != null)
{
ViewRowImpl myRow = (ViewRowImpl) rw;
EntityImpl entityImpl = myRow.getEntity(0);
return entityImpl.getEntityState();
}
return -1;
}

public static String getClientComputerName()

Master of Computer Application


125
Human Resource Management System

{
HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
return request.getRemoteHost().split("\\.")[0];
}

public static void addCookie(String cookieName, String cookieValue)


{
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response =
(HttpServletResponse)context.getExternalContext().getResponse();

Cookie cookie = new Cookie(cookieName, cookieValue);


cookie.setMaxAge(60*60*24*365*5);
response.addCookie(cookie);
}

public static void removeCookie(String cookieName)


{
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request =
(HttpServletRequest)context.getExternalContext().getRequest();
HttpServletResponse response =
(HttpServletResponse)context.getExternalContext().getResponse();
Cookie[] cookies = request.getCookies();

if (cookies != null)
{
for (int i = 0; i < cookies.length; i++)

Master of Computer Application


126
Human Resource Management System

{
String name = cookies[i].getName();

if ((name == null) || (!name.equals(cookieName)))


continue;
cookies[i].setMaxAge(0);
response.addCookie(cookies[i]);
break;
}
}
}

public static String getCookieValue(String cookieName)


{
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request =
(HttpServletRequest)context.getExternalContext().getRequest();
Cookie[] cookies = request.getCookies();

if (cookies != null)
{
for (int i = 0; i < cookies.length; i++)
{
String name = cookies[i].getName();
String value = cookies[i].getValue();
int age = cookies[i].getMaxAge();

if ((name != null) && (name.equals(cookieName)) && (age != 0))

Master of Computer Application


127
Human Resource Management System

{
return value;
}
}
}
return null;
}

public static String getCurrentYearMonth(){


String currentYM;
LocalDate d=LocalDate.now();
currentYM=d.getMonth()+"-"+d.getYear();
return currentYM;
}

public static String getCurrentDate(){


String currentDate;
LocalDate d=LocalDate.now();
DateTimeFormatter df=DateTimeFormatter.ofPattern("dd-MM-yyyy");
currentDate=df.format(d);
return currentDate;
}

public static String getCurrentDateTime(){


String currentDateTime;
LocalDateTime d=LocalDateTime.now();
DateTimeFormatter df=DateTimeFormatter.ofPattern("dd-MM-yyyy
HH:mm:ss");

Master of Computer Application


128
Human Resource Management System

currentDateTime=df.format(d);
return currentDateTime;
}

public static String getCurrentFinYear(){


String fromYear=null,toYear=null;
String finyear=null;
LocalDate d=LocalDate.now();
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy");
fromYear=df.format(d);
toYear=String.valueOf(Integer.parseInt(fromYear)+1);
finyear=fromYear+"-"+toYear;
return finyear;
}

public static long getNoOfDays(String fromDt,String toDate){


DateTimeFormatter df = new DateTimeFormatterBuilder()
// case insensitive to parse JAN and FEB
.parseCaseInsensitive()
// add pattern
.appendPattern("dd-MMM-yyyy")
// create formatter (use English Locale to parse month names)
.toFormatter(Locale.ENGLISH);
LocalDate d1=LocalDate.parse(fromDt,df);
LocalDate d2=LocalDate.parse(toDate,df);
long noOfDays=java.time.temporal.ChronoUnit.DAYS.between(d1, d2);

Master of Computer Application


129
Human Resource Management System

return noOfDays;
}

public static Object parseDate(String dt){


DateTimeFormatter df = new DateTimeFormatterBuilder()
// case insensitive to parse JAN and FEB
.parseCaseInsensitive()
// add pattern
.appendPattern("dd-MMM-yyyy")
// create formatter (use English Locale to parse month names)
.toFormatter(Locale.ENGLISH);
LocalDate d1=LocalDate.parse(dt,df);
return d1;
}

//Get Binding Container


public static DCBindingContainer getBindingContainer(){
BindingContainer bc =
BindingContext.getCurrent().getCurrentBindingsEntry();
return (DCBindingContainer)bc;
}
//Get AM
public static AppModuleAM getApplicationModule(){
DCBindingContainer bc =getBindingContainer();
AppModuleAM am = (AppModuleAM)
bc.findDataControl("AppModuleAMDataControl").getDataProvider();
if(am != null){
return am;

Master of Computer Application


130
Human Resource Management System

}else{
throw new RuntimeException("AppModuleAM instance not
found....");
}
}

public static String roundValueBy2(double input){


DecimalFormat df= new DecimalFormat("0.00");
return df.format(input);
}
}

ConnectionManager.java [To make DB Connection with DataSource in


WebLogic Server]
package hrms.view.util;
import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class ConnectionManager {
/**To get the connection object from the pool
* @return Connection Object
*/
public static synchronized Connection getConnection() throws Exception {
Connection conn = null;
Context ctx;
try {

Master of Computer Application


131
Human Resource Management System

ctx = new InitialContext();


String DATASOURCE = "HRMSDS";
DataSource ds = (DataSource) ctx.lookup(DATASOURCE);
if (ds != null) {
conn = ds.getConnection();
conn.setAutoCommit(false);
}

} catch (Exception e) {
throw e;
}
return conn;
}

/**To release the connection taken


* @param conn Connection Object which needs to be released
*/
public static void releaseConnetion(Connection conn) {
try {
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}

Master of Computer Application


132
Human Resource Management System

HRMSException.java [To handle user defined exception]


package hrms.view.util;
public class HRMSException extends Exception {
@SuppressWarnings("compatibility:-1516646799900225633")
private static final long serialVersionUID = 6744748259112024018L;
private static String errMsg;
public HRMSException(String ErrorMessage){
errMsg=ErrorMessage;
}
@Override
public String toString() {
return errMsg;
}
}

Application Module Class at Model Layer


package hrms.model;

import hrms.model.attendance.lov.PeriodOpenLovImpl;
import hrms.model.attendance.lov.periodStatusLOVImpl;
import hrms.model.attendance.query.ApprovalStatusQueryImpl;
import hrms.model.attendance.query.AttendanceApprovalNotificationVOImpl;
import hrms.model.attendance.query.AttendanceApprovalQueryParamVOImpl;
import hrms.model.attendance.query.AttendanceProcessVOImpl;
import hrms.model.attendance.query.AttendanceQueryImpl;
import hrms.model.attendance.query.PeriodQueryVOImpl;

Master of Computer Application


133
Human Resource Management System

import hrms.model.attendance.query.Time_In_Out_VOImpl;
import hrms.model.attendance.view.AttendancePeriodVOImpl;
import hrms.model.common.AppModuleAM;
import hrms.model.emp.query.DeptQueryImpl;
import hrms.model.emp.query.DesignationQueryImpl;
import hrms.model.emp.view.DepartmentVOImpl;
import hrms.model.emp.view.DesignationVOImpl;
import hrms.model.emp.view.EmployeeVOImpl;
import hrms.model.leave.view.LeaveAppSubmissionRVOImpl;
import hrms.model.leave.view.LeaveAppSubmittedStatusRVOImpl;
import hrms.model.leave.view.LeaveApprovalRVOImpl;
import hrms.model.leave.view.LeaveAvailableBalanceRVOImpl;
import hrms.model.leave.view.LeaveProcessDetailRecRVOImpl;
import hrms.model.leave.view.LeaveProcessMasterRecRVOImpl;
import hrms.model.payroll.query.CTCEDCodeRuleVOImpl;
import hrms.model.payroll.query.CompleteCTCVOImpl;
import hrms.model.payroll.query.PayChangeQueryVOImpl;
import hrms.model.payroll.query.PayEmpDtlQueryVOImpl;
import hrms.model.payroll.query.PayEmpDtlVOImpl;
import hrms.model.payroll.view.CTCEarningVOImpl;
import hrms.model.payroll.view.CTCEmpDeductionVOImpl;
import hrms.model.payroll.view.PayProcessDetailsVOImpl;
import hrms.model.payroll.view.PayProcessMasterVOImpl;
import java.math.BigDecimal;
import java.sql.Timestamp;
import oracle.adf.share.ADFContext;
import oracle.jbo.JboException;

Master of Computer Application


134
Human Resource Management System

import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.server.EntityDefImpl;
import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.ViewLinkImpl;
import oracle.jbo.server.ViewObjectImpl;

public class AppModuleAMImpl extends ApplicationModuleImpl implements


AppModuleAM {
/**
* This is the default constructor.
*/
public AppModuleAMImpl() {
}

/**
* Container's getter for Location1.
* @return Location1
*/
public ViewObjectImpl getLocation1() {
return (ViewObjectImpl) findViewObject("Location1");
}

/**
* Container's getter for Department1.
* @return Department1

Master of Computer Application


135
Human Resource Management System

*/
public DepartmentVOImpl getDepartment1() {
return (DepartmentVOImpl) findViewObject("Department1");
}

/**
* Container's getter for DeptQuery1.
* @return DeptQuery1
*/
public DeptQueryImpl getDeptQuery1() {
return (DeptQueryImpl) findViewObject("DeptQuery1");
}

/**
* Container's getter for DesignationQuery1.
* @return DesignationQuery1
*/
public DesignationQueryImpl getDesignationQuery1() {
return (DesignationQueryImpl) findViewObject("DesignationQuery1");
}

/**
* Container's getter for Designation1.
* @return Designation1
*/
public DesignationVOImpl getDesignation1() {
return (DesignationVOImpl) findViewObject("Designation1");

Master of Computer Application


136
Human Resource Management System

/**
* Container's getter for Employee1.
* @return Employee1
*/
public EmployeeVOImpl getEmployee1() {
return (EmployeeVOImpl) findViewObject("Employee1");
}

/**
* Container's getter for SystemUser1.
* @return SystemUser1
*/
public ViewObjectImpl getSystemUser1() {
return (ViewObjectImpl) findViewObject("SystemUser1");
}

/**
* Container's getter for AttendancePeriod1.
* @return AttendancePeriod1
*/
public AttendancePeriodVOImpl getAttendancePeriod1() {
return (AttendancePeriodVOImpl) findViewObject("AttendancePeriod1");
}

/**

Master of Computer Application


137
Human Resource Management System

* Container's getter for PeriodQuery1.


* @return PeriodQuery1
*/
public PeriodQueryVOImpl getPeriodQuery1() {
return (PeriodQueryVOImpl) findViewObject("PeriodQuery1");
}

/**
* Container's getter for periodStatusLOV1.
* @return periodStatusLOV1
*/
public periodStatusLOVImpl getperiodStatusLOV1() {
return (periodStatusLOVImpl) findViewObject("periodStatusLOV1");
}

public boolean updateAttendancePeriod(String period,String status){


String entityName="hrms.model.attendance.entity.AttendancePeriodEO";
EntityDefImpl entityDef=EntityDefImpl.findDefObject(entityName);
Key periodKey=new Key(new Object[]{period});
EntityImpl entity = entityDef.findByPrimaryKey(getDBTransaction(),
periodKey);
if(entity != null){
entity.setAttribute("IsPeriodOpen", status);
getDBTransaction().commit();
return true;
}
return false;
}

Master of Computer Application


138
Human Resource Management System

/**
* Container's getter for Attendance1.
* @return Attendance1
*/
public ViewObjectImpl getAttendance1() {
return (ViewObjectImpl) findViewObject("Attendance1");
}

public void createUpdateAttendanceRow(String empId,String period,


oracle.jbo.domain.Date attendanceDate,Timestamp
timeIn,Timestamp timeOut){

System.out.println("AM-->"+empId+" "+attendanceDate+" "+timeIn+"


"+timeOut);

String entityName="hrms.model.attendance.entity.AttendanceEO";
EntityDefImpl entityDef=EntityDefImpl.findDefObject(entityName);
Key attendanceKey=new Key(new Object[]{empId+attendanceDate});
EntityImpl entity = entityDef.findByPrimaryKey(getDBTransaction(),
attendanceKey);
boolean flag=false;

System.out.println("Attendance Key : "+attendanceKey.toString());

if(entity != null){
if(period !=null)
entity.setAttribute("AttendancePeriod", period);

Master of Computer Application


139
Human Resource Management System

if(attendanceDate !=null)
entity.setAttribute("AttendanceDate", attendanceDate);
if(timeIn !=null)
entity.setAttribute("TimeIn", timeIn);
if(timeOut !=null)
entity.setAttribute("TimeOut", timeOut);
flag=true;
System.out.println("Attendance Record updated successfully....");
}else{
entity=entityDef.createInstance2(getDBTransaction(), null);
if(attendanceDate != null) {
if(empId !=null)
entity.setAttribute("EmployeeId", empId);
if(attendanceDate !=null)
entity.setAttribute("AttendanceDate", attendanceDate);
if(period !=null)
entity.setAttribute("AttendancePeriod", period);
if(timeIn !=null)
entity.setAttribute("TimeIn", timeIn);
if(timeOut !=null)
entity.setAttribute("TimeOut", timeOut);
flag=true;
System.out.println("Attendance Record inserted successfully....");
}

}
if(flag){

Master of Computer Application


140
Human Resource Management System

try{
getDBTransaction().commit();
}catch(JboException e){
getDBTransaction().rollback();
throw e;
}
}
}

/**
* Container's getter for Time_In_Out_1.
* @return Time_In_Out_1
*/
public Time_In_Out_VOImpl getTime_In_Out_1() {
return (Time_In_Out_VOImpl) findViewObject("Time_In_Out_1");
}

/**
* Container's getter for AttendanceQuery1.
* @return AttendanceQuery1
*/
public AttendanceQueryImpl getAttendanceQuery1() {
return (AttendanceQueryImpl) findViewObject("AttendanceQuery1");
}

/**
* Container's getter for ApprovalStatusQuery1.

Master of Computer Application


141
Human Resource Management System

* @return ApprovalStatusQuery1
*/
public ApprovalStatusQueryImpl getApprovalStatusQuery1() {
return (ApprovalStatusQueryImpl)
findViewObject("ApprovalStatusQuery1");
}

/**
* Container's getter for AttendanceApprovalQueryParam1.
* @return AttendanceApprovalQueryParam1
*/
public AttendanceApprovalQueryParamVOImpl
getAttendanceApprovalQueryParam1() {
return (AttendanceApprovalQueryParamVOImpl)
findViewObject("AttendanceApprovalQueryParam1");
}

/**
* Container's getter for AttendanceApprovalNotification1.
* @return AttendanceApprovalNotification1
*/
public AttendanceApprovalNotificationVOImpl
getAttendanceApprovalNotification1() {
return (AttendanceApprovalNotificationVOImpl)
findViewObject("AttendanceApprovalNotification1");
}

/**
* Container's getter for LeaveCategory1.

Master of Computer Application


142
Human Resource Management System

* @return LeaveCategory1
*/
public ViewObjectImpl getLeaveCategory1() {
return (ViewObjectImpl) findViewObject("LeaveCategory1");
}

/**
* Container's getter for LeaveProcessMasterRecR1.
* @return LeaveProcessMasterRecR1
*/
public LeaveProcessMasterRecRVOImpl getLeaveProcessMasterRecR1() {
return (LeaveProcessMasterRecRVOImpl)
findViewObject("LeaveProcessMasterRecR1");
}

/**
* Container's getter for LeaveProcessDetailRecR1.
* @return LeaveProcessDetailRecR1
*/
public LeaveProcessDetailRecRVOImpl getLeaveProcessDetailRecR1() {
return (LeaveProcessDetailRecRVOImpl)
findViewObject("LeaveProcessDetailRecR1");
}

/**
* Container's getter for LeaveProcessMasterDetailVOLink1.
* @return LeaveProcessMasterDetailVOLink1
*/

Master of Computer Application


143
Human Resource Management System

public ViewLinkImpl getLeaveProcessMasterDetailVOLink1() {


return (ViewLinkImpl)
findViewLink("LeaveProcessMasterDetailVOLink1");
}

/**
* Container's getter for LeaveAvailableBalanceR1.
* @return LeaveAvailableBalanceR1
*/
public LeaveAvailableBalanceRVOImpl getLeaveAvailableBalanceR1() {
return (LeaveAvailableBalanceRVOImpl)
findViewObject("LeaveAvailableBalanceR1");
}

/**
* Container's getter for LeaveAppSubmissionR1.
* @return LeaveAppSubmissionR1
*/
public LeaveAppSubmissionRVOImpl getLeaveAppSubmissionR1() {
return (LeaveAppSubmissionRVOImpl)
findViewObject("LeaveAppSubmissionR1");
}

/**
* Container's getter for LeaveAppSubmittedStatusR1.
* @return LeaveAppSubmittedStatusR1
*/
public LeaveAppSubmittedStatusRVOImpl
getLeaveAppSubmittedStatusR1() {

Master of Computer Application


144
Human Resource Management System

return (LeaveAppSubmittedStatusRVOImpl)
findViewObject("LeaveAppSubmittedStatusR1");
}

/**
* Container's getter for LeaveApprovalR1.
* @return LeaveApprovalR1
*/
public LeaveApprovalRVOImpl getLeaveApprovalR1() {
return (LeaveApprovalRVOImpl) findViewObject("LeaveApprovalR1");
}

/**
* Container's getter for AttendanceProcess1.
* @return AttendanceProcess1
*/
public AttendanceProcessVOImpl getAttendanceProcess1() {
return (AttendanceProcessVOImpl)
findViewObject("AttendanceProcess1");
}

/**
* Container's getter for EDCodeMaster1.
* @return EDCodeMaster1
*/
public ViewObjectImpl getEDCodeMaster1() {
return (ViewObjectImpl) findViewObject("EDCodeMaster1");
}

Master of Computer Application


145
Human Resource Management System

/**
* Container's getter for PayEmpDtl1.
* @return PayEmpDtl1
*/
public PayEmpDtlVOImpl getPayEmpDtl1() {
return (PayEmpDtlVOImpl) findViewObject("PayEmpDtl1");
}

/**
* Container's getter for PayEmpDtlQuery1.
* @return PayEmpDtlQuery1
*/
public PayEmpDtlQueryVOImpl getPayEmpDtlQuery1() {
return (PayEmpDtlQueryVOImpl) findViewObject("PayEmpDtlQuery1");
}

/**
* Container's getter for CTCEmpDeduction1.
* @return CTCEmpDeduction1
*/
public CTCEmpDeductionVOImpl getCTCEmpDeduction1() {
return (CTCEmpDeductionVOImpl)
findViewObject("CTCEmpDeduction1");
}

Master of Computer Application


146
Human Resource Management System

/**
* Container's getter for CTCEarning1.
* @return CTCEarning1
*/
public CTCEarningVOImpl getCTCEarning1() {
return (CTCEarningVOImpl) findViewObject("CTCEarning1");
}

/**
* Container's getter for CTCEDCodeRule1.
* @return CTCEDCodeRule1
*/
public CTCEDCodeRuleVOImpl getCTCEDCodeRule1() {
return (CTCEDCodeRuleVOImpl) findViewObject("CTCEDCodeRule1");
}

/**
* Get employee CTC
* @param empId
* @return
*/
public BigDecimal getEmployeeCTC(String empId){
String employeeId = (String) ADFContext.getCurrent()
.getPageFlowScope()
.get("ctc_emp_id");
//System.out.println("employeeId-->"+empId);
BigDecimal empCTC=BigDecimal.ZERO;

Master of Computer Application


147
Human Resource Management System

EmployeeVOImpl empVO= getEmployee1();


Key empKey=new Key(new Object[]{employeeId});
Row[] row=empVO.findByKey(empKey, 1);
if(row != null && row.length>0 && row[0].getAttribute("EmpCtc") !=
null ){
return new BigDecimal(row[0].getAttribute("EmpCtc").toString());
}
return empCTC;
}

/**
* Update employee CTC in employee master entity
* @param empId
* @param empCTC
* @return
*/
public boolean updateEmpCTC(String empId,BigDecimal empCTC){
String entityName="hrms.model.emp.entity.EmployeesEO";
EntityDefImpl entityDef=EntityDefImpl.findDefObject(entityName);
Key empKey=new Key(new Object[]{empId});
EntityImpl entity = entityDef.findByPrimaryKey(getDBTransaction(),
empKey);
if(entity != null){
entity.setAttribute("EmpCtc", empCTC);
//getDBTransaction().commit();
return true;
}
return false;

Master of Computer Application


148
Human Resource Management System

public BigDecimal getCTCEDCodeAmount(String empId,String edCode){


BigDecimal edCodeAmount=BigDecimal.ZERO;
CTCEarningVOImpl ctcVO= getCTCEarning1();
ctcVO.executeQuery();
System.out.println("CTC Row count-->"+ctcVO.getRowCount());
if(ctcVO != null && ctcVO.getRowCount()>0){
RowSetIterator iter=ctcVO.createRowSetIterator(null);
while(iter.hasNext()){
Row row=iter.next();
if(row.getAttribute("EdCode").equals(edCode)){
edCodeAmount = (BigDecimal) row.getAttribute("Amount");
break;
}
}
iter.closeRowSetIterator();
}
System.out.println(edCode+" amount-->"+edCodeAmount);
return edCodeAmount;
}

/**
* Container's getter for CompleteCTC1.
* @return CompleteCTC1
*/
public CompleteCTCVOImpl getCompleteCTC1() {

Master of Computer Application


149
Human Resource Management System

return (CompleteCTCVOImpl) findViewObject("CompleteCTC1");


}

/**
* Container's getter for PayChangeQuery1.
* @return PayChangeQuery1
*/
public PayChangeQueryVOImpl getPayChangeQuery1() {
return (PayChangeQueryVOImpl) findViewObject("PayChangeQuery1");
}

/**
* Container's getter for CTCPayChange1.
* @return CTCPayChange1
*/
public ViewObjectImpl getCTCPayChange1() {
return (ViewObjectImpl) findViewObject("CTCPayChange1");
}

/**
* Container's getter for PayProcessMaster1.
* @return PayProcessMaster1
*/
public PayProcessMasterVOImpl getPayProcessMaster1() {
return (PayProcessMasterVOImpl)
findViewObject("PayProcessMaster1");
}

Master of Computer Application


150
Human Resource Management System

/**
* Container's getter for PayProcessDetails1.
* @return PayProcessDetails1
*/
public PayProcessDetailsVOImpl getPayProcessDetails1() {
return (PayProcessDetailsVOImpl)
findViewObject("PayProcessDetails1");
}

/**
* Container's getter for PayMasterDetailsVOLink1.
* @return PayMasterDetailsVOLink1
*/
public ViewLinkImpl getPayMasterDetailsVOLink1() {
return (ViewLinkImpl) findViewLink("PayMasterDetailsVOLink1");
}

/**
* Container's getter for PeriodOpenLov1.
* @return PeriodOpenLov1
*/
public PeriodOpenLovImpl getPeriodOpenLov1() {
return (PeriodOpenLovImpl) findViewObject("PeriodOpenLov1");
}

/**
* Container's getter for ReportMaster1.
* @return ReportMaster1

Master of Computer Application


151
Human Resource Management System

*/
public ViewObjectImpl getReportMaster1() {
return (ViewObjectImpl) findViewObject("ReportMaster1");
}

/**
* Container's getter for ReportDetail1.
* @return ReportDetail1
*/
public ViewObjectImpl getReportDetail1() {
return (ViewObjectImpl) findViewObject("ReportDetail1");
}

/**
* Container's getter for reportVOLink1.
* @return reportVOLink1
*/
public ViewLinkImpl getreportVOLink1() {
return (ViewLinkImpl) findViewLink("reportVOLink1");
}
}

Classes at View and Controller Layer


LoginBean.java [To handle Application Login]
package hrms.view.bean;

import hrms.view.util.MyADFUtils;

Master of Computer Application


152
Human Resource Management System

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.adf.view.rich.event.PopupCanceledEvent;
import oracle.adf.view.rich.event.PopupFetchEvent;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;

public class LoginBean {


private RichInputText userIdRC;
private RichInputText passwordRC;
private RichPopup registerUserPopupRC;
private RichPopup successfullMsgPopupRC;

public LoginBean() {
}

public void setUserIdRC(RichInputText userIdRC) {


this.userIdRC = userIdRC;
}

public RichInputText getUserIdRC() {


return userIdRC;

Master of Computer Application


153
Human Resource Management System

public void setPasswordRC(RichInputText passwordRC) {


this.passwordRC = passwordRC;
}

public RichInputText getPasswordRC() {


return passwordRC;
}

public String doLoginAction() {


Connection con=null;
CallableStatement stmt=null;
String plsql="begin ?:= VALIDATE_USER_LOGIN(?,?); end;";
String userId=this.getUserIdRC().getValue().toString();
String password=this.getPasswordRC().getValue().toString();
String loginStatus=null;
String personName=null;
if(userId != null && password != null){
try{
con=MyADFUtils.getConnection();
stmt=con.prepareCall(plsql);
stmt.setString(2, userId);
stmt.setString(3, password);
stmt.registerOutParameter(1, Types.VARCHAR);
stmt.executeQuery();
loginStatus=stmt.getString(1);

Master of Computer Application


154
Human Resource Management System

}catch(SQLException e){
MyADFUtils.showErrorMessage("Error occur-->"+e.getMessage());
}finally{
MyADFUtils.close(stmt);
}

if(loginStatus != null && loginStatus.equals("VALID")){


personName=MyADFUtils.getSqlDescription("select user_name
from hrm_system_user where user_id='"+userId+"'");
MyADFUtils.putInSession("personId", userId);
MyADFUtils.putInSession("personName", personName);
System.out.println("personId = "+userId+"
,personName"+personName);
return "home";
}else{
MyADFUtils.showErrorMessage("User not found.");
throw new RuntimeException();
}
}else{
MyADFUtils.showErrorMessage("Please enter the userId and
password...");
throw new RuntimeException("Please enter the userId and
password...");
}
}

public void registerUserPopupFetchListner(PopupFetchEvent


popupFetchEvent) {

Master of Computer Application


155
Human Resource Management System

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("SystemUser1Iterator");
if(vo != null){
MyADFUtils.executeOperation("CreateInsert");
}
}

public void registerUserPopupCancelListner(PopupCanceledEvent


popupCanceledEvent) {
MyADFUtils.executeOperation("Rollback");
}

public void registerNewUserDialogListner(DialogEvent dialogEvent) {


String userId,password,reEnteredPassword;
ViewObject
vo=MyADFUtils.getViewObjectFromIterator("SystemUser1Iterator");
Row row = vo.getCurrentRow();
if(row != null){
userId = (String) row.getAttribute("UserId");
password = (String) row.getAttribute("LoginPassword");
reEnteredPassword = (String) row.getAttribute("ReEnterPassword");
if(userId != null){
if(password.equals(reEnteredPassword)){
MyADFUtils.executeOperation("Commit");
MyADFUtils.showPopup(this.getSuccessfullMsgPopupRC());
}else{
MyADFUtils.showErrorMessage("Password and Re-Entered
password not matching");
throw new RuntimeException();

Master of Computer Application


156
Human Resource Management System

}
}else{
MyADFUtils.showErrorMessage("Please select user id from the list");
throw new RuntimeException();
}
}
}

public void setRegisterUserPopupRC(RichPopup registerUserPopupRC) {


this.registerUserPopupRC = registerUserPopupRC;
}

public RichPopup getRegisterUserPopupRC() {


return registerUserPopupRC;
}

public void setSuccessfullMsgPopupRC(RichPopup


successfullMsgPopupRC) {
this.successfullMsgPopupRC = successfullMsgPopupRC;
}

public RichPopup getSuccessfullMsgPopupRC() {


return successfullMsgPopupRC;
}

public String goTohomeAction() {


MyADFUtils.navigateToPage("home");
return null;

Master of Computer Application


157
Human Resource Management System

}
}

EmpInfoMgmtBean.java [To handle all the actions on Employee


Information Management Module]
package hrms.view.bean;
import hrms.model.emp.view.common.DesignationVO;
import hrms.view.util.MyADFUtils;
import javax.faces.event.ActionEvent;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.nav.RichButton;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.adf.view.rich.event.PopupCanceledEvent;
import oracle.adf.view.rich.event.PopupFetchEvent;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;

public class EmpInfoMgmtBean {


private RichPopup successMsgPopup;
private RichPopup deleteConfirmationPopup;
private String successMsgTextRC;
private boolean locationEditFlag;
private RichPopup createLocationPopup;
private String locationPopupTitle;
private String reportName;

public EmpInfoMgmtBean() {

Master of Computer Application


158
Human Resource Management System

this.successMsgTextRC="Data Saved Successfully";


this.locationEditFlag=false;
this.locationPopupTitle="Create Location";
}

public void setLocationPopupTitle(String locationPopupTitle) {


this.locationPopupTitle = locationPopupTitle;
}

public String getLocationPopupTitle() {


return locationPopupTitle;
}

public void setLocationEditFlag(boolean locationEditFlag) {


this.locationEditFlag = locationEditFlag;
}

public boolean isLocationEditFlag() {


return locationEditFlag;
}

/*
* If LocationEditFlag is not true then only create the new record
*/
public void createLocationFetchListner(PopupFetchEvent popupFetchEvent)
{
// System.out.println("Create location Popup title --
>"+this.getLocationPopupTitle()+" ; "+this.isLocationEditFlag());

Master of Computer Application


159
Human Resource Management System

if(!this.isLocationEditFlag())
MyADFUtils.executeOperation("CreateInsert");
else
this.setLocationEditFlag(false);
}

public void createLocationCanceledListner(PopupCanceledEvent


popupCanceledEvent) {
ViewObject
vo=MyADFUtils.getViewObjectFromIterator("Location1Iterator");
if(vo != null && vo.getCurrentRow() != null){
MyADFUtils.cancelChangesInCurrentRow("Location1Iterator");
}
MyADFUtils.executeOperation("Rollback");
}

public void createLocationDialogListner(DialogEvent dialogEvent)throws


Exception {
// Add event code here...
Row
row=MyADFUtils.getViewObjectFromIterator("Location1Iterator").getCurrent
Row();
if(row != null){
if(MyADFUtils.isRowStatusNew(row) ||
MyADFUtils.isRowStatusUpdate(row)) {
this.validateLocationEntry();
MyADFUtils.executeOperation("Commit");
MyADFUtils.executeOperation("Execute");
MyADFUtils.showPopup(this.getSuccessMsgPopup());

Master of Computer Application


160
Human Resource Management System

}
}

public void setSuccessMsgPopup(RichPopup successMsgPopup) {


this.successMsgPopup = successMsgPopup;
}

public RichPopup getSuccessMsgPopup() {


return successMsgPopup;
}

public void validateLocationEntry(){


ViewObject
vo=MyADFUtils.getViewObjectFromIterator("Location1Iterator");
if(vo != null && vo.getCurrentRow() != null){
Row row=vo.getCurrentRow();
if(row.getAttribute("LocationName") == null ||
row.getAttribute("City") == null ||
row.getAttribute("State") == null ||
row.getAttribute("Country") == null
){
MyADFUtils.showErrorMessage("Please enter the data for all the
fields.");
throw new RuntimeException("Please enter the data for all the
fields.");
}

Master of Computer Application


161
Human Resource Management System

}
}

public void setDeleteConfirmationPopup(RichPopup


deleteConfirmationPopup) {
this.deleteConfirmationPopup = deleteConfirmationPopup;
}

public RichPopup getDeleteConfirmationPopup() {


return deleteConfirmationPopup;
}

public void setSuccessMsgTextRC(String successMsgTextRC) {


this.successMsgTextRC = successMsgTextRC;
}

public String getSuccessMsgTextRC() {


return successMsgTextRC;
}

public void locationDeleteDialog(DialogEvent dialogEvent) {


if(dialogEvent.getOutcome().equals(DialogEvent.Outcome.yes)){
//System.out.println("Inside delete record");
try{
Row
row=MyADFUtils.getViewObjectFromIterator("Location1Iterator").getCurrent
Row();
if(row != null){

Master of Computer Application


162
Human Resource Management System

row.remove();
MyADFUtils.executeOperation("Commit");
MyADFUtils.executeOperation("Execute");
this.setSuccessMsgTextRC("Record deleted successfully...");
MyADFUtils.showPopup(getSuccessMsgPopup());
}
}catch(Exception e){
MyADFUtils.showErrorMessage("Record not found for
delete."+e.getMessage());
}
}
}

public void locationDeleteActionListner(ActionEvent actionEvent) {


MyADFUtils.showPopup(getDeleteConfirmationPopup());
}

public void editLocationActionListner(ActionEvent actionEvent) {


this.setLocationEditFlag(true);
this.setLocationPopupTitle("Edit Location");
MyADFUtils.showPopup(getCreateLocationPopup());
//this.setLocationEditFlag(false);
}

public void setCreateLocationPopup(RichPopup createLocationPopup) {


this.createLocationPopup = createLocationPopup;
}

Master of Computer Application


163
Human Resource Management System

public RichPopup getCreateLocationPopup() {


return createLocationPopup;
}

public void saveDepartmentListner(ActionEvent actionEvent) {


MyADFUtils.executeOperation("Commit");
this.setSuccessMsgTextRC("Data Saved successfully...");
MyADFUtils.showPopup(getSuccessMsgPopup());
}

public void queryDeptListner(ActionEvent actionEvent) {


String deptId = (String)
MyADFUtils.getAttributeFromIterator("DeptQuery1Iterator", "DeptId");
String locId = (String)
MyADFUtils.getAttributeFromIterator("DeptQuery1Iterator", "LocationId");
ViewObject
vo=MyADFUtils.getViewObjectFromIterator("Department1Iterator");
String whereClause=" (dept_id="+deptId+" or "+deptId+" is null)"+
"and (dept_location_id = "+locId+" or "+locId+" is null)";
// if(deptId !=null || locId != null){
vo.setWhereClauseParams(null);
vo.setWhereClause(null);
vo.setWhereClause(whereClause);
vo.executeQuery();
// }
}

public void resetDeptQueryParams(ActionEvent actionEvent) {

Master of Computer Application


164
Human Resource Management System

MyADFUtils.setAttributeInIterator("DeptQuery1Iterator", "DeptId", null);


MyADFUtils.setAttributeInIterator("DeptQuery1Iterator", "DeptName",
null);
MyADFUtils.setAttributeInIterator("DeptQuery1Iterator", "LocationId",
null);
MyADFUtils.setAttributeInIterator("DeptQuery1Iterator", "DeptLocation",
null);
}

public void saveDesignationListner(ActionEvent actionEvent) {


MyADFUtils.executeOperation("Commit");
this.setSuccessMsgTextRC("Data Saved successfully...");
MyADFUtils.showPopup(getSuccessMsgPopup());
}

public void searchDesignationListner(ActionEvent actionEvent) {


String desigId = (String)
MyADFUtils.getAttributeFromIterator("DesignationQuery1Iterator",
"DesigId");
DesignationVO vo = (DesignationVO)
MyADFUtils.getViewObjectFromIterator("Designation1Iterator");
vo.filterDesignation(desigId);
}

public void SaveEmpMasterListner(ActionEvent actionEvent) {


MyADFUtils.executeOperation("Commit");
this.setSuccessMsgTextRC("Data Saved successfully...");
MyADFUtils.showPopup(getSuccessMsgPopup());

Master of Computer Application


165
Human Resource Management System

public void createEmpMasterRecord(){


MyADFUtils.executeOperation("CreateInsert");
}

public String createEmpMenuAction() {


createEmpMasterRecord();
return "create_emp";
}

public void setReportName(String reportName) {


this.reportName = reportName;
}

public String getReportName() {


return reportName;
}

public String callReportPageMenuAL() {


this.setReportName("Employee_detail");
return "print_report";
}
}

Classes for Attendance Module

Master of Computer Application


166
Human Resource Management System

AttendanceBean.java [It will handle all the navigation in Attendance


Module]

package hrms.view.bean;

import hrms.view.util.ConnectionManager;

import hrms.view.util.MyADFUtils;

import java.sql.CallableStatement;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.Types;

import javax.faces.event.ActionEvent;

import oracle.adf.view.rich.component.rich.RichPopup;

import oracle.adf.view.rich.event.DialogEvent;

import oracle.adf.view.rich.event.PopupCanceledEvent;

import oracle.adf.view.rich.event.PopupFetchEvent;

public class AttendanceBean {

private String attendanceTranPageName;

private String successMessageTxt;

private boolean confirmationFlag;

private RichPopup confirmationPopup;

private RichPopup successfullMsgPopup;

private String reportName;

public AttendanceBean() {

Master of Computer Application


167
Human Resource Management System

this.setAttendanceTranPageName("status");

this.setConfirmationFlag(false);

public void setConfirmationFlag(boolean confirmationFlag) {

this.confirmationFlag = confirmationFlag;

public boolean isConfirmationFlag() {

return confirmationFlag;

public void setAttendanceTranPageName(String attendanceTranPageName)


{

this.attendanceTranPageName = attendanceTranPageName;

public String getAttendanceTranPageName() {

return attendanceTranPageName;

public String attentionPeriodLinkAction() {

this.setAttendanceTranPageName("periodSetup");

return "attendanceTran";

Master of Computer Application


168
Human Resource Management System

public String approvalStatusLinkAction() {

this.setAttendanceTranPageName("status");

return "attendanceTran";

public String approvalNotificationLinkAction() {

this.setAttendanceTranPageName("approvalNotification");

return "attendanceTran";

public String timeInOutLinkAction() {

this.setAttendanceTranPageName("inout");

return "attendanceTran";

public void
cancelAttendanceProcessPopupCanceledListner(PopupCanceledEvent
popupCanceledEvent) {

MyADFUtils.executeOperation("Rollback");

public void AttendanceProcessActionListner(ActionEvent actionEvent) {

//Ask user confirmation

MyADFUtils.showPopup(this.getConfirmationPopup());

Master of Computer Application


169
Human Resource Management System

public void setSuccessMessageTxt(String successMessageTxt) {

this.successMessageTxt = successMessageTxt;

public String getSuccessMessageTxt() {

return successMessageTxt;

public void ConfirmationDialogListner(DialogEvent dialogEvent) {

if(dialogEvent.getOutcome()==DialogEvent.Outcome.ok){

this.setConfirmationFlag(true);

processAttendance();

}else{

this.setConfirmationFlag(false);

public void ConfirmationCancelledListner(PopupCanceledEvent


popupCanceledEvent) {

this.setConfirmationFlag(false);

public void setConfirmationPopup(RichPopup confirmationPopup) {

Master of Computer Application


170
Human Resource Management System

this.confirmationPopup = confirmationPopup;

public RichPopup getConfirmationPopup() {

return confirmationPopup;

public void setSuccessfullMsgPopup(RichPopup successfullMsgPopup) {

this.successfullMsgPopup = successfullMsgPopup;

public RichPopup getSuccessfullMsgPopup() {

return successfullMsgPopup;

/*

* This is the method for attendance process

*/

public void processAttendance(){

Connection con=null;

CallableStatement cstmt=null;

String plsql="{call
ATTENDANCE_PROCESS.process_attendance(?,?,?)}";

String atdPeriod=null,empId=null,msg=null;

//Get Input values for attendance process

Master of Computer Application


171
Human Resource Management System

if(MyADFUtils.getIterator("AttendanceProcess1Iterator") != null){

atdPeriod =

(String)
MyADFUtils.getAttributeFromIterator("AttendanceProcess1Iterator",
"AttendancePeriod");

empId = (String)
MyADFUtils.getAttributeFromIterator("AttendanceProcess1Iterator",
"EmpId");

if(atdPeriod == null){

MyADFUtils.showErrorMessage("Attendance Period is mandatory.");

throw new RuntimeException("Attendance Period is mandatory.");

//Get DB Connection

try {

con = ConnectionManager.getConnection();

} catch (Exception e) {

MyADFUtils.showErrorMessage("Unable to get DB
Connection.Contact IT.");

throw new RuntimeException("Unable to get DB Connection.Contact


IT.");

try {

cstmt=con.prepareCall(plsql);

Master of Computer Application


172
Human Resource Management System

cstmt.setString(1, atdPeriod);

if(empId==null){

cstmt.setNull(2, Types.VARCHAR);

}else{

cstmt.setString(2, empId);

cstmt.registerOutParameter(3, Types.VARCHAR);

cstmt.executeQuery();

msg=cstmt.getString(3);

if(msg != null){

this.setSuccessMessageTxt(msg);

}else{

this.setSuccessMessageTxt("Something went wrong, Please contact to


IT.");

MyADFUtils.showPopup(this.getSuccessfullMsgPopup());

} catch (SQLException e) {

MyADFUtils.showErrorMessage("Error occur in Attendance process--


>"+e.getMessage());

}finally{

ConnectionManager.releaseConnetion(con);

MyADFUtils.close(cstmt);

public void setReportName(String reportName) {

Master of Computer Application


173
Human Resource Management System

this.reportName = reportName;

public String getReportName() {

return reportName;

public String callEmployeeAttendanceReportAL() {

this.setReportName("Attendance_detail");

return "print_report";

AttendanceTranBean.java [To handle the transactions in Attendance


Module]

package hrms.view.bean;

import hrms.model.AppModuleAMImpl;

import hrms.model.attendance.query.common.ApprovalStatusQuery;

import hrms.model.attendance.query.common.Time_In_Out_VO;

import hrms.view.util.ConnectionManager;

import hrms.view.util.HRMSException;

import hrms.view.util.MyADFUtils;

import java.sql.CallableStatement;

import java.sql.Connection;

import java.sql.PreparedStatement;

Master of Computer Application


174
Human Resource Management System

import java.sql.SQLException;

import java.sql.Timestamp;

import java.sql.Types;

import java.time.LocalDate;

import java.time.LocalDateTime;

import javax.faces.application.FacesMessage;

import javax.faces.component.UIComponent;

import javax.faces.context.FacesContext;

import javax.faces.event.ActionEvent;

import javax.faces.event.ValueChangeEvent;

import javax.faces.validator.ValidatorException;

import oracle.adf.view.rich.component.rich.RichPopup;

import oracle.adf.view.rich.component.rich.input.RichInputDate;

import oracle.adf.view.rich.component.rich.input.RichSelectBooleanCheckbox;

import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;

import oracle.adf.view.rich.event.DialogEvent;

import oracle.adf.view.rich.event.PopupCanceledEvent;

import oracle.adf.view.rich.event.PopupFetchEvent;

import oracle.jbo.Row;

import oracle.jbo.ViewObject;

import org.eclipse.persistence.jpa.rs.util.HrefHelper;

public class AttendanceTranBean {

private RichPopup periodOpenClosePopup;

private RichPopup successMsgPopup;

Master of Computer Application


175
Human Resource Management System

private String successMsgTxt;

private RichPopup errorMessagePopup;

private String errorMessageText;

private RichSelectOneChoice attendancePeriodRC;

private RichInputDate attendanceDateRC;

private RichInputDate timeInRC;

private RichInputDate timeOutRC;

private RichSelectBooleanCheckbox selectAttendanceRecRC;

private boolean atnSelectCB;

private RichSelectBooleanCheckbox approveAllCBRC;

private RichSelectBooleanCheckbox approveCBRC;

private RichSelectBooleanCheckbox rejectAllCBRC;

private RichSelectBooleanCheckbox rejectCBRC;

private boolean approveCB;

public AttendanceTranBean() {

this.errorMessageText = "Error found";

public void periodEntryPopupFetchListner(PopupFetchEvent


popupFetchEvent) {

MyADFUtils.executeOperation("CreateInsert");

public void attendanceTranPopupCanceListnerl(PopupCanceledEvent


popupCanceledEvent) {

MyADFUtils.executeOperation("Rollback");

Master of Computer Application


176
Human Resource Management System

public String openPeriodListner() {

MyADFUtils.showPopup(this.getPeriodOpenClosePopup());

return null;

public void closePeriod(ActionEvent actionEvent) {

MyADFUtils.showPopup(this.getPeriodOpenClosePopup());

public void setPeriodOpenClosePopup(RichPopup periodOpenClosePopup) {

this.periodOpenClosePopup = periodOpenClosePopup;

public RichPopup getPeriodOpenClosePopup() {

return periodOpenClosePopup;

public void setSuccessMsgPopup(RichPopup successMsgPopup) {

this.successMsgPopup = successMsgPopup;

public RichPopup getSuccessMsgPopup() {

return successMsgPopup;

Master of Computer Application


177
Human Resource Management System

public void setSuccessMsgTxt(String successMsgTxt) {

this.successMsgTxt = successMsgTxt;

public String getSuccessMsgTxt() {

return successMsgTxt;

public void openClosePopupDialogListner(DialogEvent dialogEvent) {

String periodFlag = (String)


MyADFUtils.getAttributeFromIterator("AttendancePeriod1Iterator",
"IsPeriodOpen");

if(periodFlag != null && periodFlag.equals("Y")){

MyADFUtils.executeOperation("Commit");

this.setSuccessMsgTxt("Period Opened Successfully...");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PeriodQuery1Iterator");

vo.executeQuery();

}else{

MyADFUtils.showErrorMessage("Please select status as a Open");

throw new RuntimeException();

Master of Computer Application


178
Human Resource Management System

public void closePeriodPopup(PopupCanceledEvent popupCanceledEvent) {

MyADFUtils.executeOperation("Rollback");

public void closePeriodDialogListner(DialogEvent dialogEvent) {

String period=null,status=null;

AppModuleAMImpl
am=(AppModuleAMImpl)MyADFUtils.getDefaultApplicationModule();

Row
row=MyADFUtils.getViewObjectFromIterator("PeriodQuery1Iterator").getCurr
entRow();

if(row != null){

period = (String) row.getAttribute("AttendancePeriod");

status = (String) row.getAttribute("Status");

if(period != null && (status != null && status.equals("N"))){

if(am.updateAttendancePeriod(period, status)){

this.setSuccessMsgTxt("Period Closed Successfully...");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

MyADFUtils.getViewObjectFromIterator("PeriodQuery1Iterator").executeQuer
y();

}else{

MyADFUtils.showErrorMessage("Something went wrong, Please


contact IT.");

}else{

Master of Computer Application


179
Human Resource Management System

MyADFUtils.showErrorMessage("Please select status as a Close


only.");

public void queryAttendanceActionLisnter(ActionEvent actionEvent) {

String empId = (String)


MyADFUtils.getAttributeFromIterator("AttendanceQuery1Iterator", "Empid");

String atdPeriod = (String)


MyADFUtils.getAttributeFromIterator("AttendanceQuery1Iterator",
"AtdPeriod");

if(empId == null){

MyADFUtils.showErrorMessage("Please select Employee Id");

throw new RuntimeException();

if(atdPeriod == null){

MyADFUtils.showErrorMessage("Please select Attendance Period");

throw new RuntimeException();

Time_In_Out_VO vo = (Time_In_Out_VO)
MyADFUtils.getViewObjectFromIterator("Time_In_Out_1Iterator");

if(vo != null){

vo.getEmpAttendance(empId, atdPeriod);

Master of Computer Application


180
Human Resource Management System

public void submitAttendanceActionListner(ActionEvent actionEvent)throws


HRMSException {

boolean selectFlag=false;

String employeeId,attendancePeriod;

Timestamp timeIn,timeOut,attendanceDate;

LocalDate atdDate=null;

LocalDateTime inTime=null,outTime=null;

if(MyADFUtils.getViewObjectFromIterator("Time_In_Out_1Iterator") !=
null){

employeeId =
(String)MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"EmployeeId");

attendancePeriod =
(String)MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"AttendancePeriod");

attendanceDate =
(Timestamp)MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"AttendanceDate");

timeIn =
(Timestamp)MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"TimeIn");

timeOut =
(Timestamp)MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"TimeOut");

if(MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"selectionFlag") !=null)

selectFlag =
Boolean.parseBoolean(MyADFUtils.getAttributeFromIterator("Time_In_Out_1
Iterator", "selectionFlag").toString());

if(selectFlag){

Master of Computer Application


181
Human Resource Management System

if(employeeId != null && attendanceDate != null){

//Validate selected record

try{

if(timeIn != null && timeOut != null){

inTime=timeIn.toLocalDateTime();

outTime=timeOut.toLocalDateTime();

if(inTime.getDayOfMonth() != outTime.getDayOfMonth() ||

inTime.getDayOfWeek() != outTime.getDayOfWeek() ||

inTime.getHour()> outTime.getHour()

){

String errMsg="Invalid Time-In and Time-Out found.Please


correct & re-submit.";

this.setErrorMessageText(errMsg);

throw new HRMSException(this.getErrorMessageText());

}catch(HRMSException he){

// MyADFUtils.showPopup(this.getErrorMessagePopup());

MyADFUtils.showErrorMessage(he.toString());

throw new RuntimeException();

try{

if(this.submitEmployeeAttendance(employeeId,
attendancePeriod, attendanceDate, timeIn, timeOut)){

Master of Computer Application


182
Human Resource Management System

this.setSuccessMsgTxt("Attendance submitted
Successfully...");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

MyADFUtils.getViewObjectFromIterator("Time_In_Out_1Iterator").executeQu
ery();

}else{

this.setErrorMessageText("Something went wrong.Please


contact IT.");

MyADFUtils.showPopup(this.getErrorMessagePopup());

}catch(Exception e){

e.printStackTrace();

this.setErrorMessageText("Error occur-->"+e.getMessage());

MyADFUtils.showPopup(this.getErrorMessagePopup());

throw new HRMSException(this.getErrorMessageText());

}else{

this.setErrorMessageText("Employee Id and Attendance date must


be entered");

MyADFUtils.showPopup(this.getErrorMessagePopup());

}else{

this.setErrorMessageText("Please seclect checkbox for submit the


attendance.");

MyADFUtils.showPopup(this.getErrorMessagePopup());

Master of Computer Application


183
Human Resource Management System

public void createNewAttendanceRowActionListner(ActionEvent


actionEvent) {

MyADFUtils.executeOperation("CreateInsert");

public boolean submitEmployeeAttendance(String empId, String period,

Timestamp attendanceDate, Timestamp timeIn,

Timestamp timeOut){

Connection con=null;

CallableStatement stmt=null;

String plsql="{call SUBMIT_TIME_IN_OUT(?,?,?,?,?,?)}";

String status="Fail";

boolean flag=false;

try{

con=ConnectionManager.getConnection();

stmt=con.prepareCall(plsql);

stmt.setString(1, empId);

stmt.setString(2, period);

stmt.setTimestamp(3, attendanceDate);

stmt.setTimestamp(4, timeIn);

stmt.setTimestamp(5, timeOut);

stmt.registerOutParameter(6, Types.VARCHAR);

Master of Computer Application


184
Human Resource Management System

stmt.execute();

status=stmt.getString(6);

}catch(Exception se){

se.printStackTrace();

}finally{

MyADFUtils.close(stmt);

ConnectionManager.releaseConnetion(con);

if(status != null && status.equals("Success")){

flag= true;

return flag;

public boolean validateAttendanceDetails(String empId,Object


attendanceDate){

boolean flag=false;

Connection con=null;

CallableStatement stmt=null;

String plsql="{?=call
GET_ATTENDANCE_SUBMISSION_STATUS(?,?)}";

String status="FOUND";

try{

con=ConnectionManager.getConnection();

stmt=con.prepareCall(plsql);

Master of Computer Application


185
Human Resource Management System

stmt.setString(2, empId);

stmt.setObject(3, attendanceDate);

stmt.registerOutParameter(1, Types.VARCHAR);

stmt.execute();

status=stmt.getString(1);

// System.out.println("Attendance Status-->"+status);

}catch(Exception se){

se.printStackTrace();

}finally{

MyADFUtils.close(stmt);

ConnectionManager.releaseConnetion(con);

if(status != null && status.equals("NOT_FOUND")){

flag= true;

return flag;

public void setErrorMessagePopup(RichPopup errorMessagePopup) {

this.errorMessagePopup = errorMessagePopup;

public RichPopup getErrorMessagePopup() {

return errorMessagePopup;

Master of Computer Application


186
Human Resource Management System

public void setErrorMessageText(String errorMessageText) {

this.errorMessageText = errorMessageText;

public String getErrorMessageText() {

return errorMessageText;

public void setAttendancePeriodRC(RichSelectOneChoice


attendancePeriodRC) {

this.attendancePeriodRC = attendancePeriodRC;

public RichSelectOneChoice getAttendancePeriodRC() {

return attendancePeriodRC;

public void setAttendanceDateRC(RichInputDate attendanceDateRC) {

this.attendanceDateRC = attendanceDateRC;

public RichInputDate getAttendanceDateRC() {

return attendanceDateRC;

Master of Computer Application


187
Human Resource Management System

public void setTimeInRC(RichInputDate timeInRC) {

this.timeInRC = timeInRC;

public RichInputDate getTimeInRC() {

return timeInRC;

public void setTimeOutRC(RichInputDate timeOutRC) {

this.timeOutRC = timeOutRC;

public RichInputDate getTimeOutRC() {

return timeOutRC;

public void setSelectAttendanceRecRC(RichSelectBooleanCheckbox


selectAttendanceRecRC) {

this.selectAttendanceRecRC = selectAttendanceRecRC;

public RichSelectBooleanCheckbox getSelectAttendanceRecRC() {

return selectAttendanceRecRC;

Master of Computer Application


188
Human Resource Management System

public void atnSelectionListner(ValueChangeEvent valueChangeEvent) {

// String flag = (String)


MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"selectionFlag");

if(valueChangeEvent.getNewValue().toString().equals("true")){

MyADFUtils.setAttributeInIterator("Time_In_Out_1Iterator",
"selectionFlag", "true");

this.setAtnSelectCB(true);

} else{

MyADFUtils.setAttributeInIterator("Time_In_Out_1Iterator",
"selectionFlag", "false");

this.setAtnSelectCB(false);

public void setAtnSelectCB(boolean atnSelectCB) {

this.atnSelectCB = atnSelectCB;

public boolean getAtnSelectCB() {

return atnSelectCB;

public void attendanceDateValidator(FacesContext facesContext,


UIComponent uIComponent, Object object) {

String errMsg=null,employeeId=null;

Master of Computer Application


189
Human Resource Management System

Object
attendanceDate=Timestamp.valueOf(object.toString()).toLocalDateTime().toLo
calDate();

if(object != null){

employeeId =
(String)MyADFUtils.getAttributeFromIterator("Time_In_Out_1Iterator",
"EmployeeId");

errMsg="Attendance date "+attendanceDate+" already submitted.";

//System.out.println("Dt Val--
>"+validateAttendanceDetails(employeeId,attendanceDate));

if(validateAttendanceDetails(employeeId,attendanceDate)==false)

throw new ValidatorException(new FacesMessage(errMsg));

public void filterAttendanceStatusChangeListner(ValueChangeEvent


valueChangeEvent) {

ApprovalStatusQuery vo =

(ApprovalStatusQuery)
MyADFUtils.getViewObjectFromIterator("ApprovalStatusQuery1Iterator");

System.out.println("Period selected--
>"+valueChangeEvent.getNewValue().toString());

vo.setAttendancePeriodForQueryAndExecute(valueChangeEvent.getNewValue
().toString());

public void setApproveAllCBRC(RichSelectBooleanCheckbox


approveAllCBRC) {

Master of Computer Application


190
Human Resource Management System

this.approveAllCBRC = approveAllCBRC;

public RichSelectBooleanCheckbox getApproveAllCBRC() {

return approveAllCBRC;

public void setApproveCBRC(RichSelectBooleanCheckbox approveCBRC)


{

this.approveCBRC = approveCBRC;

public RichSelectBooleanCheckbox getApproveCBRC() {

return approveCBRC;

public void setRejectAllCBRC(RichSelectBooleanCheckbox rejectAllCBRC)


{

this.rejectAllCBRC = rejectAllCBRC;

public RichSelectBooleanCheckbox getRejectAllCBRC() {

return rejectAllCBRC;

public void setRejectCBRC(RichSelectBooleanCheckbox rejectCBRC) {

Master of Computer Application


191
Human Resource Management System

this.rejectCBRC = rejectCBRC;

public RichSelectBooleanCheckbox getRejectCBRC() {

return rejectCBRC;

public void approveAttendanceCBRowChangeListner(ValueChangeEvent


valueChangeEvent) {

if(MyADFUtils.getIterator("AttendanceApprovalNotification1Iterator")!=
null){

if(valueChangeEvent.getNewValue().toString().equals("true")){

MyADFUtils.setAttributeInIterator("AttendanceApprovalNotification1Iterator",
"approve", "Y");

}else{

MyADFUtils.setAttributeInIterator("AttendanceApprovalNotification1Iterator",
"approve", "N");

System.out.println("Select Attendance Date--


>"+MyADFUtils.getAttributeFromIterator("AttendanceApprovalNotification1It
erator", "AttendanceDate"));

}else{

System.out.println("Attendance Approval Iterator is null...");

Master of Computer Application


192
Human Resource Management System

public void rejectAttendanceRowCBChangeListner(ValueChangeEvent


valueChangeEvent) {

if(MyADFUtils.getIterator("AttendanceApprovalNotification1Iterator")!=
null){

if(valueChangeEvent.getNewValue().toString().equals("true")){

MyADFUtils.setAttributeInIterator("AttendanceApprovalNotification1Iterator",
"reject", "Y");

}else{

MyADFUtils.setAttributeInIterator("AttendanceApprovalNotification1Iterator",
"reject", "N");

System.out.println("Select Attendance Date--


>"+MyADFUtils.getAttributeFromIterator("AttendanceApprovalNotification1It
erator", "AttendanceDate"));

}else{

System.out.println("Rejected CB Attendance Approval Iterator is


null...");

public void approveAllCBChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("AttendanceApprovalNotification
1Iterator");

boolean flag=true;

Master of Computer Application


193
Human Resource Management System

if(vo != null &&


MyADFUtils.getIterator("AttendanceApprovalNotification1Iterator")!= null){

if(valueChangeEvent.getNewValue().toString().equals("true")){

vo.setCurrentRow(vo.first());

while(flag){

Row row=vo.getCurrentRow();

if(row != null){

row.setAttribute("approve", "Y");

//this.getApproveCBRC().setChanged(Boolean.TRUE);

this.getApproveCBRC().setValue(Boolean.TRUE);

if(vo.hasNext()){

vo.setCurrentRow(vo.next());

}else{

flag=false;

}else{

vo.setCurrentRow(vo.first());

while(flag){

Row row=vo.getCurrentRow();

if(row != null){

row.setAttribute("approve", "N");

//this.getApproveCBRC().setChanged(Boolean.FALSE);

this.getApproveCBRC().setValue(Boolean.FALSE);

Master of Computer Application


194
Human Resource Management System

if(vo.hasNext()){

vo.setCurrentRow(vo.next());

}else{

flag=false;

public void approveAttendanceActionListner(ActionEvent actionEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("AttendanceApprovalNotification
1Iterator");

boolean flag=true;

String empId=null,cb=null;

Object attendancedate=null,timeIn=null,timeOut=null;

PreparedStatement ps=null;

Connection con=null;

String sql= "update hrm_attendance set is_attendance_approved=?"+

"where employee_id=?"+

"and attendance_date=?";

try{

con=ConnectionManager.getConnection();

ps=con.prepareStatement(sql);

Master of Computer Application


195
Human Resource Management System

if(vo != null){

vo.setCurrentRow(vo.first());

while(flag){

Row row=vo.getCurrentRow();

if(row != null){

empId = (String) row.getAttribute("EmployeeId");

attendancedate=row.getAttribute("AttendanceDate");

timeIn=row.getAttribute("TimeIn");

timeOut=row.getAttribute("TimeOut");

cb = (String) row.getAttribute("approve");

if(timeIn != null && timeOut != null){

if(empId != null && attendancedate != null){

approveAttendanceInDB(empId,attendancedate,ps,"Y");

}else{

throw new HRMSException("Employee Id and Attendance


date should not empty.");

}else{

throw new HRMSException("Time-In and Time-Out should


not empty.");

if(vo.hasNext()){

vo.setCurrentRow(vo.next());

}else{

flag=false;

Master of Computer Application


196
Human Resource Management System

ps.executeBatch();

con.commit();

this.setSuccessMsgTxt("Attendance Approved Successfully...");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

MyADFUtils.getViewObjectFromIterator("AttendanceApprovalNotification1Ite
rator").executeQuery();

}catch(HRMSException e){

MyADFUtils.showErrorMessage(e.toString());

throw new RuntimeException();

}catch(Exception ex){

MyADFUtils.showErrorMessage(ex.getMessage());

throw new RuntimeException();

}finally{

MyADFUtils.close(ps);

ConnectionManager.releaseConnetion(con);

public void setApproveCB(boolean approveCB) {

this.approveCB = approveCB;

Master of Computer Application


197
Human Resource Management System

public boolean getApproveCB() {

return approveCB;

/**

* @param empId

* @param atnDate

* @param ps

* @param approvalFlag Y means Approved and N means Reject

* @throws HRMSException

*/

public void approveAttendanceInDB(Object empId,Object atnDate,

PreparedStatement ps,

Object approvalFlag)throws HRMSException{

if(empId != null && atnDate != null && approvalFlag != null){

try{

ps.setObject(1, approvalFlag);

ps.setObject(2, empId);

ps.setObject(3, atnDate);

ps.addBatch();

}catch(SQLException ex){

throw new HRMSException("Unable to set Attandance Update SQL--


>"+ex.getMessage().toString());

Master of Computer Application


198
Human Resource Management System

LeaveBean.java [It will handle all the functionality in the Leave


Management Module]

package hrms.view.bean;

import hrms.model.leave.view.LeaveAppSubmittedStatusRVOImpl;

import hrms.view.util.ConnectionManager;

import hrms.view.util.MyADFUtils;

import java.math.BigDecimal;

import java.sql.CallableStatement;

import java.sql.Connection;

import java.sql.Timestamp;

import java.sql.Types;

import javax.faces.event.ActionEvent;

import javax.faces.event.ValueChangeEvent;

import oracle.adf.view.rich.component.rich.RichPopup;

import oracle.adf.view.rich.component.rich.input.RichSelectBooleanCheckbox;

import oracle.adf.view.rich.context.AdfFacesContext;

import oracle.adf.view.rich.event.DialogEvent;

import oracle.adf.view.rich.event.PopupCanceledEvent;

import oracle.adf.view.rich.event.PopupFetchEvent;

import oracle.jbo.Row;

import oracle.jbo.ViewObject;

Master of Computer Application


199
Human Resource Management System

public class LeaveBean {

private RichPopup successfullMessagePopup;

private String successfullMessageText;

private String finYear;

private RichSelectBooleanCheckbox finalRunCBRC;

private boolean runFlagValue;

public LeaveBean() {

successfullMessageText="Data Saved Successfully...";

finYear=MyADFUtils.getCurrentFinYear();

runFlagValue=false;

public void setSuccessfullMessagePopup(RichPopup


successfullMessagePopup) {

this.successfullMessagePopup = successfullMessagePopup;

public RichPopup getSuccessfullMessagePopup() {

return successfullMessagePopup;

public void saveLeaveCategoryFormActionListner(ActionEvent actionEvent)


{

boolean flag=true,dmlFlag=false;

Master of Computer Application


200
Human Resource Management System

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("LeaveCategory1Iterator");

// System.out.println("Vo-->"+vo.getName());

//System.out.println("Row--
>"+vo.getCurrentRow().getAttribute("LeaveType"));

if(vo != null){

vo.setCurrentRow(vo.first());

while(flag){

Row row =vo.getCurrentRow();

if(row != null && ((MyADFUtils.isRowStatusNew(row)==true) ||


(MyADFUtils.isRowStatusUpdate(row)==true))){

dmlFlag=true;

break;

if(vo.hasNext()){

vo.next();

}else{

flag=false;

if(dmlFlag){

MyADFUtils.executeOperation("Commit");

MyADFUtils.showPopup(this.getSuccessfullMessagePopup());

}else{

Master of Computer Application


201
Human Resource Management System

this.setSuccessfullMessageText("No changes found...");

MyADFUtils.showPopup(this.getSuccessfullMessagePopup());

public void setSuccessfullMessageText(String successfullMessageText) {

this.successfullMessageText = successfullMessageText;

public String getSuccessfullMessageText() {

return successfullMessageText;

public void setFinYear(String finYear) {

this.finYear = finYear;

public String getFinYear() {

return finYear;

public void setFinalRunCBRC(RichSelectBooleanCheckbox finalRunCBRC)


{

this.finalRunCBRC = finalRunCBRC;

Master of Computer Application


202
Human Resource Management System

public RichSelectBooleanCheckbox getFinalRunCBRC() {

return finalRunCBRC;

/*

* This method will process the Anual Employee Leave Account

*/

public void leaveProcessActionListner(ActionEvent actionEvent) {

String personId = (String) MyADFUtils.getFromSession("personId");

String runFlag="N";

if(getFinalRunCBRC().getValue().toString().equals("true")){

runFlag="Y";

processAnualLeaveAccount(finYear, runFlag, personId);

public void setRunFlagValue(boolean runFlagValue) {

this.runFlagValue = runFlagValue;

public boolean getRunFlagValue() {

return runFlagValue;

Master of Computer Application


203
Human Resource Management System

public void processAnualLeaveAccount(String finYear,String runFlag,String


processedBy){

Connection con=null;

CallableStatement cstmt=null;

String sql="begin ANUAL_LEAVE_ACCOUNT_PROCESS(?,?,?,?);


end;";

String returnMsg=null;

try{

con=ConnectionManager.getConnection();

cstmt=con.prepareCall(sql);

cstmt.setString(1, finYear);

cstmt.setString(2, runFlag);

cstmt.setString(3, processedBy);

cstmt.registerOutParameter(4,Types.VARCHAR);

cstmt.execute();

returnMsg=cstmt.getString(4);

this.setSuccessfullMessageText(returnMsg);

MyADFUtils.showPopup(this.getSuccessfullMessagePopup());

}catch(Exception e){

MyADFUtils.showErrorMessage("Error occur in Anual Leave Account


Process-->"+e.getMessage());

}finally{

MyADFUtils.close(cstmt);

ConnectionManager.releaseConnetion(con);

Master of Computer Application


204
Human Resource Management System

public void LeaveAppInvokeButtonActionListner(ActionEvent actionEvent)


{

//Put Finyear in pageflow scope that will use in Leave balance where
clause

AdfFacesContext.getCurrentInstance().getPageFlowScope().put("p_finyear",
this.getFinYear());

public void leaveSubmissionPopupFetchListner(PopupFetchEvent


popupFetchEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("LeaveAppSubmissionR1Iterator
");

if(vo != null)

MyADFUtils.executeOperation("CreateInsertLeaveAppRecord");

public void leaveSubmissionPopupCancelListner(PopupCanceledEvent


popupCanceledEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("LeaveAppSubmissionR1Iterator
");

if(vo != null)

MyADFUtils.executeOperation("Rollback");

Master of Computer Application


205
Human Resource Management System

public void submitLeaveDialogListner(DialogEvent dialogEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("LeaveAppSubmissionR1Iterator
");

ViewObject leaveAppSubmittedVo =
MyADFUtils.getViewObjectByName("LeaveAppSubmittedStatusR1");

String fromDt=null,toDate=null,empLeaveCodeKey=null;

BigDecimal noOfDays=null;

if(dialogEvent.getOutcome()==DialogEvent.Outcome.ok){

if(vo != null){

empLeaveCodeKey = (String)
vo.getCurrentRow().getAttribute("EmpLeaveCodeKey");

fromDt = (String) vo.getCurrentRow().getAttribute("FromDate");

toDate = (String) vo.getCurrentRow().getAttribute("ToDate");

noOfDays = new
BigDecimal(vo.getCurrentRow().getAttribute("NoOfDays").toString());

if(empLeaveCodeKey != null && fromDt != null &&

toDate != null && noOfDays != null){

submitLeaveDataToDB(empLeaveCodeKey,fromDt,toDate,noOfDays);

if(leaveAppSubmittedVo != null){

System.out.println("Row count--
>"+leaveAppSubmittedVo.getEstimatedRowCount());

leaveAppSubmittedVo.executeQuery();

Master of Computer Application


206
Human Resource Management System

}else{

MyADFUtils.showErrorMessage("Something went wrong with Leave


App input fields.Please contact IT.");

throw new RuntimeException("Something went wrong with Leave


App input fields.Please contact IT.");

public void leaveAppToDateValueChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("LeaveAppSubmissionR1Iterator
");

String fromDt=null,toDate=null,leaveCode=null,empLeaveCodeKey=null;

long noOfDays=0;

if(vo != null){

leaveCode = (String) vo.getCurrentRow().getAttribute("LeaveCode");

fromDt = (String) vo.getCurrentRow().getAttribute("FromDate");

toDate = (String) valueChangeEvent.getNewValue();

if(fromDt == null || toDate==null){

MyADFUtils.showErrorMessage("Leave Start and End Date must be


enter.");

throw new RuntimeException("Leave Start and End Date must be


enter.");

Master of Computer Application


207
Human Resource Management System

//If Leave is Half day type then we will assign 0.5 in no_Of_days

if(leaveCode !=null && leaveCode.startsWith("H")){

if(fromDt.equals(toDate)){

vo.getCurrentRow().setAttribute("NoOfDays", 0.5);

}else{

MyADFUtils.showErrorMessage("Date should be same for the Half


day leave category.");

throw new RuntimeException("Date should be same for the Half day


leave category.");

}else{

noOfDays= MyADFUtils.getNoOfDays(fromDt, toDate);

//Adding 1 in noOfDays because we wants to include start date also

vo.getCurrentRow().setAttribute("NoOfDays", noOfDays+1);

empLeaveCodeKey= (String)
MyADFUtils.getFromSession("personId")+leaveCode;

if(empLeaveCodeKey != null){

vo.getCurrentRow().setAttribute("EmpLeaveCodeKey",
empLeaveCodeKey);

}else{

Master of Computer Application


208
Human Resource Management System

MyADFUtils.showErrorMessage("empLeaveCodeKey found
null.Please contact IT.");

throw new RuntimeException("empLeaveCodeKey found null.Please


contact IT.");

public void submitLeaveDataToDB(String empLeaveCodekey,String


fromDate,String toDate,Object noOfDays){

Connection con=null;

CallableStatement cstmt=null;

String sql="begin SUBMIT_LEAVE(?,?,?,?,?); end;";

String returnMsg=null;

try{

con=ConnectionManager.getConnection();

cstmt=con.prepareCall(sql);

cstmt.setString(1, empLeaveCodekey);

cstmt.setObject(2, fromDate);

cstmt.setObject(3, toDate);

cstmt.setObject(4, noOfDays);

cstmt.registerOutParameter(5,Types.VARCHAR);

cstmt.execute();

returnMsg=cstmt.getString(5);

this.setSuccessfullMessageText(returnMsg);

MyADFUtils.showPopup(this.getSuccessfullMessagePopup());

Master of Computer Application


209
Human Resource Management System

}catch(Exception e){

MyADFUtils.showErrorMessage("Error occur while submitting Leave


data to DB-->"+e.getMessage());

}finally{

MyADFUtils.close(cstmt);

ConnectionManager.releaseConnetion(con);

public void leaveApproveActionListner(ActionEvent actionEvent) {

String empLeaveKey=null,actionFlag="Approve";

String approvedBy = (String) MyADFUtils.getFromSession("personId");

Timestamp fromDate=null,toDate=null;

ViewObject
vo=MyADFUtils.getViewObjectByName("LeaveApprovalR1");

Row row=vo.getCurrentRow();

empLeaveKey = (String) row.getAttribute("EmpLeaveCodeKey");

fromDate = (Timestamp) row.getAttribute("LeaveFromDate");

toDate = (Timestamp) row.getAttribute("LeaveFromDate");

System.out.println("selected record-->"+fromDate);

approveRejectLeave(empLeaveKey,fromDate,toDate,approvedBy,actionFlag);

vo.executeQuery();

public void leaveRejectActionListner(ActionEvent actionEvent) {

Master of Computer Application


210
Human Resource Management System

String empLeaveKey=null,actionFlag="Reject";

String approvedBy = (String) MyADFUtils.getFromSession("personId");

Object fromDate=null,toDate=null;

ViewObject
vo=MyADFUtils.getViewObjectByName("LeaveApprovalR1");

Row row=vo.getCurrentRow();

empLeaveKey = (String) row.getAttribute("EmpLeaveCodeKey");

fromDate = row.getAttribute("LeaveFromDate");

toDate = row.getAttribute("LeaveFromDate");

System.out.println("selected record-->"+fromDate);

approveRejectLeave(empLeaveKey,fromDate,toDate,approvedBy,actionFlag);

vo.executeQuery();

public void approveRejectLeave(String empLeaveCodekey,Object


fromDate,Object toDate,

String approvedBy,String actionFlag){

Connection con=null;

CallableStatement cstmt=null;

String sql="begin APPROVE_REJECT_LEAVE_APP(?,?,?,?,?,?); end;";

String returnMsg=null;

try{

con=ConnectionManager.getConnection();

cstmt=con.prepareCall(sql);

cstmt.setString(1, empLeaveCodekey);

Master of Computer Application


211
Human Resource Management System

cstmt.setObject(2, fromDate);

cstmt.setObject(3, toDate);

cstmt.setObject(4, approvedBy);

cstmt.setObject(5, actionFlag);

cstmt.registerOutParameter(6,Types.VARCHAR);

cstmt.execute();

returnMsg=cstmt.getString(6);

this.setSuccessfullMessageText(returnMsg);

MyADFUtils.showPopup(this.getSuccessfullMessagePopup());

}catch(Exception e){

MyADFUtils.showErrorMessage("Error occur while Leave


Approve/Reject-->"+e.getMessage());

e.printStackTrace();

}finally{

MyADFUtils.close(cstmt);

ConnectionManager.releaseConnetion(con);

PayrollBean.java [To handle all the functionality in Payroll Management


Module]

package hrms.view.bean;

import hrms.model.payroll.query.CTCEDCodeRuleVORowImpl;

import hrms.model.payroll.view.CTCEarningVORowImpl;

Master of Computer Application


212
Human Resource Management System

import hrms.model.payroll.view.CTCEmpDeductionVORowImpl;

import hrms.view.util.ConnectionManager;

import hrms.view.util.HRMSException;

import hrms.view.util.MyADFUtils;

import java.math.BigDecimal;

import java.sql.CallableStatement;

import java.sql.Connection;

import java.sql.SQLException;

import java.sql.Timestamp;

import java.sql.Types;

import java.time.LocalDate;

import java.time.format.DateTimeFormatter;

import java.time.format.DateTimeFormatterBuilder;

import java.util.HashMap;

import java.util.Locale;

import java.util.Map;

import javax.faces.application.FacesMessage;

import javax.faces.component.UIComponent;

import javax.faces.context.FacesContext;

import javax.faces.event.ActionEvent;

import javax.faces.event.ValueChangeEvent;

import javax.faces.validator.ValidatorException;

import oracle.adf.view.rich.component.rich.RichPopup;

import oracle.adf.view.rich.component.rich.input.RichInputListOfValues;

import oracle.adf.view.rich.component.rich.input.RichInputText;

Master of Computer Application


213
Human Resource Management System

import oracle.adf.view.rich.component.rich.input.RichSelectBooleanCheckbox;

import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;

import oracle.adf.view.rich.component.rich.input.RichSelectOneRadio;

import oracle.adf.view.rich.component.rich.layout.RichPanelBox;

import oracle.adf.view.rich.component.rich.layout.RichPanelFormLayout;

import oracle.adf.view.rich.event.DialogEvent;

import oracle.adf.view.rich.event.PopupCanceledEvent;

import oracle.adf.view.rich.event.PopupFetchEvent;

import oracle.binding.OperationBinding;

import oracle.jbo.Row;

import oracle.jbo.RowSetIterator;

import oracle.jbo.ViewObject;

import org.apache.myfaces.trinidad.event.DisclosureEvent;

public class PayrollBean {

private RichPopup successMsgPopup;

private String successMsgTxt;

private boolean isActiveEDCodeRC;

private boolean isTaxableEDCodeRC;

private String edCodeTypeRBValue;

private String confirmationMsgTxt;

private RichPopup confirmationMsgPopup;

private boolean isActiveEditCBValue;

private boolean isTaxableEditCBValue;

private RichSelectBooleanCheckbox editEDCodeIstaxableCBRC;

Master of Computer Application


214
Human Resource Management System

private RichSelectBooleanCheckbox editEDCodeIsActiveCBRC;

private RichPopup errorMsgPopup;

private String errorMsgHTMLString;

private RichInputText ctcTotalAmountRC;

private RichInputText ctcTotalAnuualAmtRC;

private double totalCTCEarning;

private double totalAnnualCTCEarning;

private double empDeductionTotal;

private double empDeductionAnnualTotal;

private RichPopup questionAnswerPopup;

private String warningMsg;

private RichInputText empCTCInputRC;

private RichInputText empCTCAmoutInputRC;

private RichInputText empCTCEarningAmoutInputRC;

private RichInputListOfValues ctcEmpIDQueryLOVRC;

private RichPanelFormLayout ctcPayChangeEmpInfoForm;

private RichSelectOneChoice payrollProcessPeriodRC;

private RichSelectOneRadio payrollProcessTypeRC;

private RichPopup finalProcessConfirmationPopup;

private String reportName;

public PayrollBean() {

Master of Computer Application


215
Human Resource Management System

public void edCodePopupFetchListner(PopupFetchEvent popupFetchEvent)


{

MyADFUtils.executeOperation("CreateInsert");

public void edCodePopupCanceledListner(PopupCanceledEvent


popupCanceledEvent) {

MyADFUtils.executeOperation("Rollback");

MyADFUtils.refreshVOByIteratorName("EDCodeMaster1Iterator");

public void setSuccessMsgPopup(RichPopup successMsgPopup) {

this.successMsgPopup = successMsgPopup;

public RichPopup getSuccessMsgPopup() {

return successMsgPopup;

public void setSuccessMsgTxt(String successMsgTxt) {

this.successMsgTxt = successMsgTxt;

public String getSuccessMsgTxt() {

return successMsgTxt;

Master of Computer Application


216
Human Resource Management System

public void createEDCodeDialogListner(DialogEvent dialogEvent) {

String edCode = (String)


MyADFUtils.getAttributeFromIterator("EDCodeMaster1Iterator", "EdCode");

String description=(String)
MyADFUtils.getAttributeFromIterator("EDCodeMaster1Iterator",
"Description");

char edType;

if(edCode != null && description != null){

if(edCode.length()<5){

MyADFUtils.showErrorMessage("Length of Earning/Deduction Code


must be 5 Characters.");

throw new RuntimeException();

edType=edCode.charAt(0);

if(edType=='E' || edType=='D'){

else{

MyADFUtils.showErrorMessage("ED Code should start with either


E(Earning) or D(Deduction).");

throw new RuntimeException();

if(description.length()>100){

MyADFUtils.showErrorMessage("Length of Description should not


be more than 100 characters");

Master of Computer Application


217
Human Resource Management System

throw new RuntimeException();

if(dialogEvent.getOutcome()==DialogEvent.Outcome.ok){

MyADFUtils.executeOperation("Commit");

MyADFUtils.refreshViewObject("EDCodeMaster1");

this.setSuccessMsgTxt("ED code created successfully..");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

}else{

MyADFUtils.showErrorMessage("EDCode and Description are


mandatory.");

public void setIsActiveEDCodeRC(boolean isActiveEDCodeRC) {

this.isActiveEDCodeRC = isActiveEDCodeRC;

public boolean getIsActiveEDCodeRC() {

return isActiveEDCodeRC;

public void setIsTaxableEDCodeRC(boolean isTaxableEDCodeRC) {

this.isTaxableEDCodeRC = isTaxableEDCodeRC;

Master of Computer Application


218
Human Resource Management System

public boolean getIsTaxableEDCodeRC() {

return isTaxableEDCodeRC;

public void edCodeIsActiveValueChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

Row row=null;

valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentIn
stance());

if(valueChangeEvent.getNewValue().toString().equals("true")){

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsActive", "Y");

}else{

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsActive", "N");

Master of Computer Application


219
Human Resource Management System

public void edCodeIsTaxableValueChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

Row row=null;

valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentIn
stance());

if(valueChangeEvent.getNewValue().toString().equals("true")){

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsTaxable", "Y");

}else{

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsTaxable", "N");

public void initEDCodeCheckBoxesAttributes(){

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

Row row=null;

if(vo != null){

Master of Computer Application


220
Human Resource Management System

row=vo.getCurrentRow();

if(row.getAttribute("IsActive")==null ||
row.getAttribute("IsActive").equals("N")){

this.setIsActiveEditCBValue(false);

}else{

this.setIsActiveEditCBValue(true);

if(row.getAttribute("IsTaxable")==null ||
row.getAttribute("IsTaxable").equals("N")){

this.setIsTaxableEditCBValue(false);

}else{

this.setIsTaxableEditCBValue(true);

public void setEdCodeTypeRBValue(String edCodeTypeRBValue) {

this.edCodeTypeRBValue = edCodeTypeRBValue;

public String getEdCodeTypeRBValue() {

return edCodeTypeRBValue;

Master of Computer Application


221
Human Resource Management System

public void edCodeRBValueChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

String edCodeValue=null,edCodeType=null;

Row row=null;

if(vo != null){

row=vo.getCurrentRow();

edCodeType = (String) valueChangeEvent.getNewValue();

edCodeValue=MyADFUtils.getSqlDescription("select
GET_NEW_ED_CODE('"+edCodeType+"') from dual");

row.setAttribute("EdCode", edCodeValue);

public void edCodeEditPopupCanceledListner(PopupCanceledEvent


popupCanceledEvent) {

MyADFUtils.executeOperation("Rollback");

MyADFUtils.refreshVOByIteratorName("EDCodeMaster1Iterator");

public void isActiveEditEDCodeValueChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

Row row=null;

Master of Computer Application


222
Human Resource Management System

valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentIn
stance());

if(valueChangeEvent.getNewValue().toString().equals("true")){

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsActive", "Y");

}else{

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsActive", "N");

public void isTaxableEditEDCodeValueChangeListner(ValueChangeEvent


valueChangeEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

Row row=null;

valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentIn
stance());

if(valueChangeEvent.getNewValue().toString().equals("true")){

if(vo != null){

row=vo.getCurrentRow();

Master of Computer Application


223
Human Resource Management System

row.setAttribute("IsTaxable", "Y");

}else{

if(vo != null){

row=vo.getCurrentRow();

row.setAttribute("IsTaxable", "N");

public void editEDCodePopupDialogListner(DialogEvent dialogEvent) {

if(dialogEvent.getOutcome()==DialogEvent.Outcome.ok){

MyADFUtils.executeOperation("Commit");

MyADFUtils.refreshViewObject("EDCodeMaster1");

this.setSuccessMsgTxt("ED code updated successfully..");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

public void deleteEDCodeActionListner(ActionEvent actionEvent) {

this.setConfirmationMsgTxt("Are you sure to delete this record?");

MyADFUtils.putInSession("ConfirmationOperationFlag",
"DELETE_ED_CODE_RECORD");

MyADFUtils.showPopup(this.getConfirmationMsgPopup());

Master of Computer Application


224
Human Resource Management System

public void confirmationMsgDialogListner(DialogEvent dialogEvent) {

if(dialogEvent.getOutcome()==DialogEvent.Outcome.yes){

String opration = (String)


MyADFUtils.getFromSession("ConfirmationOperationFlag");

if(opration != null && opration=="DELETE_ED_CODE_RECORD"){

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("EDCodeMaster1Iterator");

if(vo != null){

Row row=vo.getCurrentRow();

if(row != null){

MyADFUtils.executeOperation("Delete");

MyADFUtils.executeOperation("Commit");

MyADFUtils.refreshViewObject("EDCodeMaster1");

this.setSuccessMsgTxt("ED code deleted successfully..");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

MyADFUtils.putInSession("ConfirmationOperationFlag", null);

public void setConfirmationMsgTxt(String confirmationMsgTxt) {

this.confirmationMsgTxt = confirmationMsgTxt;

Master of Computer Application


225
Human Resource Management System

public String getConfirmationMsgTxt() {

return confirmationMsgTxt;

public void setConfirmationMsgPopup(RichPopup confirmationMsgPopup) {

this.confirmationMsgPopup = confirmationMsgPopup;

public RichPopup getConfirmationMsgPopup() {

return confirmationMsgPopup;

public void setIsActiveEditCBValue(boolean isActiveEditCBValue) {

this.isActiveEditCBValue = isActiveEditCBValue;

public boolean getIsActiveEditCBValue() {

return isActiveEditCBValue;

public void setIsTaxableEditCBValue(boolean isTaxableEditCBValue) {

this.isTaxableEditCBValue = isTaxableEditCBValue;

Master of Computer Application


226
Human Resource Management System

public boolean getIsTaxableEditCBValue() {

return isTaxableEditCBValue;

public void edCodeEditPopupFetchListner(PopupFetchEvent


popupFetchEvent) {

this.initEDCodeCheckBoxesAttributes();

public void setEditEDCodeIstaxableCBRC(RichSelectBooleanCheckbox


editEDCodeIstaxableCBRC) {

this.editEDCodeIstaxableCBRC = editEDCodeIstaxableCBRC;

public RichSelectBooleanCheckbox getEditEDCodeIstaxableCBRC() {

return editEDCodeIstaxableCBRC;

public void setEditEDCodeIsActiveCBRC(RichSelectBooleanCheckbox


editEDCodeIsActiveCBRC) {

this.editEDCodeIsActiveCBRC = editEDCodeIsActiveCBRC;

public RichSelectBooleanCheckbox getEditEDCodeIsActiveCBRC() {

return editEDCodeIsActiveCBRC;

Master of Computer Application


227
Human Resource Management System

public void ctcEmpIdVCL(ValueChangeEvent valueChangeEvent) {

String empId=null;

BigDecimal empCTC=null;

empId = (String) valueChangeEvent.getNewValue();

MyADFUtils.putInPageFlowScope("ctc_emp_id", empId);

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PayEmpDtl1Iterator");

vo.executeQuery();

ViewObject
ctcEarningvo=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator
");

ctcEarningvo.executeQuery();

ViewObject
ctcDeductionvo=MyADFUtils.getViewObjectFromIterator("CTCEmpDeductio
n1Iterator");

ctcDeductionvo.executeQuery();

empCTC = getEmpCTCAmount(empId);

MyADFUtils.putInPageFlowScope("empCTC", empCTC);

this.getEmpCTCInputRC().setValue(empCTC);

public BigDecimal getEmpCTCAmount(String empId){

BigDecimal empCTC=null;

Master of Computer Application


228
Human Resource Management System

OperationBinding opBinding =
MyADFUtils.getOperationBinding("getEmployeeCTC");

Map map = opBinding.getParamsMap();

map.put("empId", empId);

empCTC = ((BigDecimal)
opBinding.execute())==null?BigDecimal.ZERO:(BigDecimal)
opBinding.execute();

MyADFUtils.putInPageFlowScope("empCTC", empCTC);

return empCTC;

public void refreshCTCStrVO(){

ViewObject
earningVO=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator");

ViewObject
empDeductionVO=MyADFUtils.getViewObjectFromIterator("CTCEmpDeduct
ion1");

earningVO.executeQuery();

empDeductionVO.executeQuery();

public boolean validateCTCRecord(Row row){

if(row.getAttribute("EdCode") != null && row.getAttribute("EmployeeId")


!= null)

return true;

return false;

Master of Computer Application


229
Human Resource Management System

public void addCTCEarningAL(ActionEvent actionEvent) {

ViewObject
ctcVO=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator");

ViewObject
empVO=MyADFUtils.getViewObjectFromIterator("PayEmpDtl1Iterator");

if(ctcVO != null && empVO != null){

Row empRow=empVO.getCurrentRow();

if(empRow != null && empRow.getAttribute("EmployeeId") !=null){

MyADFUtils.executeOperation("CreateInsertCTCEarning");

}else{

MyADFUtils.showErrorMessage("Please select Employee Id.");

return;

public void deleteCTCEarningAL(ActionEvent actionEvent) {

ViewObject
ctcVO=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator");

if(ctcVO != null){

ctcVO.getCurrentRow().remove();

}else{

MyADFUtils.showErrorMessage("No record found for delete.");

Master of Computer Application


230
Human Resource Management System

return;

public void saveCTCTransaction(ActionEvent actionEvent) {

StringBuilder errorMsg=null;

errorMsg=validateCTCEntry();

if(errorMsg != null){

this.setErrorMsgHTMLString(errorMsg.toString());

MyADFUtils.showPopup(this.getErrorMsgPopup());

return;

if(this.isMonthlyCTCIncorrect()){

String msg="<html><p><b>Your entered CTC is more than the CTC


entered in Employee Details." +

"</b></p></html>";

errorMsg=new StringBuilder();

errorMsg.append(msg);

this.setErrorMsgHTMLString(errorMsg.toString());

MyADFUtils.showPopup(this.getErrorMsgPopup());

return;

Master of Computer Application


231
Human Resource Management System

try {

MyADFUtils.executeOperation("Commit");

this.setConfirmationMsgTxt("CTC data saved successfully..");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

//refreshCTCStrVO();

} catch (Exception e) {

e.printStackTrace();

MyADFUtils.showErrorMessage(e.getMessage());

return;

/*

* Clear CTC VO

*/

public void clearCTCVOs(){

ViewObject payEmpDtl=null,PayEmpDTLQuery=null,CTCEarning=null;

payEmpDtl=MyADFUtils.getViewObjectByName("payEmpDtl1");

if(payEmpDtl != null)

payEmpDtl.reset();

MyADFUtils.putInPageFlowScope("ctc_emp_id", null);
PayEmpDTLQuery=MyADFUtils.getViewObjectByName("PayEmpDTLQuery
1");

if(PayEmpDTLQuery != null)

PayEmpDTLQuery.reset();

CTCEarning=MyADFUtils.getViewObjectByName("CTCEarning1");

Master of Computer Application


232
Human Resource Management System

if(CTCEarning != null)

CTCEarning.reset();

public void ctcRollbackAL(ActionEvent actionEvent) {

MyADFUtils.executeOperation("Rollback");

this.ctcEmpIDQueryLOVRC.setValue(MyADFUtils.getFromPageFlowScope("
ctc_emp_id"));
this.getEmpCTCInputRC().setValue(getEmpCTCAmount(MyADFUtils.getFro
mPageFlowScope("ctc_emp_id").toString()));

MyADFUtils.refreshComponent(this.getCtcEmpIDQueryLOVRC());

public void ctcEarningEDCodeVCL(ValueChangeEvent valueChangeEvent)


{
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentIn
stance());

ViewObject
payEmpDtl=MyADFUtils.getViewObjectFromIterator("PayEmpDtl1Iterator");

try{

if(payEmpDtl != null &&


payEmpDtl.getCurrentRow().getAttribute("EmployeeId") != null){

ViewObject
CTCEarning=MyADFUtils.getViewObjectByName("CTCEarning1");

if(CTCEarning != null){

CTCEarningVORowImpl
ctc=(CTCEarningVORowImpl)CTCEarning.getCurrentRow();

if(validateDuplicateEDCodeInCTC(CTCEarning,
"Earning",ctc.getEdCode())!=null){

Master of Computer Application


233
Human Resource Management System

this.setErrorMsgHTMLString(validateDuplicateEDCodeInCTC(CTCEarning,
"Earning",ctc.getEdCode()).toString());

throw new HRMSException("Earning ED code already exists.");

ctc.setEmployeeId(payEmpDtl.getCurrentRow().getAttribute("EmployeeId").to
String());

}else{

MyADFUtils.showErrorMessage("Please select Employee Id.");

return;

}catch(HRMSException e){

MyADFUtils.showPopup(this.getErrorMsgPopup());

/**

*Validate mandatory fields in CTC entry

* @return

*/

public StringBuilder validateCTCEntry(){

boolean flag=false;

StringBuilder msg=new StringBuilder();

Master of Computer Application


234
Human Resource Management System

HashMap<String,String> errMap=new HashMap<String,String>();

ViewObject
CTCEarning=MyADFUtils.getViewObjectByName("CTCEarning1");

RowSetIterator ctcEarningIter=CTCEarning.createRowSetIterator(null);

ViewObject
CTCDeduction=MyADFUtils.getViewObjectByName("CTCEmpDeduction1");

RowSetIterator
ctcDeductionIter=CTCDeduction.createRowSetIterator(null);

//Checking error in Employee Earning entry

if(ctcEarningIter != null){

while(ctcEarningIter.hasNext()){

CTCEarningVORowImpl
row=(CTCEarningVORowImpl)ctcEarningIter.next();

if(MyADFUtils.isRowStatusNew(row) ||
MyADFUtils.isRowStatusUpdate(row)){

if(row.getEdCode()==null ||

(row.getAmount()==null ||

row.getAmount().compareTo(BigDecimal.ONE) < 0)){

//msg.append("<p><b>Error in Employee Earning entry


</b>");

if(row.getEdCode()==null){

//msg.append("<p><b>Salary Head </b>");

// msg.append("is mandatory.</p>");

Master of Computer Application


235
Human Resource Management System

errMap.put("ERR_1", " is mandatory in Employee


Earning.");

if(row.getAmount()==null){

// msg.append("<p><b>Amount </b>");

// msg.append("is mandatory and should be greater than


zero.</p>");

errMap.put("ERR_2", " is mandatory and should be greater


than zero in Employee Earning.");

if(!flag)

flag=true;

break;

ctcEarningIter.closeRowSetIterator();

//Checking error in Employee Deduction entry

if(ctcDeductionIter != null){

while(ctcDeductionIter.hasNext()){

CTCEmpDeductionVORowImpl
row=(CTCEmpDeductionVORowImpl)ctcDeductionIter.next();

if(MyADFUtils.isRowStatusNew(row) ||
MyADFUtils.isRowStatusUpdate(row)){

Master of Computer Application


236
Human Resource Management System

if(row.getEdCode()==null ||

(row.getAmount()==null ||

row.getAmount().compareTo(BigDecimal.ONE) < 0)){

//msg.append("<p><b>Error in Employee Earning entry


</b>");

if(row.getEdCode()==null){

//msg.append("<p><b>Salary Head </b>");

// msg.append("is mandatory.</p>");

errMap.put("ERR_3", " is mandatory in Employee


Deduction.");

if(row.getAmount()==null){

// msg.append("<p><b>Amount </b>");

// msg.append("is mandatory and should be greater than


zero.</p>");

errMap.put("ERR_4", " is mandatory and should be greater


than zero in Employee Deduction.");

if(!flag)

flag=true;

break;

ctcDeductionIter.closeRowSetIterator();

Master of Computer Application


237
Human Resource Management System

if(flag && !errMap.isEmpty()){

msg.append("<html>");

if(errMap.containsKey("ERR_1")){

msg.append("<p><b>Salary Head </b>");

msg.append(errMap.get("ERR_1")+"</p>");

if(errMap.containsKey("ERR_2")){

msg.append("<p><b>Amount </b>");

msg.append(errMap.get("ERR_2")+"</p>");

if(errMap.containsKey("ERR_3")){

msg.append("<p><b>Salary Head </b>");

msg.append(errMap.get("ERR_3")+"</p>");

if(errMap.containsKey("ERR_4")){

msg.append("<p><b>Amount </b>");

msg.append(errMap.get("ERR_4")+"</p>");

msg.append("</html>");

return msg;

return null;

Master of Computer Application


238
Human Resource Management System

public void setErrorMsgPopup(RichPopup errorMsgPopup) {

this.errorMsgPopup = errorMsgPopup;

public RichPopup getErrorMsgPopup() {

return errorMsgPopup;

public void setErrorMsgHTMLString(String errorMsgHTMLString) {

this.errorMsgHTMLString = errorMsgHTMLString;

public String getErrorMsgHTMLString() {

return errorMsgHTMLString;

/**

* Validate duplicate EDCode in CTC entry

*/

public StringBuilder validateDuplicateEDCodeInCTC(ViewObject vo,

String edCodeType,

String edCode){

StringBuilder msg=new StringBuilder();

boolean flag=false;

Master of Computer Application


239
Human Resource Management System

int count=0;

String errMsg=null;

RowSetIterator rowIter =vo.createRowSetIterator(null);

if(edCodeType.equals("Earning") || edCodeType.equals("Deduction")){

if(rowIter != null && rowIter.getRowCount()>0){

msg.append("<html>");

while(rowIter.hasNext()){

Row row=rowIter.next();

if(row.getAttribute("EdCode") != null){

String edCodeEntry = (String) row.getAttribute("EdCode");

if(edCodeEntry.equals(edCode)){

count++;

if(count>1){

if(row.getAttribute("EDCodeDescription") != null){

errMsg=row.getAttribute("EDCodeDescription")+" already
exist.";

}else{

errMsg="Already exist.";

msg.append("<p>");

msg.append("<b>");

msg.append(errMsg);

msg.append("</b>");

Master of Computer Application


240
Human Resource Management System

msg.append("</p>");

if(!flag)

flag=true;

break;

if(count>1 && flag){

msg.append("</html>");

return msg;

return null;

public void setCtcTotalAmountRC(RichInputText ctcTotalAmountRC) {

this.ctcTotalAmountRC = ctcTotalAmountRC;

public RichInputText getCtcTotalAmountRC() {

return ctcTotalAmountRC;

Master of Computer Application


241
Human Resource Management System

public void setCtcTotalAnuualAmtRC(RichInputText


ctcTotalAnuualAmtRC) {

this.ctcTotalAnuualAmtRC = ctcTotalAnuualAmtRC;

public RichInputText getCtcTotalAnuualAmtRC() {

return ctcTotalAnuualAmtRC;

/**

* Calculate and return CTC Total amount for an employee

* @param vo - ViewObject on which total amount would be calculated

* @return

*/

public HashMap<String,BigDecimal> calculateTotal(ViewObject vo){

BigDecimal totalAmt=BigDecimal.ZERO,

totalAnnualAmt=BigDecimal.ZERO,

amount=null,

annualAmt=null;

HashMap<String,BigDecimal> total=new
HashMap<String,BigDecimal>();

if(vo != null ){

RowSetIterator rs=vo.createRowSetIterator(null);

while(rs.hasNext()){

Row row=rs.next();

if(row != null){

Master of Computer Application


242
Human Resource Management System

amount = (BigDecimal)row.getAttribute("Amount");

annualAmt = (BigDecimal)row.getAttribute("AnnualAmount");

totalAmt= totalAmt.add((amount !=
null)?amount:BigDecimal.ZERO);

totalAnnualAmt= totalAnnualAmt.add((annualAmt !=
null)?annualAmt:BigDecimal.ZERO);

if(totalAmt != null && totalAnnualAmt != null){

total.put("totalAmt", totalAmt);

total.put("totalAnnualAmt", totalAnnualAmt);

}else{

total.put("totalAmt", BigDecimal.ZERO);

total.put("totalAnnualAmt", BigDecimal.ZERO);

return total;

public void setTotalCTCEarning(double totalCTCEarning) {

this.totalCTCEarning = totalCTCEarning;

public double getTotalCTCEarning() {

ViewObject
CTCEarning=MyADFUtils.getViewObjectByName("CTCEarning1");

Master of Computer Application


243
Human Resource Management System

HashMap<String,BigDecimal> total=null;

if(CTCEarning != null){

total=calculateTotal(CTCEarning);

this.setTotalCTCEarning(total.get("totalAmt").doubleValue());

return totalCTCEarning;

public void setTotalAnnualCTCEarning(double totalAnnualCTCEarning) {

this.totalAnnualCTCEarning = totalAnnualCTCEarning;

public double getTotalAnnualCTCEarning() {

ViewObject
CTCEarning=MyADFUtils.getViewObjectByName("CTCEarning1");

HashMap<String,BigDecimal> total=null;

if(CTCEarning != null){

total=calculateTotal(CTCEarning);

this.setTotalAnnualCTCEarning(total.get("totalAnnualAmt").doubleValue());

return totalAnnualCTCEarning;

public void setEmpDeductionTotal(double empDeductionTotal) {

this.empDeductionTotal = empDeductionTotal;

Master of Computer Application


244
Human Resource Management System

public double getEmpDeductionTotal() {

ViewObject
CTCDeduction=MyADFUtils.getViewObjectByName("CTCEmpDeduction1");

HashMap<String,BigDecimal> total=null;

if(CTCDeduction != null){

total=calculateTotal(CTCDeduction);

this.setEmpDeductionTotal(total.get("totalAmt").doubleValue());

return empDeductionTotal;

public void setEmpDeductionAnnualTotal(double


empDeductionAnnualTotal) {

this.empDeductionAnnualTotal = empDeductionAnnualTotal;

public double getEmpDeductionAnnualTotal() {

ViewObject
CTCDeduction=MyADFUtils.getViewObjectByName("CTCEmpDeduction1");

HashMap<String,BigDecimal> total=null;

if(CTCDeduction != null){

total=calculateTotal(CTCDeduction);

this.setEmpDeductionAnnualTotal(total.get("totalAnnualAmt").doubleValue());

Master of Computer Application


245
Human Resource Management System

return empDeductionAnnualTotal;

public void addEmpCTCDeductionAL(ActionEvent actionEvent) {

ViewObject
ctcVO=MyADFUtils.getViewObjectFromIterator("CTCEmpDeduction1Iterator
");

ViewObject
empVO=MyADFUtils.getViewObjectFromIterator("PayEmpDtl1Iterator");

if(ctcVO != null && empVO != null){

Row empRow=empVO.getCurrentRow();

if(empRow != null && empRow.getAttribute("EmployeeId") !=null){

MyADFUtils.executeOperation("CreateInsertCTCDeduction");

}else{

MyADFUtils.showErrorMessage("Please select Employee Id.");

return;

public void deleteEmpCTCDeductionAL(ActionEvent actionEvent) {

ViewObject
ctcVO=MyADFUtils.getViewObjectFromIterator("CTCEmpDeduction1Iterator
");

if(ctcVO != null){

Master of Computer Application


246
Human Resource Management System

ctcVO.getCurrentRow().remove();

}else{

MyADFUtils.showErrorMessage("No record found for delete.");

return;

public void empCTCDeductionEDCodeVCL(ValueChangeEvent


valueChangeEvent) {

valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentIn
stance());

ViewObject
payEmpDtl=MyADFUtils.getViewObjectFromIterator("PayEmpDtl1Iterator");

try{

if(payEmpDtl != null &&


payEmpDtl.getCurrentRow().getAttribute("EmployeeId") != null){

ViewObject
CTCDeduction=MyADFUtils.getViewObjectByName("CTCEmpDeduction1");

if(CTCDeduction != null){

CTCEmpDeductionVORowImpl
ctc=(CTCEmpDeductionVORowImpl)CTCDeduction.getCurrentRow();

if(validateDuplicateEDCodeInCTC(CTCDeduction,
"Deduction",ctc.getEdCode())!=null){

this.setErrorMsgHTMLString(validateDuplicateEDCodeInCTC(CTCDeduction
, "Deduction",ctc.getEdCode()).toString());

Master of Computer Application


247
Human Resource Management System

throw new HRMSException(valueChangeEvent.getNewValue()+"


already exists.");

ctc.setEmployeeId(payEmpDtl.getCurrentRow().getAttribute("EmployeeId").to
String());

}else{

MyADFUtils.showErrorMessage("Please select Employee Id.");

return;

}catch(HRMSException e){

MyADFUtils.showPopup(this.getErrorMsgPopup());

public void completeCTCTabDL(DisclosureEvent disclosureEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("CompleteCTC1Iterator");

vo.executeQuery();

/**

* Check and return record status from ViewObject Entity cache

* @param vo

* @return

Master of Computer Application


248
Human Resource Management System

*/

public boolean checkRecordInsertUpdateStatusInVO(ViewObject vo){

boolean flag=false;

if(vo != null){

RowSetIterator rsi=vo.createRowSetIterator(null);

while(rsi.hasNext()){

Row row=rsi.next();

if(MyADFUtils.isRowStatusNew(row) ||
MyADFUtils.isRowStatusUpdate(row)){

flag=true;

break;

return flag;

public void setQuestionAnswerPopup(RichPopup questionAnswerPopup) {

this.questionAnswerPopup = questionAnswerPopup;

public RichPopup getQuestionAnswerPopup() {

return questionAnswerPopup;

Master of Computer Application


249
Human Resource Management System

public void setWarningMsg(String warningMsg) {

this.warningMsg = warningMsg;

public String getWarningMsg() {

return warningMsg;

public void warningMsgDialogListner(DialogEvent dialogEvent) {

public void setEmpCTCInputRC(RichInputText empCTCInputRC) {

this.empCTCInputRC = empCTCInputRC;

public RichInputText getEmpCTCInputRC() {

return empCTCInputRC;

public void empCTCUpdateVCL(ValueChangeEvent valueChangeEvent) {

BigDecimal empCTC = new


BigDecimal(valueChangeEvent.getNewValue().toString());

if(empCTC != null){

try {

Master of Computer Application


250
Human Resource Management System

OperationBinding opBinding =
MyADFUtils.getOperationBinding("updateEmpCTC");

Map map = opBinding.getParamsMap();

map.put("empId",
MyADFUtils.getFromPageFlowScope("ctc_emp_id"));

map.put("empCTC",empCTC);

opBinding.execute();

} catch (Exception e) {

e.printStackTrace();

public BigDecimal getEmpCTCEDCodeAmount(String edCode){

OperationBinding opBinding =
MyADFUtils.getOperationBinding("getCTCEDCodeAmount");

Map map = opBinding.getParamsMap();

map.put("empId", MyADFUtils.getFromPageFlowScope("ctc_emp_id"));

map.put("edCode",edCode);

return (BigDecimal) opBinding.execute();

public String checkCTCEDCodeValue(String edCode,BigDecimal


enteredAmount){

BigDecimal minRuleAmt= null,maxRuleAmt=


null,ctcAmount=null,ctcAmountMonthly=null,edCodeAmount=null;

Master of Computer Application


251
Human Resource Management System

String msg="NO_ERROR";

ViewObject vo=
MyADFUtils.getViewObjectFromIterator("CTCEDCodeRule1Iterator");

vo.executeQuery();

while(vo.hasNext()){

CTCEDCodeRuleVORowImpl
rec=(CTCEDCodeRuleVORowImpl)vo.next();

//Validation which is based on percentage amount of another ED Code

if(rec.getEdCode() != null && rec.getEdCodeCalDepend() != null){

ctcAmount =
getEmpCTCAmount(MyADFUtils.getFromPageFlowScope("ctc_emp_id").toSt
ring());

if(rec.getEdCode().toString().equals("E0001") &&

rec.getEdCode().toString().equals(edCode) &&

ctcAmount.compareTo(BigDecimal.ZERO)<=0){

msg="Please enter the employee CTC amount.";

break;

if(rec.getEdCode().toString().equals("E0001") &&

rec.getEdCode().toString().equals(edCode) &&

ctcAmount.compareTo(BigDecimal.ZERO)>0 &&

rec.getEdCodeCalDepend().toString().equals("CTC")){

Master of Computer Application


252
Human Resource Management System

String
ctcAmtMonthlyRoundOff=MyADFUtils.roundValueBy2(ctcAmount.doubleVal
ue()/12);

ctcAmountMonthly=new BigDecimal(ctcAmtMonthlyRoundOff);

minRuleAmt=ctcAmountMonthly.multiply(rec.getMinPercent());

maxRuleAmt=ctcAmountMonthly.multiply(rec.getMaxPercent());

if(enteredAmount.compareTo(minRuleAmt)<0 ||

enteredAmount.compareTo(maxRuleAmt)>0

msg="Amount for "+rec.getDescription()+" must be between


"+minRuleAmt+" and "+maxRuleAmt;

break;

if(rec.getEdCode().toString().equals(edCode)){

edCodeAmount=this.getEmpCTCEDCodeAmount(rec.getEdCodeCalDepend().
toString());

if(edCodeAmount.compareTo(BigDecimal.ZERO)==0){

msg="Please first make the entry for


"+rec.getDependentEdDesc()+

" then try for "+rec.getDescription();

break;

else{

minRuleAmt=edCodeAmount.multiply(rec.getMinPercent());

Master of Computer Application


253
Human Resource Management System

maxRuleAmt=edCodeAmount.multiply(rec.getMaxPercent());

String
minRuleAmtRoundOff=MyADFUtils.roundValueBy2(minRuleAmt.doubleVal
ue());

String
maxRuleAmtRoundOff=MyADFUtils.roundValueBy2(maxRuleAmt.doubleVal
ue());

maxRuleAmt=new BigDecimal(maxRuleAmtRoundOff);

minRuleAmt=new BigDecimal(minRuleAmtRoundOff);

if(enteredAmount.compareTo(minRuleAmt)<0 ||

enteredAmount.compareTo(maxRuleAmt)>0

msg="Amount for "+rec.getDescription()+" must be between


"+minRuleAmt+" and "+maxRuleAmt;

break;

//Validation which is based on min or max value entered in rule table

if(rec.getMinAmount() != null && rec.getMaxAmount() != null &&

rec.getEdCode().toString().equals(edCode)){

minRuleAmt=rec.getMinAmount();

maxRuleAmt=rec.getMaxAmount();

if(enteredAmount.compareTo(minRuleAmt)<0 ||

enteredAmount.compareTo(maxRuleAmt)>0

Master of Computer Application


254
Human Resource Management System

msg="Amount for "+rec.getDescription()+" must be between


"+minRuleAmt+" and "+maxRuleAmt;

break;

return msg;

public void empEarningCTCVCL(ValueChangeEvent valueChangeEvent) {

BigDecimal enteredAmount = (BigDecimal)


valueChangeEvent.getNewValue();

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator");

Row row=vo.getCurrentRow();

CTCEarningVORowImpl erow=(CTCEarningVORowImpl)row;

if(erow != null && erow.getEdCode() != null){

String msg=this.checkCTCEDCodeValue(erow.getEdCode(),
enteredAmount);

if(msg != null && !msg.equals("NO_ERROR")){

erow.setAmount(null);

this.getEmpCTCEarningAmoutInputRC().setValue(null);

MyADFUtils.refreshComponent(this.getEmpCTCEarningAmoutInputRC());

MyADFUtils.showErrorMessage(msg);

return;

Master of Computer Application


255
Human Resource Management System

}else{

MyADFUtils.showErrorMessage("Please select Salary Head.");

return;

public void empDeductionCTCVCL(ValueChangeEvent valueChangeEvent)


{

BigDecimal enteredAmount = (BigDecimal)


valueChangeEvent.getNewValue();

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("CTCEmpDeduction1Iterator");

Row row=vo.getCurrentRow();

CTCEmpDeductionVORowImpl
erow=(CTCEmpDeductionVORowImpl)row;

if(erow != null && erow.getEdCode() != null){

String msg=this.checkCTCEDCodeValue(erow.getEdCode(),
enteredAmount);

if(msg != null && !msg.equals("NO_ERROR")){

erow.setAmount(null);

this.getEmpCTCAmoutInputRC().setValue(null);

MyADFUtils.refreshComponent(this.getEmpCTCAmoutInputRC());

MyADFUtils.showErrorMessage(msg);

return;

Master of Computer Application


256
Human Resource Management System

}else{

MyADFUtils.showErrorMessage("Please select Salary Head.");

return;

public void setEmpCTCAmoutInputRC(RichInputText


empCTCAmoutInputRC) {

this.empCTCAmoutInputRC = empCTCAmoutInputRC;

public RichInputText getEmpCTCAmoutInputRC() {

return empCTCAmoutInputRC;

public void setEmpCTCEarningAmoutInputRC(RichInputText


empCTCEarningAmoutInputRC) {

this.empCTCEarningAmoutInputRC = empCTCEarningAmoutInputRC;

public RichInputText getEmpCTCEarningAmoutInputRC() {

return empCTCEarningAmoutInputRC;

public void ctcEarningValidator(FacesContext facesContext, UIComponent


uIComponent, Object object) {

Master of Computer Application


257
Human Resource Management System

BigDecimal enteredAmount = null;

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator");

Row row=vo.getCurrentRow();

CTCEarningVORowImpl erow=(CTCEarningVORowImpl)row;

if(erow != null && erow.getEdCode() != null && erow.getAmount() !=


null){

enteredAmount=erow.getAmount();

String msg=this.checkCTCEDCodeValue(erow.getEdCode(),
enteredAmount);

if(msg != null && !msg.equals("NO_ERROR")){

throw new ValidatorException(new FacesMessage(msg));

public void setCtcEmpIDQueryLOVRC(RichInputListOfValues


ctcEmpIDQueryLOVRC) {

this.ctcEmpIDQueryLOVRC = ctcEmpIDQueryLOVRC;

public RichInputListOfValues getCtcEmpIDQueryLOVRC() {

return ctcEmpIDQueryLOVRC;

Master of Computer Application


258
Human Resource Management System

/**

* Check the total CTC entered by user is correct or not by validating it with

* employee master CTC

* @return

*/

public boolean isMonthlyCTCIncorrect(){

boolean flag=false;

BigDecimal
monthlyCTC=null,grossAndEmployerDeduction=BigDecimal.ZERO;

ViewObject earningVO=null,deductionVo=null;

if(this.getEmpCTCInputRC().getValue() != null){

monthlyCTC=new BigDecimal(this.getEmpCTCInputRC()

.getValue()

.toString());

String
mctcRoundOff=MyADFUtils.roundValueBy2(monthlyCTC.doubleValue()/12);

monthlyCTC= new BigDecimal(mctcRoundOff);

System.out.println("Monthly CTC--->"+monthlyCTC);

earningVO=MyADFUtils.getViewObjectFromIterator("CTCEarning1Iterator");

deductionVo=MyADFUtils.getViewObjectFromIterator("CTCEmpDeduction1I
terator");

if(earningVO != null && deductionVo != null){

RowSetIterator earIterator=earningVO.createRowSetIterator(null);

RowSetIterator dedIterator=deductionVo.createRowSetIterator(null);

Master of Computer Application


259
Human Resource Management System

//Calculate total CTC entered by user

while(earIterator.hasNext()){

Row row=earIterator.next();

BigDecimal amount = (BigDecimal) row.getAttribute("Amount");

//System.out.println("Earning Amount :"+amount);

grossAndEmployerDeduction=grossAndEmployerDeduction.add(amount);

earIterator.closeRowSetIterator();

while(dedIterator.hasNext()){

Row row=dedIterator.next();

//Only Employer deduction should be consider

if(row.getAttribute("EdCode") != null &&

row.getAttribute("EdCode").equals("D0002")){

BigDecimal amount = (BigDecimal)


row.getAttribute("Amount");

//System.out.println("Deduction Amount :"+amount);

grossAndEmployerDeduction=grossAndEmployerDeduction.add(amount);

dedIterator.closeRowSetIterator();

System.out.println("Entered CTC---
>"+grossAndEmployerDeduction.toString());

if(grossAndEmployerDeduction.compareTo(monthlyCTC)>0){

flag=true;

Master of Computer Application


260
Human Resource Management System

return flag;

public void queryPayChangeVCL(ValueChangeEvent valueChangeEvent) {

MyADFUtils.putInPageFlowScope("ctc_emp_id",
valueChangeEvent.getNewValue());

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PayEmpDtl1Iterator");

vo.executeQuery();

MyADFUtils.refreshComponent(this.getCtcPayChangeEmpInfoForm());

public void savePayChangeTranAL(ActionEvent actionEvent) {

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("CTCPayChange1Iterator");

RowSetIterator rsi=vo.createRowSetIterator(null);

boolean flag=false;

try {

if (rsi != null) {

while (rsi.hasNext()) {

Master of Computer Application


261
Human Resource Management System

Row row = rsi.next();

validatePayChangeEntry(row);

if(!flag)

flag=true;

rsi.closeRowSetIterator();

if (flag) {

MyADFUtils.executeOperation("Commit");

this.setSuccessMsgTxt("Data Saved Successfully...");

MyADFUtils.showPopup(this.getSuccessMsgPopup());

} catch (HRMSException hrmse) {

MyADFUtils.showErrorMessage(hrmse.toString());

public void setCtcPayChangeEmpInfoForm(RichPanelFormLayout


ctcPayChangeEmpInfoForm) {

this.ctcPayChangeEmpInfoForm = ctcPayChangeEmpInfoForm;

public RichPanelFormLayout getCtcPayChangeEmpInfoForm() {

return ctcPayChangeEmpInfoForm;

Master of Computer Application


262
Human Resource Management System

public void payChangePeriodVCL(ValueChangeEvent valueChangeEvent) {

String payPeriod = (String)


MyADFUtils.getAttributeFromIterator("PayChangeQuery1Iterator",
"PayPeriod");

String empId = (String)


MyADFUtils.getFromPageFlowScope("ctc_emp_id");

MyADFUtils.setAttributeInIterator("CTCPayChange1Iterator",
"PayPeriod", payPeriod);

MyADFUtils.setAttributeInIterator("CTCPayChange1Iterator",
"EmployeeId", empId);

/**

* This method will validate the PayChange Form FromDate and ToDate
entry

* @param payRollPeriod

* @param fromDt = It should must belongs to payRollPeriod

* @param toDt = It should must belongs to payRollPeriod

* @return =Return true if fromDt and toDt is belongs to payRollPeriod

*/

public boolean validatePayChangeDates(String payRollPeriod,

Timestamp fromDt,

Timestamp toDt){

boolean validationStatus=false;

DateTimeFormatter df = new DateTimeFormatterBuilder()

Master of Computer Application


263
Human Resource Management System

.parseCaseInsensitive()

.appendPattern("dd-MMM-yyyy")

.toFormatter(Locale.ENGLISH);

LocalDate d1=LocalDate.parse("01-"+payRollPeriod, df);

String monthYear=d1.getMonth()+"-"+d1.getYear();

//Validate fromDate

if(fromDt != null){

if(monthYear.equalsIgnoreCase(fromDt.toLocalDateTime().getMonth()+"-"+

fromDt.toLocalDateTime().getYear())){

validationStatus=true;

//Validate toDate

if(toDt != null){

if(monthYear.equalsIgnoreCase(toDt.toLocalDateTime().getMonth()+"-
"

+toDt.toLocalDateTime().getYear())){

validationStatus=true;

return validationStatus;

Master of Computer Application


264
Human Resource Management System

public void payChangeAmountVCL(ValueChangeEvent valueChangeEvent)


{

BigDecimal amount = (BigDecimal) valueChangeEvent.getNewValue();

if(amount != null){

if(amount.compareTo(BigDecimal.ZERO)<=0){

try {

throw new HRMSException("Amount must be greater than


ZERO.");

} catch (HRMSException e) {

MyADFUtils.setAttributeInIterator("CTCPayChange1Iterator",
"Amount", null);

MyADFUtils.showErrorMessage("Amount must be greater than


ZERO.");

public void payChangeNewRecAL(ActionEvent actionEvent) {

String empId = (String)


MyADFUtils.getAttributeFromIterator("PayEmpDtl1Iterator", "EmployeeId");

if(empId != null){

MyADFUtils.executeOperation("CreateInsert");

}else{

MyADFUtils.showErrorMessage("Please select Employee Id from


list.");

Master of Computer Application


265
Human Resource Management System

/**

*This method will validate all the mandatory fields of Paychange entry form

* @param row

* @throws HRMSException

*/

public void validatePayChangeEntry(Row row)throws HRMSException{

Timestamp fromDate = (Timestamp) row.getAttribute("FromDate");

Timestamp toDate = (Timestamp) row.getAttribute("ToDate");

String payrollPeriod = (String) row.getAttribute("PayrollPeriod");

BigDecimal amount = (BigDecimal) row.getAttribute("Amount");

//Validate From Date

if(payrollPeriod != null && fromDate != null){

boolean status=this.validatePayChangeDates(payrollPeriod, fromDate,


null);

if(!status){

String errMsg="From Date is outside of Payroll Period";

throw new HRMSException(errMsg);

//Validate To Date

Master of Computer Application


266
Human Resource Management System

if(payrollPeriod != null && fromDate != null){

boolean status=this.validatePayChangeDates(payrollPeriod, null,


toDate);

if(!status){

String errMsg="To Date is outside of Payroll Period";

throw new HRMSException(errMsg);

//Validate Amount

if(amount != null){

if(amount.compareTo(BigDecimal.ZERO)<=0){

String errMsg="Amount must be greater than ZERO.";

throw new HRMSException(errMsg);

public void viewPayRollProcessedResultVCL(ValueChangeEvent


valueChangeEvent) {

String p_period=valueChangeEvent.getNewValue().toString();

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PayProcessMaster1Iterator");

if(vo != null){

MyADFUtils.putInPageFlowScope("pay_period", p_period);

vo.setNamedWhereClauseParam("p_period", p_period);

Master of Computer Application


267
Human Resource Management System

vo.executeQuery();

public void setPayrollProcessPeriodRC(RichSelectOneChoice


payrollProcessPeriodRC) {

this.payrollProcessPeriodRC = payrollProcessPeriodRC;

public RichSelectOneChoice getPayrollProcessPeriodRC() {

return payrollProcessPeriodRC;

public void setPayrollProcessTypeRC(RichSelectOneRadio


payrollProcessTypeRC) {

this.payrollProcessTypeRC = payrollProcessTypeRC;

public RichSelectOneRadio getPayrollProcessTypeRC() {

return payrollProcessTypeRC;

public void payrollProcessDialogListner(DialogEvent dialogEvent) {

String payrollPeriod=null,processType=null;

if(dialogEvent.getOutcome()== DialogEvent.Outcome.ok){

Master of Computer Application


268
Human Resource Management System

if(MyADFUtils.getViewObjectFromIterator("PeriodOpenLov1Iterator")
!= null){

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PeriodOpenLov1Iterator");

payrollPeriod = (String)
vo.getCurrentRow().getAttribute("AttendancePeriod");

MyADFUtils.putInPageFlowScope("pay_period", payrollPeriod);

processType = (String) this.getPayrollProcessTypeRC().getValue();

System.out.println("processType : "+processType);

if(payrollPeriod != null && processType != null){

if(processType.equals("Final-Process")){

MyADFUtils.showPopup(this.getFinalProcessConfirmationPopup());

}else{

try {

startPayrollProcess(payrollPeriod, processType);

executePayMaster(payrollPeriod);

} catch (HRMSException e) {

MyADFUtils.showErrorMessage(e.toString());

return;

}else{

MyADFUtils.showErrorMessage("Payroll period and Process Type


are mandatory");

Master of Computer Application


269
Human Resource Management System

return;

public void setFinalProcessConfirmationPopup(RichPopup


finalProcessConfirmationPopup) {

this.finalProcessConfirmationPopup = finalProcessConfirmationPopup;

public RichPopup getFinalProcessConfirmationPopup() {

return finalProcessConfirmationPopup;

public void finalProcessConfirmationDialogListner(DialogEvent


dialogEvent) {

String payrollPeriod=null;

if(dialogEvent.getOutcome()==DialogEvent.Outcome.ok){

if(MyADFUtils.getViewObjectFromIterator("PeriodOpenLov1Iterator")
!= null){

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PeriodOpenLov1Iterator");

payrollPeriod = (String)
vo.getCurrentRow().getAttribute("AttendancePeriod");

Master of Computer Application


270
Human Resource Management System

try {

startPayrollProcess(payrollPeriod, "Final-Process");

executePayMaster(payrollPeriod);

} catch (HRMSException e) {

MyADFUtils.showErrorMessage(e.toString());

return;

/**

*This method invoke the Database pacakage procedure that will validate all
the

* required validation and if validation found ok then complete the payroll

* process and return successfull message else rollback the process with error

* message.

* @param payrollPeriod : Period for payroll process

* @param processType : This could be either 'Final-Process' or 'Temp-


Process'

*/

public void startPayrollProcess(String payrollPeriod,String


processType)throws HRMSException{

String processMsg=null;

String processFlag=null;

String plsqlCall="{?=call PAYROLL_PROCESS.pay(?,?,?)}";

Connection con=null;

Master of Computer Application


271
Human Resource Management System

CallableStatement cstmt=null;

try{

con=ConnectionManager.getConnection();

cstmt=con.prepareCall(plsqlCall);

cstmt.setString(2, payrollPeriod);

cstmt.setString(3, processType);

cstmt.registerOutParameter(4, Types.VARCHAR);

cstmt.registerOutParameter(1, Types.VARCHAR);

cstmt.execute();

processFlag=cstmt.getString(1);

processMsg=cstmt.getString(4);

}catch(SQLException se){

se.printStackTrace();

MyADFUtils.showErrorMessage(se.getMessage());

}catch(Exception e){

e.printStackTrace();

MyADFUtils.showErrorMessage(e.getMessage());

}finally{

MyADFUtils.close(cstmt);

ConnectionManager.releaseConnetion(con);

System.out.println("processMsg : "+processMsg);

Master of Computer Application


272
Human Resource Management System

if(processFlag.equals("TRUE")){

this.setSuccessMsgTxt(processMsg);

MyADFUtils.showPopup(this.getSuccessMsgPopup());

}else{

throw new HRMSException(processMsg);

public void executePayMaster(String period){

ViewObject
vo=MyADFUtils.getViewObjectFromIterator("PayProcessMaster1Iterator");

if(vo != null){

vo.setNamedWhereClauseParam("p_period", period);

vo.executeQuery();

public void setReportName(String reportName) {

this.reportName = reportName;

public String getReportName() {

return reportName;

Master of Computer Application


273
Human Resource Management System

public String callPayrollProcessDetailReportAL() {

this.setReportName("Pay_process_detail");

return "print_report";

Classes used in Report Creation

JasperService.java [Master Class used in Report Generation]

package hrms.view.reports;

import java.io.OutputStream;

import java.sql.Connection;

import java.util.HashMap;

import java.util.Map;

import javax.faces.context.FacesContext;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.sql.DataSource;

import net.sf.jasperreports.engine.JRException;

import net.sf.jasperreports.engine.JRParameter;

import net.sf.jasperreports.engine.JasperCompileManager;

import net.sf.jasperreports.engine.JasperExportManager;

import net.sf.jasperreports.engine.JasperFillManager;

import net.sf.jasperreports.engine.JasperPrint;

import net.sf.jasperreports.engine.JasperReport;

Master of Computer Application


274
Human Resource Management System

import net.sf.jasperreports.view.JasperViewer;

public class JasperService {

JasperReport jasperReport;

JasperPrint jasperPrint;

JasperViewer jasperViewer;

Connection con = null;

Context ctx = null;

DataSource ds = null;

Map<String, Object> parameters = new HashMap();

String url =
FacesContext.getCurrentInstance().getExternalContext().getRealPath("/reports/"
).toString().trim();

//The url string is the folder where a designed report is deployed

JRParameter[] param;

public JasperService() {

super();

public Connection getDataSource() {

try {

ctx = new InitialContext();

ds = (DataSource) ctx.lookup("HRMSDS");

//this is the data source name used from the WebLogic server

Master of Computer Application


275
Human Resource Management System

con = ds.getConnection();

} catch (Exception e) {

e.printStackTrace();

return con;

public void close(Connection con) {

if (con != null) {

try {

con.close();

} catch (Exception e) {

e.printStackTrace();

//this method is responsible for extracting the parameters needed by a report

public JRParameter[] getReportParameters(String reportName) {

try {System.out.println("Report path : "+url + "/" + reportName +


".jrxml");

jasperReport = JasperCompileManager.compileReport(url + "/" +


reportName + ".jrxml");

param = jasperReport.getParameters();

} catch (JRException e) {

Master of Computer Application


276
Human Resource Management System

// TODO Auto-generated catch block

e.printStackTrace();

return param;

//this method generates HTML page out of a report

public void runJasperHTML(String reportName, String[]


reportInputControlsValues) {

try {

int index = 0;

if (reportInputControlsValues != null) {

for (JRParameter filteredParam : getReportParameters(reportName)) {

if (filteredParam.isForPrompting() &&
!filteredParam.isSystemDefined()) {

parameters.put(filteredParam.getName(),
reportInputControlsValues[index]);

++index;

jasperReport = JasperCompileManager.compileReport(url + "/" +


reportName + ".jrxml");

jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,


getDataSource());

JasperExportManager.exportReportToHtmlFile(jasperPrint, url + "/" +


reportName +".html");

Master of Computer Application


277
Human Resource Management System

System.out.println("Done!");

} catch (Exception e) {

e.printStackTrace();

} finally {

System.out.println("closing connection");

close(con);

//this method generates PDF document out of a report

public void runJasperPDF(String reportName, String[]


reportInputControlsValues, OutputStream outputStream) {

try {

int index = 0;

if (reportInputControlsValues != null) {

for (JRParameter filteredParam : getReportParameters(reportName)) {

if (filteredParam.isForPrompting() &&
!filteredParam.isSystemDefined()) {

parameters.put(filteredParam.getName(),
reportInputControlsValues[index]);

++index;

jasperReport = JasperCompileManager.compileReport(url + "/" +


reportName + ".jrxml");

Master of Computer Application


278
Human Resource Management System

jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,


getDataSource());

JasperExportManager.exportReportToPdfStream(jasperPrint,
outputStream);

System.out.println("Done!");

} catch (Exception e) {

e.printStackTrace();

} finally {

System.out.println("closing connection");

close(con);

public void runJasperPDF2(String reportName, Map<String, Object>


parameters, OutputStream outputStream) {

try {

jasperReport = JasperCompileManager.compileReport(url + "/" +


reportName + ".jrxml");

jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,


getDataSource());

JasperExportManager.exportReportToPdfStream(jasperPrint,
outputStream);

System.out.println("Done!");

} catch (Exception e) {

e.printStackTrace();

} finally {

Master of Computer Application


279
Human Resource Management System

System.out.println("closing connection");

close(con);

public void setUrl(String url) {

this.url = url;

public String getUrl() {

return url;

HRMSReportBean.java [This class has invoked in each module to generate


the reports]

package hrms.view.bean;

import hrms.view.reports.JasperService;

import hrms.view.util.MyADFUtils;

import java.io.OutputStream;

import java.util.HashMap;

import java.util.Map;

import javax.faces.context.FacesContext;

import net.sf.jasperreports.engine.JRParameter;

Master of Computer Application


280
Human Resource Management System

import oracle.jbo.Row;

import oracle.jbo.RowSetIterator;

import oracle.jbo.ViewObject;

public class HRMSReportBean {

private String reportPath;

private JasperService jasperService;

private String reportName;

private Map<String, Object> reportValues;

public HRMSReportBean() {

/**

* Execute the Report Master and Details VO to display the Report Param in the
form.

*/

public void executeReportParamDetails(){

reportName = (String)
MyADFUtils.getFromPageFlowScope("p_report_xml_name");

System.out.println("Report Name : "+reportName);

if(reportName != null){

getReportMasterVO().setNamedWhereClauseParam("p_report_xml_name",
reportName);

getReportMasterVO().executeQuery();

Master of Computer Application


281
Human Resource Management System

public ViewObject getReportMasterVO(){

ViewObject vo=MyADFUtils.getViewObjectByName("ReportMaster1");

return vo;

public ViewObject getReportDetailVO(){

ViewObject vo=MyADFUtils.getViewObjectByName("ReportDetail1");

return vo;

public void setReportPath(String reportPath) {

this.reportPath = reportPath;

public String getReportPath() {

return reportPath;

public void setJasperService(JasperService jasperService) {

this.jasperService = jasperService;

public JasperService getJasperService() {

return jasperService;

Master of Computer Application


282
Human Resource Management System

public void setReportName(String reportName) {

this.reportName = reportName;

public String getReportName() {

return reportName;

public void setReportValues(Map<String, Object> reportValues) {

this.reportValues = reportValues;

public Map<String, Object> getReportValues() {

return reportValues;

/**

* This method set the total parameters of the report in the HashMap object

* @return

*/

public boolean addInputControls(){

reportValues = new HashMap<String, Object>();

jasperService = new JasperService();

Master of Computer Application


283
Human Resource Management System

for (JRParameter filteredParam :


jasperService.getReportParameters(getReportNameFromPFScope())) {

if (filteredParam.isForPrompting() &&
!filteredParam.isSystemDefined()) {

reportValues.put(filteredParam.getName(), null);

return reportValues.size() > 0;

/**

* This method set the report parameters input values entered by user in the
Param Form

*/

public void setReportParamValues(){

ViewObject vo=getReportDetailVO();

if(vo!= null){

RowSetIterator iter=vo.createRowSetIterator(null);

while(iter.hasNext()){

Row row=iter.next();

String reportParameter = (String) row.getAttribute("ParameterName");

if(row.getAttribute("paramInputValue") != null){

String paramValues= (String)


row.getAttribute("paramInputValue");

if(reportValues.containsKey(reportParameter)){

Master of Computer Application


284
Human Resource Management System

reportValues.put(reportParameter, paramValues);

iter.closeRowSetIterator();

}else{

System.out.println("ReportDetails VO instance not found......");

public void exportToPDF(FacesContext facesContext, OutputStream


outputStream) {

if(addInputControls()){

setReportParamValues();

jasperService.runJasperPDF2(getReportNameFromPFScope(),
reportValues, outputStream);

public String getReportNameFromPFScope(){

return (String)
MyADFUtils.getFromPageFlowScope("p_report_xml_name");

Master of Computer Application


285
Human Resource Management System

Chapter 5: Standardization of the coding

5.1 Code Efficiency

Efficiency of any system is concern with the proper use of scare recourses by
the system. The need of efficiency arises due to cost considerations. If some
resources are scarce and expensive, it is desirable that those resources be used
efficiency are processor time and memory. An efficient system is concern with
less CPU interaction and less memory. It is important to make my software as a
quick and intelligent to solve the desire purpose with in some fraction of
second. Code efficiency means that especially code that is executed often with
in tight loop.

Simplicity of the code an also consideration factor. Efficient the coding


structures handle the entire problem to arrive at required output. In the system
i.e., “Human Resource Management System” is designed in well-structured
manner to suit “Code Efficiency” in such a way that can prove by default. I use
some tools to make the code efficient. If the code is not simple then they
maintain and up- gradation will be a tedious job for the user of the system.

The said criteria are not nor may independent and increase of one have
unfavorable for another.

A code should be design clearly that can be verifiable, complete (implements all
the specification) and traceable (all design elements can be traced to some
requirements).

5.2 Error Handling

Master of Computer Application


286
Human Resource Management System

A system is said to be error free system if it’s run without any type of
disturbance. To develop error free system, we have to handle the error’s which
can be occur when the program is running.

Error could be due to business logic validation failed or any other system error.
We should display the proper error message to the user so that user can work
with the system happily.

In our Human Resource Management System, we have handled the error in


such a way that user will not confused or irritate and they can work with the
system happily.

5.3 Parameters calling/Passing

Communication between two or more objects is possible by passing the data to


each other, if the objects want to do some actions based on the value available
with other object.

In our Human Resource Management System, the controller layer is designed in


such a way that we can reuse the objects from one module to another by passing
the parameters values.

5.4 Validation Checks

If the system is not having any validation there is a chance of corrupted data can
be saved in our database, which make no sense of having the data with the
system.

In our Human Resource Management System, we have designed our database


and the application in such a way that it will never accept any data that is not
valid to the system.

It will accept the data only when it’s passes through the validation successfully.

Master of Computer Application


287
Human Resource Management System

Chapter 6: Testing
6.1 Testing techniques and Testing strategies used

Software testing is a process used to identify the correctness, completeness and


quality of developed computer software. It includes a set of activities conducted
with the intent of finding errors in software so that it could be corrected before
the product is released to the end users. In other word software testing is an
activity to check that the software system is defect free.
Software testing is primarily a broad process that is composed of several
interlinked processes. The primary objective of software testing is to measure
software health along with its completeness in terms of core requirements.
Software testing involves examining and checking software through different
testing processes.
The objectives of these processes can include:

▪ Completeness - Verifying software completeness in regards to


functional/business requirements
▪ Errors Free - Identifying technical bugs/errors and ensuring the software
is error-free
▪ Stability - Assessing usability, performance, security, localization,
compatibility and installation

This phase determines the error in the project. If there is any error then it must
be removed before delivery of the project.

For determining errors various types of test action are performed: -

Unit Testing: - Unit testing focuses verification effort on the smallest unit of
software design – the module. Using the detail design description as a guide,
important control paths are tested to uncover errors within the boundary of the
module. The relative complexity of tests and the errors detected as a result is

Master of Computer Application


288
Human Resource Management System

limited by the constrained scope established for unit testing. The unit test is
always white box oriented, and the step can be conducted in parallel for
multiple modules.

Unit testing is normally considered an adjunct to the coding step. After source
level code has been developed, reviewed, and verified for correct syntax, unit
test case design begins.

Integration Testing - A level of the software testing process where individual


units are combined and tested as a group. The purpose of this level of testing is
to expose faults in the interaction between integrated units.

System Testing: - Software is only one element of a larger computer-based


system. Ultimately, software is incorporated with other system elements (e.g.,
new hardware, information), and a series of system integration and validation
tests are conducted. Steps taken during software design and testing can greatly
improve the probability of successful software integration in the larger system.
A classics system testing problem is “finger pointing”. This occurs when a
defect is uncovered, and one system element developer blames another for the
problem. The software engineer should anticipate potential interfacing problems
and design error handling paths that test all information coming from other
elements of the system, conduct a series of tests that simulate bad data or other
potential errors at the software interface, record the results or tests to use as
“evidence” if finger pointing does occur, participate in the planning and design
of system test to ensure that software is adequately tested.

There are many types of system tests that are worthwhile for software-based
systems: -

Master of Computer Application


289
Human Resource Management System

Usability Testing - Usability Testing is a type of testing done from an end-


user’s perspective to determine if the system is easily usable.

Functionality testing - Tests all functionalities of the software against the


requirement.

Performance testing – Performance testing is designed to test the run-time


performance of software within the context of an integrated system

Security testing – Security testing attempts to verify that protection


mechanisms built into a system will protect it from improper penetration

Stress tests – Stress tests are designed to confront programs with abnormal
situations.

6.2 Testing Plan used

Considering our project, the following testing are taking place: -

• Database Testing: Testing the database by using sample data as an


input. In this testing we try to test whether all transactions and
process are successfully completing the processes or not.

• User Data Input Testing: In this testing some invalid input values
are entered and tested to make sure the system should accept only
valid entries.

• Integration Testing: In this testing we are trying to see how data


between two or more modules are passing, how dependent modules
are receiving input values for further processes etc.

• System Security Testing: In this testing we verify that the system


is accessible only to authorized user or not.

Master of Computer Application


290
Human Resource Management System

6.3 Test Reports

A test case is a set of conditions or variables under which a tester will determine
whether an application, software system or one of its features is working as it
was originally designed for it to do.

Below are the tables which shows the testing results of some important
components of our application.

Login:
Test Case Test Test Case Pre- Test Steps Test Data Expected Actual Status
ID Scenario Condition Result Result Pass/Fail
TC_Login_1 Verify Enter valid Need a valid 1. Enter Valid user Successful Successful Pass
Login user Id and user Id and user Id id and login, login,
password password to 2. Enter Valid home page home page
do login Password password of of
3. Click application application
Login should displayed
display
TC_Login_2 Verify Enter valid Need a valid 1. Enter Valid user No No Pass
Login user Id and user Id and user Id id Matched Matched
invalid password to 2. Enter Invalid User id/ User id/
password do login Password Password Password Password
3. Click
Login
TC_Login_3 Verify Enter Need a valid 1. Enter Invalid No No Pass
Login Invalid user user id and user id user id Matched Matched
id and valid password to 2. Enter and User id/ User id/
password do login Password Valid Password Password
3. Click Password
Login
TC_Login_4 Verify Enter Need a valid 1. Enter Invalid No No Pass
Login Invalid user user id and username user id Matched Matched
id and password to 2. Enter and User id/ User id/
invalid do login Password Invalid Password Password
password 3. Click Password
Login

New User Registration


Test Case Test Test Case Pre- Test Steps Test Data Expected Actual Status
ID Scenario Condition Result Result Pass/Fail
TC_REG_1 Verify Select Need valid 1. Select Valid Successful, Successful, Pass
Registration user id Employee Employee Employee Member Member
Detail from Id and id from Id and Added Added
LOV and New LOV Password Successfully Successfully
Enter new Password 2. Enter
password Password
and again 3. Re-
Re-Enter Enter
new Password
password 4. Click
OK
TC_REG_2 Verify Select Need valid 1. Select Invalid Contact HR Contact HR Pass
Registration user id Employee Employee Employee to generate to generate
Detail from Id and id from Id and new new

Master of Computer Application


291
Human Resource Management System

LOV and New LOV Password Employee Employee


Enter new Password 2. Enter id id
password Password
and again 3. Re-
Re-Enter Enter
new Password
password 4. Click
OK

Employee Master
Test Case Test Test Case Pre- Test Steps Test Data Expected Actual Status
ID Scenario Condition Result Result Pass/Fail
TC_EMP_1 Validate Enter all Need Enter all Employee Successfully Successfully Pass
mandatory the Employee the First Employee Employee
fields on mandatory details to mandatory name, added to the added to the
Save fields enter fields in Last employee employee
button marked as values in the form name, master master
star the and click Date of database database
symbol mandatory on Save birth,
and click fields button Email,
on Save Joining
button date
TC_EMP_2 Validate Skip some Need Enter all Skip some Please enter Please enter Pass
mandatory of the Employee the of the all the all the
fields on mandatory details to mandatory mandatory mandatory mandatory
Save fields to enter fields in fields to fields and fields and
button enter values in the form enter then click then click
the and click on Save on Save
mandatory on Save button button
fields button

Attendance Time-In and Time-Out


Test Case Test Test Case Pre- Test Steps Test Data Expected Actual Status
ID Scenario Condition Result Result Pass/Fail
TC_ATD_1 Validate Enter all Need Enter all Attendance Attendance Attendance Pass
mandatory the Time-In the Period, Submitted Submitted
fields on mandatory and Time- mandatory Date, Successfully Successfully
Submit fields Out, fields in Time-In
Attendance marked as Attendance the form and Time-
button star period, and click Out
symbol date to on Submit
and click enter in the Attendance
on Submit mandatory button
Attendance fields
button
TC_ATD_2 Validate Skip some Need Enter all Skip some Please enter Please enter Pass
mandatory of the Time-In the of the all the all the
fields on mandatory and Time- mandatory mandatory mandatory mandatory
Submit fields to Out, fields in fields to fields and fields and
Attendance enter Attendance the form enter then click then click
button period, and click on Submit on Submit
date to on Save Attendance Attendance
enter in the button button button
mandatory
fields

Master of Computer Application


292
Human Resource Management System

Submit Leave Application


Test Case ID Test Test Case Pre- Test Steps Test Data Expected Actual Status
Scenario Condition Result Result Pass/Fail
TC_LV_1 Validate Enter all Need Enter all Leave Leave Leave Pass
mandatory the Leave the Type, Submitted Submitted
fields on mandatory Type, Start mandatory Start Date, Successfully Successfully
Submit fields Data, End fields in End Date
Leave marked as date the form
Application star and click
symbol on Submit
and click Leave
on Submit button
Leave
TC_LV_2 Validate Skip some Need Skip some Leave Please enter Please enter Pass
mandatory of the Leave of the Type, all the all the
fields on mandatory Type, Start mandatory Start Date, mandatory mandatory
Submit fields to Data, End fields to End Date fields and fields and
Leave enter date enter then click then click
Application on Submit on Submit
Leave Leave
button button

Payroll Process
Test Case ID Test Test Case Pre- Test Steps Test Data Expected Actual Status
Scenario Condition Result Result Pass/Fail
TC_PAY_1 Validate Select Need to Select Employee Attendance Attendance Pass
Payroll Payroll have Payroll Attendance and CTC and CTC
Process Period and employee’s period and and CTC not found, not found,
without Process attendance process should cannot do cannot do
having Type and their type and miss in the the Payroll the Payroll
attendance CTC in the click on database Process Process
and CTC database payroll
for the process
employees button
in a pay
month
TC_PAY_2 Validate Select Need to Select Employee Payroll Payroll Pass
Payroll Payroll have Payroll Attendance process process
Process Period and employee’s period and and CTC done done
having Process attendance process should successfully successfully
attendance Type and their type and available
and CTC CTC in the click on in the
for the database payroll database
employees process
in a pay button
month
TC_PAY_3 Check Select Payroll Select Payroll Payroll Payroll Pass
Payroll Payroll period Payroll Period in period is period is not
Period Period and should period and database not open; open; hence
before Process open in the process hence process
Payroll Type system type and process cannot be
process click on cannot be done
begin payroll done
process
button

Master of Computer Application


293
Human Resource Management System

Chapter 7: System Security Measures


7.1 Database/ Data Security
I have used Oracle database to develop our Human Resources Management
System Application. Data security of the system are managed by creating the
role based on user’s types.

Below are the roles which assigned to user to manipulate or query the database.

• Admin: This role is assigned to the user who is admin for the application.
Admin user can access any module of the system. Developer of this
system also comes under this role.
• User: User role is created to provide the access of the application based
on modules of the system. Example: A user can have access of any one
module or two modules or all modules.

Admin role users only have direct access to database because it is a database
user having all access for creating and maintaining the database. They can
create, alter or drop any object in the database. They can also manipulate any
table data in the database.

User role users are created and stored in a Security Table. This type of users
are not database users. Security table contains user details based on access to
the system modules. A user can access the system based on the details
defined in this table.

7.2 Creation of User profiles and access rights


As we have discussed in above block that in our Human Resource Management
System, we have used two types of roles to access the system that is Admin and
user role.
We have one Security Table in the database where me mapped the users with
their access right in another tables called system menus table, and using these
tables we make the user profile dynamically at runtime when user login to the
system.

Master of Computer Application


294
Human Resource Management System

Chapter 8: Reports
Some of the important reports are listed below with their parameter form and
their output.
8.1.1 Employee Details Report [Parameters Input Page]

8.1.2 Employee Details Report [Report output]

8.2.1 Employee Attendance Details [Parameters Input Page]

Master of Computer Application


295
Human Resource Management System

8.2.2 Employee Attendance Details [Report Output]

8.3.1 Payroll Process Details [Parameters Input Page]

8.3.2 Payroll Process Details [Report Output]

Master of Computer Application


296
Human Resource Management System

Master of Computer Application


297
Human Resource Management System

Chapter 9: Future Scope


There are various things that can be integrated with the system like we can add
some of modules for Income tax calculation, Bonus calculation, Employee Loan
etc.

Further we can enhance the existing modules after the use of modules regularly.
We can develop more reports as required by users in future after using the
system.

We can add some functionality to catch the employee activity with the system
as a history record that can help to the organization in future if something is
deleted from the system.

As the technology emerges, it is possible to upgrade the system and can be


adaptable to desired environment.

Based on the future security issued, security can be improved using emerging
technologies.

Master of Computer Application


298
Human Resource Management System

Chapter 10: Conclusion


The Human Resource Management System has been completed successfully
and also tested successfully by taking "Test Cases". It is user friendly, and has
required options, which can be utilized by the user to perform the desired
operations.
The Software is developed using Oracle ADF Framework where I have used
Java as programming Language and JSF for the user Interface, Oracle Database
has used as back-end where I have used the power of SQL and PL/SQL
programming language for data processing & manipulating and finally the
application is deployed on WebLogic Server in windows environment.
The goals that are achieved by the software are:
▪ Simplification of the operations
▪ Less processing time and getting required information
▪ User friendly
▪ Portable and flexible for further enhancement

Master of Computer Application


299
Human Resource Management System

Bibliography
The following reference has been used to develop the project “Human Resource
Management System”: -

Books: -

▪ Software Engineering – IGNOU Study Material (MCS-034)


▪ UML – IGNOU Study Material (MCS-032)
▪ Database design - IGNOU Study Material (MCS-023)
▪ Java Programming Language – Udemy by Prof. Abdul Bari
▪ Database programming- Oracle Documents
▪ ADF Framework – Oracle Documents

Web Source: -

▪ www.google.co.in
▪ www.oracle.com
▪ www.tutorialspoint.com

Master of Computer Application A

You might also like