DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TRS_SHD

Source


1 Package Body hr_trs_shd as
2 /* $Header: hrtrsrhi.pkb 120.2 2005/10/11 02:10:33 hpandya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_trs_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc    varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc    varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'HR_API_TRANSACTION_STEPS_FK1') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   ElsIf (p_constraint_name = 'HR_API_TRANSACTION_STEPS_PK') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   Else
47     hr_utility.set_message(801, '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_transaction_step_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 transaction_step_id,
70     transaction_id,
71     api_name,
72     api_display_name,
73     processing_order,
74     item_type,
75     item_key,
76     activity_id,
77     creator_person_id,
78     update_person_id,
79     object_version_number,
80     object_type,
81     object_name,
82     object_identifier,
83     object_state,
84     pk1,
85     pk2,
86     pk3,
87     pk4,
88     pk5,
89     information_category,
90     information1,
91     information2,
92     information3,
93     information4,
94     information5,
95     information6,
96     information7,
97     information8,
98     information9,
99     information10,
100     information11,
101     information12,
102     information13,
103     information14,
104     information15,
105     information16,
106     information17,
107     information18,
108     information19,
109     information20,
110     information21,
111     information22,
112     information23,
113     information24,
114     information25,
115     information26,
116     information27,
117     information28,
118     information29,
119     information30
120     from    hr_api_transaction_steps
121     where   transaction_step_id = p_transaction_step_id;
122 --
123   l_proc    varchar2(72)    := g_package||'api_updating';
124   l_fct_ret boolean;
125 --
126 Begin
127   hr_utility.set_location('Entering:'||l_proc, 5);
128   --
129   If (
130     p_transaction_step_id is null and
131     p_object_version_number is null
132      ) Then
133     --
134     -- One of the primary key arguments is null therefore we must
135     -- set the returning function value to false
136     --
137     l_fct_ret := false;
138   Else
139     If (
140     p_transaction_step_id = g_old_rec.transaction_step_id and
141     p_object_version_number = g_old_rec.object_version_number
142        ) Then
143       hr_utility.set_location(l_proc, 10);
144       --
145       -- The g_old_rec is current therefore we must
146       -- set the returning function to true
147       --
148       l_fct_ret := true;
149     Else
150       --
151       -- Select the current row into g_old_rec
152       --
153       Open C_Sel1;
154       Fetch C_Sel1 Into g_old_rec;
155       If C_Sel1%notfound Then
156         Close C_Sel1;
157         --
158         -- The primary key is invalid therefore we must error
159         --
160         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
161         hr_utility.raise_error;
162       End If;
163       Close C_Sel1;
164       If (p_object_version_number <> g_old_rec.object_version_number) Then
165         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
166         hr_utility.raise_error;
167       End If;
168       hr_utility.set_location(l_proc, 15);
169       l_fct_ret := true;
170     End If;
171   End If;
172   hr_utility.set_location(' Leaving:'||l_proc, 20);
173   Return (l_fct_ret);
174 --
175 End api_updating;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |---------------------------------< lck >----------------------------------|
179 -- ----------------------------------------------------------------------------
180 Procedure lck
181   (
182   p_transaction_step_id                in number,
183   p_object_version_number              in number
184   ) is
185 --
186 -- Cursor selects the 'current' row from the HR Schema
187 --
188   Cursor C_Sel1 is
189     select  transaction_step_id,
190     transaction_id,
191     api_name,
192     api_display_name,
193     processing_order,
194     item_type,
195     item_key,
196     activity_id,
197     creator_person_id,
198     update_person_id,
199     object_version_number,
200     object_type,
201     object_name,
202     object_identifier,
203     object_state,
204     pk1,
205     pk2,
206     pk3,
207     pk4,
208     pk5,
209     information_category,
210     information1,
211     information2,
212     information3,
213     information4,
214     information5,
215     information6,
216     information7,
217     information8,
218     information9,
219     information10,
220     information11,
221     information12,
222     information13,
223     information14,
224     information15,
225     information16,
226     information17,
227     information18,
228     information19,
229     information20,
230     information21,
231     information22,
232     information23,
233     information24,
234     information25,
235     information26,
236     information27,
237     information28,
238     information29,
239     information30
240     from    hr_api_transaction_steps
241     where   transaction_step_id = p_transaction_step_id
242     for update nowait;
243 --
244   l_proc    varchar2(72) := g_package||'lck';
245 --
246 Begin
247   hr_utility.set_location('Entering:'||l_proc, 5);
248   --
249   -- Add any mandatory argument checking here:
250   -- Example:
251   -- hr_api.mandatory_arg_error
252   --   (p_api_name       => l_proc,
253   --    p_argument       => 'object_version_number',
254   --    p_argument_value => p_object_version_number);
255   --
256   Open  C_Sel1;
257   Fetch C_Sel1 Into g_old_rec;
258   If C_Sel1%notfound then
259     Close C_Sel1;
260     --
261     -- The primary key is invalid therefore we must error
262     --
263     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
264     hr_utility.raise_error;
265   End If;
266   Close C_Sel1;
267   If (p_object_version_number <> g_old_rec.object_version_number) Then
268         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
269         hr_utility.raise_error;
270       End If;
271 --
272   hr_utility.set_location(' Leaving:'||l_proc, 10);
273 --
274 -- We need to trap the ORA LOCK exception
275 --
276 Exception
277   When HR_Api.Object_Locked then
278     --
279     -- The object is locked therefore we need to supply a meaningful
280     -- error message.
281     --
282     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
283     hr_utility.set_message_token('TABLE_NAME', 'hr_api_transaction_steps');
284     hr_utility.raise_error;
285 End lck;
286 --
287 -- ----------------------------------------------------------------------------
288 -- |-----------------------------< convert_args >-----------------------------|
289 -- ----------------------------------------------------------------------------
290 Function convert_args
291     (
292     p_transaction_step_id           in number,
293     p_transaction_id                in number,
294     p_api_name                      in varchar2,
295     p_api_display_name              in varchar2,
296     p_processing_order              in number,
297     p_item_type                     in varchar2,
298     p_item_key                      in varchar2,
299     p_activity_id                   in number,
300     p_creator_person_id             in number,
301     p_update_person_id              in number,
302     p_object_version_number         in number,
303     p_object_type                   in varchar2,
304     p_object_name                   in varchar2,
305     p_object_identifier             in  varchar2,
306     p_object_state                  in varchar2,
307     p_pk1                           in  varchar2,
308     p_pk2                           in  varchar2,
309     p_pk3                           in  varchar2,
310     p_pk4                           in  varchar2,
311     p_pk5                           in  varchar2,
312     p_information_category	    in  varchar2,
313     p_information1		    in  varchar2,
314     p_information2		    in  varchar2,
315     p_information3		    in  varchar2,
316     p_information4		    in  varchar2,
317     p_information5		    in  varchar2,
318     p_information6		    in  varchar2,
319     p_information7		    in  varchar2,
320     p_information8		    in  varchar2,
321     p_information9		    in  varchar2,
322     p_information10		    in  varchar2,
323     p_information11		    in  varchar2,
324     p_information12		    in  varchar2,
325     p_information13		    in  varchar2,
326     p_information14		    in  varchar2,
327     p_information15		    in  varchar2,
328     p_information16		    in  varchar2,
329     p_information17		    in  varchar2,
330     p_information18		    in  varchar2,
331     p_information19		    in  varchar2,
332     p_information20		    in  varchar2,
333     p_information21		    in  varchar2,
334     p_information22		    in  varchar2,
335     p_information23		    in  varchar2,
336     p_information24		    in  varchar2,
337     p_information25		    in  varchar2,
338     p_information26		    in  varchar2,
339     p_information27		    in  varchar2,
340     p_information28		    in  varchar2,
341     p_information29		    in  varchar2,
342     p_information30		    in  varchar2
343 
344     )
345     Return g_rec_type is
346 --
347   l_rec   g_rec_type;
348   l_proc  varchar2(72) := g_package||'convert_args';
349 --
350 Begin
351   --
352   hr_utility.set_location('Entering:'||l_proc, 5);
353   --
354   -- Convert arguments into local l_rec structure.
355   --
356   l_rec.transaction_step_id            := p_transaction_step_id;
357   l_rec.transaction_id                 := p_transaction_id;
358   l_rec.api_name                       := p_api_name;
359   l_rec.api_display_name               := p_api_display_name;
360   l_rec.processing_order               := p_processing_order;
361   l_rec.item_type                      := p_item_type;
362   l_rec.item_key                       := p_item_key;
363   l_rec.activity_id                    := p_activity_id;
364   l_rec.creator_person_id              := p_creator_person_id;
365   l_rec.update_person_id               := p_update_person_id;
366   l_rec.object_version_number          := p_object_version_number;
367   l_rec.object_type                    := p_object_type;
368   l_rec.object_name               	   := p_object_name;
369   l_rec.object_identifier          	   := p_object_identifier;
370   l_rec.object_state                   := p_object_state;
371   l_rec.pk1                        	   := p_pk1;
372   l_rec.pk2                        	   := p_pk2;
373   l_rec.pk3                        	   := p_pk3;
374   l_rec.pk4                        	   := p_pk4;
375   l_rec.pk5                        	   := p_pk5;
376   l_rec.information_category           	   := p_information_category;
377   l_rec.information1               	   := p_information1;
378   l_rec.information2               	   := p_information2;
379   l_rec.information3               	   := p_information3;
380   l_rec.information4               	   := p_information4;
381   l_rec.information5               	   := p_information5;
382   l_rec.information6               	   := p_information6;
383   l_rec.information7               	   := p_information7;
384   l_rec.information8               	   := p_information8;
385   l_rec.information9               	   := p_information9;
386   l_rec.information10               	   := p_information10;
387   l_rec.information11               	   := p_information11;
388   l_rec.information12               	   := p_information12;
389   l_rec.information13               	   := p_information13;
390   l_rec.information14               	   := p_information14;
391   l_rec.information15               	   := p_information15;
392   l_rec.information16               	   := p_information16;
393   l_rec.information17               	   := p_information17;
394   l_rec.information18               	   := p_information18;
395   l_rec.information19               	   := p_information19;
396   l_rec.information20               	   := p_information20;
397   l_rec.information21               	   := p_information21;
398   l_rec.information22               	   := p_information22;
399   l_rec.information23               	   := p_information23;
400   l_rec.information24              	   := p_information24;
401   l_rec.information25              	   := p_information25;
402   l_rec.information26               	   := p_information26;
403   l_rec.information27               	   := p_information27;
404   l_rec.information28               	   := p_information28;
405   l_rec.information29              	   := p_information29;
406   l_rec.information30               	   := p_information30;
407   --
408   -- Return the plsql record structure.
409   --
410   hr_utility.set_location(' Leaving:'||l_proc, 10);
411   Return(l_rec);
412 --
413 End convert_args;
414 --
415 end hr_trs_shd;