1 PACKAGE PA_MOAC_UTILS AS
2 /* $Header: PAXMOUTS.pls 120.1 2005/06/15 22:03:22 dlanka noship $ */
3 /* ============================================================================
4 Procedure Name: PROCEDURE mo_init_set_context
5
6 DESCRIPTION : New procedure added for MOAC. This procedure would be invoked by Public APIs
7 to initialize proper multi-org context.
8
9 CLIENT/SERVER : SERVER
10
11 LIBRARY NAME :
12
13
14 PARAMETERS : p_org_id NUMBER
15 p_product_code VARCHAR2 DEFAULT 'PA'
16
17 ALGORITHM : This procedure would be invoked by Public/AMG APIs to initialize
18 and set org context to Single. This procedure checks if the P_ORG_ID
19 passed is valid or not using get_valid_ou function. If it is not
20 valid then error is thrown, else OU context is set to Single
21 NOTES :
22 =========================================================================== */
23 PROCEDURE MO_INIT_SET_CONTEXT
24 (
25 p_org_id IN OUT NOCOPY NUMBER ,
26 p_product_code IN VARCHAR2 DEFAULT 'PA',
27 p_msg_count OUT NOCOPY NUMBER,
28 p_msg_data OUT NOCOPY VARCHAR2,
29 p_return_status OUT NOCOPY VARCHAR2
30 );
31
32 -- ==========================================================================
33 FUNCTION GET_CURRENT_ORG_ID
34 RETURN NUMBER;
35 --
36 -- This function would return the ORG ID set for the current session
37 -- if the context is set to Single, for Multi-context this function
38 -- would return NULL. This function is a wrapper that makes call to
39 -- MO_GLOBAL.GET_CURRENT_ORG_ID
40 --
41
42 FUNCTION GET_OU_NAME
43 (
44 p_org_id hr_all_organization_units_tl.organization_id%TYPE
45 )
46 RETURN VARCHAR2;
47 --
48 -- This function would return OU Name for the ORG_ID passed.
49 -- If the ORG_ID is NULL or invalid, it would return NULL
50 -- This function is a wrapper that makes call to MO_GLOBAL.GET_OU_NAME
51 --
52
53 FUNCTION GET_OU_COUNT
54 RETURN NUMBER;
55 --
56 -- This function would return count of Operating Units a user has access to.
57 -- It would return 0 in case there is no access or context is not set. This
58 -- function is a wrapper that makes call to MO_GLOBAL.GET_OU_COUNT
59 --
60
61 PROCEDURE GET_DEFAULT_OU
62 (
63 p_product_code IN VARCHAR2 DEFAULT 'PA',
64 p_default_org_id OUT NOCOPY hr_operating_units.organization_id%TYPE,
65 p_default_ou_name OUT NOCOPY hr_operating_units.name%TYPE,
66 p_ou_count OUT NOCOPY NUMBER
67 );
68 -- ========================================================================
69 FUNCTION GET_VALID_OU
70 (
71 p_org_id hr_operating_units.organization_id%TYPE DEFAULT NULL ,
72 p_product_code varchar2 DEFAULT 'PA'
73 )
74 RETURN NUMBER ;
75 --
76 -- This function should be used to determine and get valid operating unit. This function
77 -- checks if the p_org_id that is passed exists in the global temporary table or not. If it
78 -- does not exist, then it would throw up error. Before calling this function, global temp
79 -- table should be populated using MO initialization routine.
80 -- If the passed org_id exists in the global temporary table, then same is returned. If the
81 -- p_org_Id is NULL, this function tries to retrieve current org id or gets the default
82 -- operating unit
83 --
84
85 PROCEDURE INITIALIZE (p_product_code VARCHAR2 DEFAULT 'PA') ;
86 --
87 -- This procedure invokes MO Global initialization routine by passing
88 -- product short code. This procedure would populate the global temporary table with the
89 -- operating units that a user has access to.
90 --
91
92 PROCEDURE SET_POLICY_CONTEXT
93 (
94 p_access_mode VARCHAR2,
95 p_org_id hr_operating_units.organization_id%TYPE
96 );
97 --
98 -- This procedure is used to initialize org context. If the access mode is S, the context
99 -- is set to Single and p_Org_id is set as current org_id, if the access mode is M, the context
100 -- is set to Multiple and then current org_id would be set to NULL.
101 --
102
103 FUNCTION CHECK_ACCESS
104 (
105 p_org_id hr_operating_units.organization_id%TYPE,
106 p_product_code VARCHAR2 DEFAULT 'PA'
107 )
108 RETURN VARCHAR2;
109 --
110 -- This function is used to know if the ORG_ID that is passed has been set in
111 -- the context and if it is valid or not. This function checks if the org_id exists in the
112 -- global temorary table or not, if it is present function returns 'Y', else returns 'N'. Global
113 -- temporary table gets populated when proper org context is initialized.
114 --
115
116 END PA_MOAC_UTILS;