DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_PDI_SHD

Source


1 Package Body ghr_pdi_shd as
2 /* $Header: ghpdirhi.pkb 120.1 2005/06/13 12:28:25 vravikan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ghr_pdi_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 
14 /*
15 Function return_api_dml_status Return Boolean Is
16 --
17   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
18 --
19 Begin
20   hr_utility.set_location('Entering:'||l_proc, 5);
21   --
22   Return (nvl(g_api_dml, false));
23   --
24   hr_utility.set_location(' Leaving:'||l_proc, 10);
25 End return_api_dml_status;
26 */
27 
28 --
29 -- ----------------------------------------------------------------------------
30 -- |---------------------------< constraint_error >---------------------------|
31 -- ----------------------------------------------------------------------------
32 Procedure constraint_error
33             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
34 --
35   l_proc 	varchar2(72) := g_package||'constraint_error';
36 --
37 Begin
38   hr_utility.set_location('Entering:'||l_proc, 5);
39   --
40   If (p_constraint_name = 'GHR_POSITION_DESCRIPTIONS_PK') Then
41     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
42     hr_utility.set_message_token('PROCEDURE', l_proc);
43     hr_utility.set_message_token('STEP','5');
44     hr_utility.raise_error;
45   ElsIf (p_constraint_name = 'GHR_POSITION_DESCRIPTIONS_FK1') Then
46     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
47     hr_utility.set_message_token('PROCEDURE', l_proc);
48     hr_utility.set_message_token('STEP','5');
49     hr_utility.raise_error;
50   Else
51     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
52     hr_utility.set_message_token('PROCEDURE', l_proc);
53     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
54     hr_utility.raise_error;
55   End If;
56   --
57   hr_utility.set_location(' Leaving:'||l_proc, 10);
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64   (
65   p_position_description_id            in number,
66   p_object_version_number              in number
67   )      Return Boolean Is
68 --
69   --
70   -- Cursor selects the 'current' row from the HR Schema
71   --
72   Cursor C_Sel1 is
73     select
74 	position_description_id,
75 	routing_group_id,
76 	date_from,
77 	date_to,
78 	opm_cert_num,
79 	flsa,
80 	financial_statement,
81 	subject_to_ia_action,
82 	position_status,
83 	position_is,
84 	position_sensitivity,
85 	competitive_level,
86 	pd_remarks,
87 	position_class_std,
88 	category,
89 	career_ladder,
90         supervisor_name,
91         supervisor_title,
92         supervisor_date,
93         manager_name,
94         manager_title,
95         manager_date,
96         classifier_name,
97         classifier_title,
98         classifier_date,
99 	attribute_category,
100 	attribute1,
101 	attribute2,
102 	attribute3,
103 	attribute4,
104 	attribute5,
105 	attribute6,
106 	attribute7,
107 	attribute8,
108 	attribute9,
109 	attribute10,
110 	attribute11,
111 	attribute12,
112 	attribute13,
113 	attribute14,
114 	attribute15,
115 	attribute16,
116 	attribute17,
117 	attribute18,
118 	attribute19,
119 	attribute20,
120         business_group_id,
121 	object_version_number
122     from	ghr_position_descriptions
123     where	position_description_id = p_position_description_id;
124 --
125   l_proc	varchar2(72)	:= g_package||'api_updating';
126   l_fct_ret	boolean;
127 --
128 Begin
129   hr_utility.set_location('Entering:'||l_proc, 5);
130   --
131   If (
132 	p_position_description_id is null and
133 	p_object_version_number is null
134      ) Then
135     --
136     -- One of the primary key arguments is null therefore we must
137     -- set the returning function value to false
138     --
139     l_fct_ret := false;
140   Else
141     If (
142 	p_position_description_id = g_old_rec.position_description_id and
143 	p_object_version_number = g_old_rec.object_version_number
144        ) Then
145       hr_utility.set_location(l_proc, 10);
146       --
147       -- The g_old_rec is current therefore we must
148       -- set the returning function to true
149       --
150       l_fct_ret := true;
151     Else
152       --
153       -- Select the current row into g_old_rec
154       --
155       Open C_Sel1;
156       Fetch C_Sel1 Into g_old_rec;
157       If C_Sel1%notfound Then
158         Close C_Sel1;
159         --
160         -- The primary key is invalid therefore we must error
161         --
162         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
163         hr_utility.raise_error;
164       End If;
165       Close C_Sel1;
166       If (p_object_version_number <> g_old_rec.object_version_number) Then
167         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
168         hr_utility.raise_error;
169       End If;
170       hr_utility.set_location(l_proc, 15);
171       l_fct_ret := true;
172     End If;
173   End If;
174   hr_utility.set_location(' Leaving:'||l_proc, 20);
175   Return (l_fct_ret);
176 --
177 End api_updating;
178 --
179 -- ----------------------------------------------------------------------------
180 -- |---------------------------------< lck >----------------------------------|
181 -- ----------------------------------------------------------------------------
182 Procedure lck
183   (
184   p_position_description_id            in number,
185   p_object_version_number              in number
186   ) is
187 --
188 -- Cursor selects the 'current' row from the HR Schema
189 --
190   Cursor C_Sel1 is
191     select 	position_description_id,
192 	routing_group_id,
193 	date_from,
194 	date_to,
195 	opm_cert_num,
196 	flsa,
197 	financial_statement,
198 	subject_to_ia_action,
199 	position_status,
200 	position_is,
201 	position_sensitivity,
202 	competitive_level,
203 	pd_remarks,
204 	position_class_std,
205 	category,
206 	career_ladder,
207         supervisor_name,
208         supervisor_title,
209         supervisor_date,
210         manager_name,
211         manager_title,
212         manager_date,
213         classifier_name,
214         classifier_title,
215         classifier_date,
216 	attribute_category,
217 	attribute1,
218 	attribute2,
219 	attribute3,
220 	attribute4,
221 	attribute5,
222 	attribute6,
223 	attribute7,
224 	attribute8,
225 	attribute9,
226 	attribute10,
227 	attribute11,
228 	attribute12,
229 	attribute13,
230 	attribute14,
231 	attribute15,
232 	attribute16,
233 	attribute17,
234 	attribute18,
235 	attribute19,
236 	attribute20,
237         business_group_id,
238 	object_version_number
239     from	ghr_position_descriptions
240     where	position_description_id = p_position_description_id
241     for	update nowait;
242 --
243   l_proc	varchar2(72) := g_package||'lck';
244 --
245 Begin
246   hr_utility.set_location('Entering:'||l_proc, 5);
247   --
248   -- Add any mandatory argument checking here:
249   -- Example:
250   -- hr_api.mandatory_arg_error
251   --   (p_api_name       => l_proc,
252   --    p_argument       => 'object_version_number',
253   --    p_argument_value => p_object_version_number);
254   --
255   Open  C_Sel1;
256   Fetch C_Sel1 Into g_old_rec;
257   If C_Sel1%notfound then
258     Close C_Sel1;
259     --
260     -- The primary key is invalid therefore we must error
261     --
262     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
263     hr_utility.raise_error;
264   End If;
265   Close C_Sel1;
266   If (p_object_version_number <> g_old_rec.object_version_number) Then
267         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
268         hr_utility.raise_error;
269       End If;
270 --
271   hr_utility.set_location(' Leaving:'||l_proc, 10);
272 --
273 -- We need to trap the ORA LOCK exception
274 --
275 Exception
276   When HR_Api.Object_Locked then
277     --
278     -- The object is locked therefore we need to supply a meaningful
279     -- error message.
280     --
281     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
282     hr_utility.set_message_token('TABLE_NAME', 'ghr_position_descriptions');
283     hr_utility.raise_error;
284 End lck;
285 --
286 -- ----------------------------------------------------------------------------
287 -- |-----------------------------< convert_args >-----------------------------|
288 -- ----------------------------------------------------------------------------
289 Function convert_args
290 	(
291 	p_position_description_id       in number,
292 	p_routing_group_id              in number,
293 	p_date_from                     in date,
294 	p_date_to                       in date,
295 	p_opm_cert_num                  in varchar2,
296 	p_flsa                          in varchar2,
297 	p_financial_statement           in varchar2,
298 	p_subject_to_ia_action                 in varchar2,
299 	p_position_status               in number,
300 	p_position_is                   in varchar2,
301 	p_position_sensitivity          in varchar2,
302 	p_competitive_level             in varchar2,
303 	p_pd_remarks                    in varchar2,
304 	p_position_class_std            in varchar2,
305 	p_category                      in varchar2,
306 	p_career_ladder                 in varchar2,
307         p_supervisor_name		in varchar2,
308   	p_supervisor_title 		in varchar2,
309   	p_supervisor_date               in date,
310   	p_manager_name		        in varchar2,
311   	p_manager_title 		in varchar2,
312   	p_manager_date                  in date,
313   	p_classifier_name		in varchar2,
314   	p_classifier_title 		in varchar2,
315   	p_classifier_date               in date,
316 	p_attribute_category            in varchar2,
317 	p_attribute1                    in varchar2,
318 	p_attribute2                    in varchar2,
319 	p_attribute3                    in varchar2,
320 	p_attribute4                    in varchar2,
321 	p_attribute5                    in varchar2,
322 	p_attribute6                    in varchar2,
323 	p_attribute7                    in varchar2,
324 	p_attribute8                    in varchar2,
325 	p_attribute9                    in varchar2,
326 	p_attribute10                   in varchar2,
327 	p_attribute11                   in varchar2,
328 	p_attribute12                   in varchar2,
329 	p_attribute13                   in varchar2,
330 	p_attribute14                   in varchar2,
331 	p_attribute15                   in varchar2,
332 	p_attribute16                   in varchar2,
333 	p_attribute17                   in varchar2,
334 	p_attribute18                   in varchar2,
335 	p_attribute19                   in varchar2,
336 	p_attribute20                   in varchar2,
337         p_business_group_id             in number,
338 	p_object_version_number         in number
339 	)
340 	Return g_rec_type is
341 --
342   l_rec	  g_rec_type;
343   l_proc  varchar2(72) := g_package||'convert_args';
344 --
345 Begin
346   --
347   hr_utility.set_location('Entering:'||l_proc, 5);
348   --
349   -- Convert arguments into local l_rec structure.
350   --
351   l_rec.position_description_id          := p_position_description_id;
352   l_rec.routing_group_id                 := p_routing_group_id;
353   l_rec.date_from                        := p_date_from;
354   l_rec.date_to                          := p_date_to;
355   l_rec.opm_cert_num                     := p_opm_cert_num;
356   l_rec.flsa                             := p_flsa;
357   l_rec.financial_statement              := p_financial_statement;
358   l_rec.subject_to_ia_action             := p_subject_to_ia_action;
359   l_rec.position_status                  := p_position_status;
360   l_rec.position_is                      := p_position_is;
361   l_rec.position_sensitivity             := p_position_sensitivity;
362   l_rec.competitive_level                := p_competitive_level;
363   l_rec.pd_remarks                       := p_pd_remarks;
364   l_rec.position_class_std               := p_position_class_std;
365   l_rec.category                         := p_category;
366   l_rec.career_ladder                    := p_career_ladder;
367   l_rec.supervisor_name                  := p_supervisor_name;
368   l_rec.supervisor_title		 := p_supervisor_title;
369   l_rec.supervisor_date	                 := p_supervisor_date;
370   l_rec.manager_name	                 := p_manager_name;
371   l_rec.manager_title	                 := p_manager_title;
372   l_rec.manager_date	                 := p_manager_date;
373   l_rec.classifier_name	                 := p_classifier_name;
374   l_rec.classifier_title	         := p_classifier_title;
375   l_rec.classifier_date	                 := p_classifier_date;
376   l_rec.attribute_category               := p_attribute_category;
377   l_rec.attribute1                       := p_attribute1;
378   l_rec.attribute2                       := p_attribute2;
379   l_rec.attribute3                       := p_attribute3;
380   l_rec.attribute4                       := p_attribute4;
381   l_rec.attribute5                       := p_attribute5;
382   l_rec.attribute6                       := p_attribute6;
383   l_rec.attribute7                       := p_attribute7;
384   l_rec.attribute8                       := p_attribute8;
385   l_rec.attribute9                       := p_attribute9;
386   l_rec.attribute10                      := p_attribute10;
387   l_rec.attribute11                      := p_attribute11;
388   l_rec.attribute12                      := p_attribute12;
389   l_rec.attribute13                      := p_attribute13;
390   l_rec.attribute14                      := p_attribute14;
391   l_rec.attribute15                      := p_attribute15;
392   l_rec.attribute16                      := p_attribute16;
393   l_rec.attribute17                      := p_attribute17;
394   l_rec.attribute18                      := p_attribute18;
395   l_rec.attribute19                      := p_attribute19;
396   l_rec.attribute20                      := p_attribute20;
397   l_rec.business_group_id                := p_business_group_id;
398   l_rec.object_version_number            := p_object_version_number;
399   --
400   -- Return the plsql record structure.
401   --
402   hr_utility.set_location(' Leaving:'||l_proc, 10);
403   Return(l_rec);
404 --
405 End convert_args;
406 --
407 end ghr_pdi_shd;