DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_AHK_SHD

Source


1 Package Body hr_ahk_shd as
2 /* $Header: hrahkrhi.pkb 115.8 2002/12/03 16:34:49 apholt ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_ahk_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   If (p_constraint_name = 'HR_API_HOOKS_CK1') Then
22     hr_utility.set_message(800, 'PER_52127_AHK_HOOK_TYPE_INV');
23     hr_utility.raise_error;
24   ElsIf (p_constraint_name = 'HR_API_HOOKS_CK2') Then
25     hr_utility.set_message(800, 'PER_52133_AHK_LEG_PACK_FUN_INV');
26     hr_utility.raise_error;
27   ElsIf (p_constraint_name = 'HR_API_HOOKS_FK1') Then
28     hr_utility.set_message(800, 'PER_52154_AHK_MOD_ID_INV');
29     hr_utility.raise_error;
30   ElsIf (p_constraint_name = 'HR_API_HOOKS_PK') Then
31     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
32     hr_utility.set_message_token('PROCEDURE', l_proc);
33     hr_utility.set_message_token('STEP','20');
34     hr_utility.raise_error;
35   ElsIf (p_constraint_name = 'HR_API_HOOKS_UK1') Then
36     hr_utility.set_message(800, 'PER_52128_AHK_DUP_HOOK_TYPE');
37     hr_utility.raise_error;
38   ElsIf (p_constraint_name = 'HR_API_HOOKS_UK2') Then
39     hr_utility.set_message(800, 'PER_52130_AHK_HOOK_PROC_INV');
40     hr_utility.raise_error;
41   Else
42     hr_utility.set_message(800, 'HR_7877_API_INVALID_CONSTRAINT');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45     hr_utility.raise_error;
46   End If;
47   --
48   hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (
56   p_api_hook_id                        in number
57   )      Return Boolean Is
58 --
59   --
60   -- Cursor selects the 'current' row from the HR Schema
61   --
62   Cursor C_Sel1 is
63     select
64 		api_hook_id,
65 	api_module_id,
66 	api_hook_type,
67 	hook_package,
68 	hook_procedure,
69 	legislation_code,
70 	legislation_package,
71 	legislation_function,
72 	encoded_error
73     from	hr_api_hooks
74     where	api_hook_id = p_api_hook_id;
75 --
76   l_proc	varchar2(72)	:= g_package||'api_updating';
77   l_fct_ret	boolean;
78 --
79 Begin
80   hr_utility.set_location('Entering:'||l_proc, 5);
81   --
82   If (
83 	p_api_hook_id is null
84      ) Then
85     --
86     -- One of the primary key arguments is null therefore we must
87     -- set the returning function value to false
88     --
89     l_fct_ret := false;
90   Else
91     If (
92 	p_api_hook_id = g_old_rec.api_hook_id
93        ) Then
94       hr_utility.set_location(l_proc, 10);
95       --
96       -- The g_old_rec is current therefore we must
97       -- set the returning function to true
98       --
99       l_fct_ret := true;
100     Else
101       --
102       -- Select the current row into g_old_rec
103       --
104       Open C_Sel1;
105       Fetch C_Sel1 Into g_old_rec;
106       If C_Sel1%notfound Then
107         Close C_Sel1;
108         --
109         -- The primary key is invalid therefore we must error
110         --
111         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
112         hr_utility.raise_error;
113       End If;
114       Close C_Sel1;
115       --
116       hr_utility.set_location(l_proc, 15);
117       l_fct_ret := true;
118     End If;
119   End If;
120   hr_utility.set_location(' Leaving:'||l_proc, 20);
121   Return (l_fct_ret);
122 --
123 End api_updating;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------------< lck >----------------------------------|
127 -- ----------------------------------------------------------------------------
128 Procedure lck
129   (
130   p_api_hook_id                        in number
131   ) is
132 --
133 -- Cursor selects the 'current' row from the HR Schema
134 --
135   Cursor C_Sel1 is
136     select 	api_hook_id,
137 	api_module_id,
138 	api_hook_type,
139 	hook_package,
140 	hook_procedure,
141 	legislation_code,
142 	legislation_package,
143 	legislation_function,
144 	encoded_error
145     from	hr_api_hooks
146     where	api_hook_id = p_api_hook_id
147     for	update nowait;
148 --
149   l_proc	varchar2(72) := g_package||'lck';
150 --
151 Begin
152   hr_utility.set_location('Entering:'||l_proc, 5);
153   --
154   -- Add any mandatory argument checking here:
155   -- Example:
156   -- hr_api.mandatory_arg_error
157   --   (p_api_name       => l_proc,
158   --    p_argument       => 'object_version_number',
159   --    p_argument_value => p_object_version_number);
160   --
161   Open  C_Sel1;
162   Fetch C_Sel1 Into g_old_rec;
163   If C_Sel1%notfound then
164     Close C_Sel1;
165     --
166     -- The primary key is invalid therefore we must error
167     --
168     hr_utility.set_message(800, 'HR_7220_INVALID_PRIMARY_KEY');
169     hr_utility.raise_error;
170   End If;
171   Close C_Sel1;
172   --
173 --
174   hr_utility.set_location(' Leaving:'||l_proc, 10);
175 --
176 -- We need to trap the ORA LOCK exception
177 --
178 Exception
179   When HR_Api.Object_Locked then
180     --
181     -- The object is locked therefore we need to supply a meaningful
182     -- error message.
183     --
184     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
185     hr_utility.set_message_token('TABLE_NAME', 'hr_api_hooks');
186     hr_utility.raise_error;
187 End lck;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |-----------------------------< convert_args >-----------------------------|
191 -- ----------------------------------------------------------------------------
192 Function convert_args
193 	(
194 	p_api_hook_id                   in number,
195 	p_api_module_id                 in number,
196 	p_api_hook_type                 in varchar2,
197 	p_hook_package                  in varchar2,
198 	p_hook_procedure                in varchar2,
199 	p_legislation_code              in varchar2,
200 	p_legislation_package           in varchar2,
201 	p_legislation_function          in varchar2,
202         p_encoded_error                 in varchar2
203 	)
204 	Return g_rec_type is
205 --
206   l_rec	  g_rec_type;
207   l_proc  varchar2(72) := g_package||'convert_args';
208 --
209 Begin
210   --
211   hr_utility.set_location('Entering:'||l_proc, 5);
212   --
213   -- Convert arguments into local l_rec structure.
214   --
215   --   mjh_webform.h3heading_createdefault('conv_arg: pkey = '||p_api_hook_id);
216   l_rec.api_hook_id                      := p_api_hook_id;
217   l_rec.api_module_id                    := p_api_module_id;
218   l_rec.api_hook_type                    := p_api_hook_type;
219   l_rec.hook_package                     := p_hook_package;
220   l_rec.hook_procedure                   := p_hook_procedure;
221   l_rec.legislation_code                 := p_legislation_code;
222   l_rec.legislation_package              := p_legislation_package;
223   l_rec.legislation_function             := p_legislation_function;
224   l_rec.encoded_error                    := p_encoded_error;
225   --
226   -- Return the plsql record structure.
227   --
228   hr_utility.set_location(' Leaving:'||l_proc, 10);
229   Return(l_rec);
230 --
231 End convert_args;
232 --
233 end hr_ahk_shd;