Skip to content

Commit

Permalink
Added scripts for Oracle EBS HRMS (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmaygarg-oracle authored Jun 15, 2023
1 parent a5688f1 commit b45bb31
Show file tree
Hide file tree
Showing 27 changed files with 4,642 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
-- Copyright (c) 2023 Oracle and/or its affiliates.
--
-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
--
-- Author: OIG Development
--
-- Description: Script file for CREATING synonym of procedures/packages and Tables required for HRMS
--
-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

create or replace PACKAGE OIM_EBSHRMS_SCHEMA_PKG AS

PROCEDURE get_schema( schemaout OUT schemalist);

END OIM_EBSHRMS_SCHEMA_PKG;

/

create or replace PACKAGE BODY OIM_EBSHRMS_SCHEMA_PKG AS

procedure get_schema(
schemaout OUT schemalist
) AS
attr attributelist;
BEGIN
schemaout := schemalist();
schemaout.extend(1);
attr := attributelist();
attr.extend (50);
attr (1) := attributeinfo('HIRE_DATE','date',1,1,0,1);
attr (2) := attributeinfo('BUSINESS_GROUP_ID','varchar2',1,1,0,1);
attr (3) := attributeinfo('LAST_NAME','varchar2',1,1,1,1);
attr (4) := attributeinfo('FIRST_NAME','varchar2',1,1,1,1);
attr (5) := attributeinfo('SEX','varchar2',1,1,0,1);
attr (6) := attributeinfo('PERSON_TYPE_ID','varchar2',1,1,0,1);
attr (7) := attributeinfo('EMPLOYEE_NUMBER','varchar2',1,1,0,1);
attr (8) := attributeinfo('PERSON_ID','varchar2',1,1,0,1);
attr (9) := attributeinfo('TITLE','varchar2',1,1,0,1);
attr (10) := attributeinfo('EMAIL_ADDRESS','varchar2',1,1,0,1);
attr (11) := attributeinfo('MARITAL_STATUS','varchar2',1,1,0,1);
attr (12) := attributeinfo('NATIONALITY','varchar2',1,1,0,1);
attr (13) := attributeinfo('NATIONAL_IDENTIFIER','varchar2',1,1,0,1);
attr (14) := attributeinfo('DATE_OF_BIRTH','date',1,1,0,1);
attr (15) := attributeinfo('TOWN_OF_BIRTH','varchar2',1,1,0,1);
attr (16) := attributeinfo('REGION_OF_BIRTH','varchar2',1,1,0,1);
attr (17) := attributeinfo('COUNTRY_OF_BIRTH','varchar2',1,1,0,1);
attr (18) := attributeinfo('USER_PERSON_TYPE','varchar2',1,1,0,1);
attr (19) := attributeinfo('EFFECTIVE_START_DATE','date',1,1,0,1);
attr (20) := attributeinfo('ACTUAL_TERMINATION_DATE','date',1,1,0,1);
attr (21) := attributeinfo('SUPERVISOR_ID','varchar2',1,1,0,1);
attr (22) := attributeinfo('SUPERVISOR_NAME','varchar2',0,0,0,1);
attr (23) := attributeinfo('JOB','varchar2',1,1,0,1);
attr (24) := attributeinfo('GRADE','varchar2',1,1,0,1);
attr (25) := attributeinfo('DEPARTMENT','varchar2',1,1,0,1);
attr (26) := attributeinfo('PERSON_UPDATED_DATE','date',1,1,0,1);
attr (27) := attributeinfo('ASSIGNMENT_UPDATED_DATE','date',1,1,0,1);

schemaout( 1 ) := schema_object('__PERSON__',attr);

attr := attributelist();
attr.extend;
attr (1) := attributeinfo('ADDRESS_ID','number',1,0,0,1);
attr.extend;
attr (2) := attributeinfo('PRIMARY_FLAG','varchar',1,1,0,1);
attr.extend;
attr (3) := attributeinfo('STYLE','varchar',1,1,0,1);
attr.extend;
attr (4) := attributeinfo('DATE_FROM','date',1,1,0,1);
attr.extend;
attr (5) := attributeinfo('ADDRESS_LINE1','varchar',1,1,0,1);
attr.extend;
attr (6) := attributeinfo('ADDRESS_LINE2','varchar',1,1,0,1);
attr.extend;
attr (7) := attributeinfo('ADDRESS_LINE3','varchar',1,1,0,1);
attr.extend;
attr (8) := attributeinfo('TOWN_OR_CITY','varchar',1,1,0,1);
attr.extend;
attr (9) := attributeinfo('REGION_1','varchar',1,1,0,1);
attr.extend;
attr (10) := attributeinfo('REGION_2','varchar',1,1,0,1);
attr.extend;
attr (11) := attributeinfo('REGION_3','varchar',1,1,0,1);
attr.extend;
attr (12) := attributeinfo('POSTAL_CODE','varchar',1,1,0,1);
attr.extend;
attr (13) := attributeinfo('COUNTRY','varchar',1,1,0,1);
attr.extend;
attr (14) := attributeinfo('DATE_TO','date',1,1,0,1);
attr.extend;
attr (15) := attributeinfo('ADDRESS_TYPE','varchar',1,1,0,1);
attr.extend;

schemaout.extend;
schemaout( 2 ) := schema_object('__ADDRESS__',attr);


attr := attributelist();
attr.extend;
attr (1) := attributeinfo('ASSIGNMENT_ID','number',1,0,0,1);
attr.extend;
attr (2) := attributeinfo('ASG_EFFECTIVE_START_DATE','date',1,0,0,1);
attr.extend;
attr (3) := attributeinfo('CHANGE_REASON','varchar',1,1,0,1);
attr.extend;
attr (4) := attributeinfo('ORGANIZATION_ID','number',1,1,0,1);
attr.extend;
attr (5) := attributeinfo('JOB_ID','number',1,1,0,1);
attr.extend;
attr (6) := attributeinfo('GRADE_ID','number',1,1,0,1);
attr.extend;
attr (7) := attributeinfo('SUPERVISOR_ID','number',1,1,0,1);
attr.extend;

schemaout.extend;
schemaout( 3 ) := schema_object('__ASSIGNMENT__',attr);

END get_schema;

END OIM_EBSHRMS_SCHEMA_PKG;
/
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
-- Copyright (c) 2023 Oracle and/or its affiliates.
--
-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
--
-- Author: OIG Development
--
-- Description: Script file for CREATING synonym of procedures/packages and Tables required for HRMS
--
-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

create or replace PACKAGE OIM_EMPLOYEE_ADDRESS_WRAPPER AS

PROCEDURE create_person_address_api (person_id IN number ,primary_flag IN varchar2 ,style IN varchar2 ,date_from IN date ,date_to IN date ,address_type IN varchar2 ,address_line1 IN varchar2 ,address_line2 IN varchar2 ,address_line3 IN varchar2 ,town_or_city IN varchar2 ,region_1 IN varchar2 ,region_2 IN varchar2 ,region_3 IN varchar2 ,postal_code IN varchar2 ,country IN varchar2 ,telephone_number_1 IN varchar2 ,telephone_number_2 IN varchar2 ,telephone_number_3 IN varchar2 ,address_id OUT number ,object_version_number OUT number );

PROCEDURE update_person_address_api ( address_id IN number,person_id IN number ,primary_flag IN varchar2 ,style IN varchar2 ,date_from IN date ,date_to IN date ,address_type IN varchar2 ,address_line1 IN varchar2 ,address_line2 IN varchar2 ,address_line3 IN varchar2 ,town_or_city IN varchar2 ,region_1 IN varchar2 ,region_2 IN varchar2 ,region_3 IN varchar2 ,postal_code IN varchar2 ,country IN varchar2 ,telephone_number_1 IN varchar2 ,telephone_number_2 IN varchar2 ,telephone_number_3 IN varchar2);

PROCEDURE delete_person_address_api ( address_id IN number,date_from IN date);

END OIM_EMPLOYEE_ADDRESS_WRAPPER;

/

create or replace PACKAGE BODY OIM_EMPLOYEE_ADDRESS_WRAPPER AS

-------Procedure for create address for an employee --------
procedure create_person_address_api
(
person_id IN number,
primary_flag IN varchar2,
style IN varchar2,
date_from IN date,
date_to IN date,
address_type IN varchar2,
address_line1 IN varchar2,
address_line2 IN varchar2,
address_line3 IN varchar2,
town_or_city IN varchar2,
region_1 IN varchar2,
region_2 IN varchar2,
region_3 IN varchar2,
postal_code IN varchar2,
country IN varchar2,
telephone_number_1 IN varchar2,
telephone_number_2 IN varchar2,
telephone_number_3 IN varchar2,
address_id OUT number,
object_version_number OUT number
)
is
BEGIN
-- Start of API
HR_PERSON_ADDRESS_API.CREATE_PERSON_ADDRESS(
p_effective_date => date_from,
P_person_id => person_id,
P_primary_flag => primary_flag,
P_style => style,
P_date_from => date_from,
P_date_to => date_to,
P_ADDRESS_TYPE => address_type,
P_address_line1 => address_line1,
P_address_line2 => address_line2,
P_address_line3 => address_line3,
P_town_or_city => town_or_city,
P_region_1 => region_1,
P_region_2 => region_2,
P_region_3 => region_3,
P_postal_code => postal_code,
P_country => country,
P_telephone_number_1 => telephone_number_1,
P_telephone_number_2 => telephone_number_2,
P_telephone_number_3 => telephone_number_3,
P_address_id => address_id,
P_object_version_number => object_version_number
);

EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SUBSTR(SQLERRM,1,200));
raise;
END create_person_address_api ;

