[Home] [Help]
PACKAGE BODY: APPS.HR_AHC_SHD
Source
1 Package Body hr_ahc_shd as
2 /* $Header: hrahcrhi.pkb 115.7 2002/12/02 14:52:05 apholt ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_ahc_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_HOOK_CALLS_CK1') Then
22 hr_utility.set_message(800, 'PER_52135_AHC_HK_CALL_TYPE_INV');
23 hr_utility.raise_error;
24
25 ----------------------------------------------------------------------
26 -- This constraint now has two error messages associated with it.
27 -- These are called from the chk_sequence procedure and therefore this
28 -- condition will never be called.
29 ----------------------------------------------------------------------
30 ElsIf (p_constraint_name = 'HR_API_HOOK_CALLS_CK2') 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','10');
34 hr_utility.raise_error;
35 ElsIf (p_constraint_name = 'HR_API_HOOK_CALLS_FK1') Then
36 hr_utility.set_message(800, 'PER_52134_AHC_HOOK_ID_INV');
37 hr_utility.raise_error;
38 ElsIf (p_constraint_name = 'HR_API_HOOK_CALLS_PK') Then
39 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
40 hr_utility.set_message_token('PROCEDURE', l_proc);
41 hr_utility.set_message_token('STEP','20');
42 hr_utility.raise_error;
43 ElsIf (p_constraint_name = 'HR_API_HOOK_CALLS_UK1') Then
44 hr_utility.set_message(800, 'PER_52139_AHC_DUP_PROC_CALL');
45 hr_utility.raise_error;
46 Else
47 hr_utility.set_message(800, 'HR_7877_API_INVALID_CONSTRAINT');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50 hr_utility.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (
61 p_api_hook_call_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 api_hook_call_id,
71 api_hook_id,
72 api_hook_call_type,
73 legislation_code,
74 sequence,
75 enabled_flag,
76 call_package,
77 call_procedure,
78 pre_processor_date,
79 encoded_error,
80 status,
81 object_version_number,
82 application_id,
83 app_install_status
84 from hr_api_hook_calls
85 where api_hook_call_id = p_api_hook_call_id;
86 --
87 l_proc varchar2(72) := g_package||'api_updating';
88 l_fct_ret boolean;
89 --
90 Begin
91 hr_utility.set_location('Entering:'||l_proc, 5);
92 --
93 If (
94 p_api_hook_call_id is null and
95 p_object_version_number is null
96 ) Then
97 --
98 -- One of the primary key arguments is null therefore we must
99 -- set the returning function value to false
100 --
101 l_fct_ret := false;
102 Else
103 If (
104 p_api_hook_call_id = g_old_rec.api_hook_call_id and
105 p_object_version_number = g_old_rec.object_version_number
106 ) Then
107 hr_utility.set_location(l_proc, 10);
108 --
109 -- The g_old_rec is current therefore we must
110 -- set the returning function to true
111 --
112 l_fct_ret := true;
113 Else
114 --
115 -- Select the current row into g_old_rec
116 --
117 Open C_Sel1;
118 Fetch C_Sel1 Into g_old_rec;
119 If C_Sel1%notfound Then
120 Close C_Sel1;
121 --
122 -- The primary key is invalid therefore we must error
123 --
124 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
125 hr_utility.raise_error;
126 End If;
127 Close C_Sel1;
128 If (p_object_version_number <> g_old_rec.object_version_number) Then
129 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
130 hr_utility.raise_error;
131 End If;
132 hr_utility.set_location(l_proc, 15);
133 l_fct_ret := true;
134 End If;
135 End If;
136 hr_utility.set_location(' Leaving:'||l_proc, 20);
137 Return (l_fct_ret);
138 --
139 End api_updating;
140 --
141 -- ----------------------------------------------------------------------------
142 -- |---------------------------------< lck >----------------------------------|
143 -- ----------------------------------------------------------------------------
144 Procedure lck
145 (
146 p_api_hook_call_id in number,
147 p_object_version_number in number
148 ) is
149 --
150 -- Cursor selects the 'current' row from the HR Schema
151 --
152 Cursor C_Sel1 is
153 select api_hook_call_id,
154 api_hook_id,
155 api_hook_call_type,
156 legislation_code,
157 sequence,
158 enabled_flag,
159 call_package,
160 call_procedure,
161 pre_processor_date,
162 encoded_error,
163 status,
164 object_version_number,
165 application_id,
166 app_install_status
167 from hr_api_hook_calls
168 where api_hook_call_id = p_api_hook_call_id
169 for update nowait;
170 --
171 l_proc varchar2(72) := g_package||'lck';
172 --
173 Begin
174 hr_utility.set_location('Entering:'||l_proc, 5);
175 --
176 -- Check that the object version number is set
177 --
178 hr_api.mandatory_arg_error
179 (p_api_name => l_proc
180 ,p_argument => 'object_version_number'
181 ,p_argument_value => p_object_version_number
182 );
183 --
184 Open C_Sel1;
185 Fetch C_Sel1 Into g_old_rec;
186 If C_Sel1%notfound then
187 Close C_Sel1;
188 --
189 -- The primary key is invalid therefore we must error
190 --
191 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
192 hr_utility.raise_error;
193 End If;
194 Close C_Sel1;
195 If (p_object_version_number <> g_old_rec.object_version_number) Then
196 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
197 hr_utility.raise_error;
198 End If;
199 --
200 hr_utility.set_location(' Leaving:'||l_proc, 10);
201 --
202 -- We need to trap the ORA LOCK exception
203 --
204 Exception
205 When HR_Api.Object_Locked then
206 --
207 -- The object is locked therefore we need to supply a meaningful
208 -- error message.
209 --
210 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
211 hr_utility.set_message_token('TABLE_NAME', 'hr_api_hook_calls');
212 hr_utility.raise_error;
213 End lck;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |-----------------------------< convert_args >-----------------------------|
217 -- ----------------------------------------------------------------------------
218 Function convert_args
219 (
220 p_api_hook_call_id in number,
221 p_api_hook_id in number,
222 p_api_hook_call_type in varchar2,
223 p_legislation_code in varchar2,
224 p_sequence in number,
225 p_enabled_flag in varchar2,
226 p_call_package in varchar2,
227 p_call_procedure in varchar2,
228 p_pre_processor_date in date,
229 p_encoded_error in varchar2,
230 p_status in varchar2,
231 p_object_version_number in number,
232 p_application_id in number,
233 p_app_install_status in varchar2
234 )
235 Return g_rec_type is
236 --
237 l_rec g_rec_type;
238 l_proc varchar2(72) := g_package||'convert_args';
239 --
240 Begin
241 --
242 hr_utility.set_location('Entering:'||l_proc, 5);
243 --
244 -- Convert arguments into local l_rec structure.
245 --
246 l_rec.api_hook_call_id := p_api_hook_call_id;
247 l_rec.api_hook_id := p_api_hook_id;
248 l_rec.api_hook_call_type := p_api_hook_call_type;
249 l_rec.legislation_code := p_legislation_code;
250 l_rec.sequence := p_sequence;
251 l_rec.enabled_flag := p_enabled_flag;
252 l_rec.call_package := p_call_package;
253 l_rec.call_procedure := p_call_procedure;
254 l_rec.pre_processor_date := p_pre_processor_date;
255 l_rec.encoded_error := p_encoded_error;
256 l_rec.status := p_status;
257 l_rec.object_version_number := p_object_version_number;
258 l_rec.application_id := p_application_id;
259 l_rec.app_install_status := p_app_install_status;
260 --
261 -- Return the plsql record structure.
262 --
263 hr_utility.set_location(' Leaving:'||l_proc, 10);
264 Return(l_rec);
265 --
266 End convert_args;
267 --
268 end hr_ahc_shd;