PROCEDURE update_person_address_api
(
address_id IN number,
person_id IN number,
primary_flag IN varchar2,
style IN varchar2 ,
date_from IN date ,
date_to IN date ,
address_type IN varchar2 ,
address_line1 IN varchar2 ,
address_line2 IN varchar2 ,
address_line3 IN varchar2 ,
town_or_city IN varchar2 ,
region_1 IN varchar2 ,
region_2 IN varchar2 ,
region_3 IN varchar2 ,
postal_code IN varchar2 ,
country IN varchar2 ,
telephone_number_1 IN varchar2 ,
telephone_number_2 IN varchar2 ,
telephone_number_3 IN varchar2
)
IS
l_object_version_number per_addresses.object_version_number%type;

BEGIN
SELECT MAX(object_version_number) into l_object_version_number FROM PER_ADDRESSES WHERE address_id = update_person_address_api.address_id;

-- Start of API
HR_PERSON_ADDRESS_API.update_person_address(
p_effective_date => date_from,
p_address_id => address_id,
p_object_version_number => l_object_version_number,
p_date_from => date_from,
p_date_to => date_to,
p_primary_flag => primary_flag,
p_address_type => address_type,
P_address_line1 => address_line1,
p_address_line2 => address_line2,
p_address_line3 => address_line3,
p_town_or_city => town_or_city,
p_region_1 => region_1,
p_region_2 => region_2,
p_region_3 => region_3,
p_postal_code => postal_code,
p_country => country,
p_telephone_number_1 => telephone_number_1,
p_telephone_number_2 => telephone_number_2,
p_telephone_number_3 => telephone_number_3
);

EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SUBSTR(SQLERRM,1,200));
raise;
END update_person_address_api ;

PROCEDURE delete_person_address_api(address_id IN number,
date_from IN date
)
IS
l_date_to date;
l_date_from date;
l_object_version_number per_addresses.object_version_number%type;

BEGIN
SELECT MAX(PER_ADDRESSES.date_to) into l_date_to FROM PER_ADDRESSES WHERE address_id = delete_person_address_api.address_id;
--End Date is already set, ignore
if l_date_to is null then

l_date_to := SYSDATE;

SELECT MAX(object_version_number) into l_object_version_number FROM PER_ADDRESSES WHERE address_id = delete_person_address_api.address_id;
IF date_from IS NOT NULL THEN
l_date_from := date_from;
ELSE
SELECT MAX(PER_ADDRESSES.date_from) into l_date_from FROM PER_ADDRESSES WHERE address_id = delete_person_address_api.address_id;
end if;
-- date_from should be always less than or equal to date_to
if l_date_from > l_date_to then
l_date_to := l_date_from;
end if;
-- Start of API
HR_PERSON_ADDRESS_API.update_person_address(p_effective_date => l_date_from,
p_address_id => address_id,
p_date_from => l_date_from,
p_date_to => l_date_to,
p_object_version_number => l_object_version_number);
end if;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SUBSTR(SQLERRM,1,200));
raise;
END delete_person_address_api ;


END OIM_EMPLOYEE_ADDRESS_WRAPPER;

/

Loading

0 comments on commit b45bb31

Please sign in to comment.