DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PEA_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_pea_shd as
2 /* $Header: pepearhi.pkb 120.0.12010000.1 2008/07/28 05:10:27 appldev ship $*/
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pea_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
18   hr_utility.set_location('Entering:'||l_proc, 5);
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
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 = 'PER_PERSON_ANALYSES_FK1') Then
37     hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
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 = 'PER_PERSON_ANALYSES_FK2') Then
42     hr_utility.set_message(800, 'PER_52091_PEA_INV_ANA_CRI_ID');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'PER_PERSON_ANALYSES_PK') Then
47     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('STEP','15');
50     hr_utility.raise_error;
51   Else
52     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
55     hr_utility.raise_error;
56   End If;
57   --
58   hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65   (
66    p_person_analysis_id                 in number,
67    p_object_version_number              in number
68   )
69    Return Boolean Is
70 --
71   --
72   -- Cursor selects the 'current' row from the HR Schema
73   --
74   Cursor C_Sel1 is
75     select
76         person_analysis_id,
77         business_group_id,
78         analysis_criteria_id,
79         person_id,
80         comments,
81         date_from,
82         date_to,
83         id_flex_num,
84         request_id,
85         program_application_id,
86         program_id,
87         program_update_date,
88         attribute_category,
89         attribute1,
90         attribute2,
91         attribute3,
92         attribute4,
93         attribute5,
94         attribute6,
95         attribute7,
96         attribute8,
97         attribute9,
98         attribute10,
99         attribute11,
100         attribute12,
101         attribute13,
102         attribute14,
103         attribute15,
104         attribute16,
105         attribute17,
106         attribute18,
107         attribute19,
108         attribute20,
109         object_version_number
110     from        per_person_analyses
111     where       person_analysis_id = p_person_analysis_id;
112 --
113   l_proc	varchar2(72)	:= g_package||'api_updating';
114   l_fct_ret	boolean;
115 --
116 Begin
117   hr_utility.set_location('Entering:'||l_proc, 5);
118   --
119   If (
120         p_person_analysis_id is null and
121         p_object_version_number is null
122      ) Then
123     --
124     -- One of the primary key arguments is null therefore we must
125     -- set the returning function value to false
126     --
127     l_fct_ret := false;
128   Else
129     If (
130 	p_person_analysis_id = g_old_rec.person_analysis_id and
131 	p_object_version_number = g_old_rec.object_version_number
132        ) Then
133       hr_utility.set_location(l_proc, 10);
134       --
135       -- The g_old_rec is current therefore we must
136       -- set the returning function to true
137       --
138       l_fct_ret := true;
139     Else
140       --
141       -- Select the current row into g_old_rec
142       --
143       Open C_Sel1;
144       Fetch C_Sel1 Into g_old_rec;
145       If C_Sel1%notfound Then
146         Close C_Sel1;
147         --
148         -- The primary key is invalid therefore we must error
149         --
150         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
151         hr_utility.raise_error;
152       End If;
153       Close C_Sel1;
154       If (p_object_version_number <> g_old_rec.object_version_number) Then
155         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
156         hr_utility.raise_error;
157       End If;
158       hr_utility.set_location(l_proc, 15);
159       l_fct_ret := true;
160     End If;
161   End If;
162   hr_utility.set_location(' Leaving:'||l_proc, 20);
163   Return (l_fct_ret);
164 --
165 End api_updating;
166 --
170 Procedure lck
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
171   (
172    p_person_analysis_id                 in number,
173    p_object_version_number              in number
174   ) is
175 --
176 -- Cursor selects the 'current' row from the HR Schema
177 --
178   Cursor C_Sel1 is
179     select
180         person_analysis_id,
181         business_group_id,
182         analysis_criteria_id,
183         person_id,
184         comments,
185         date_from,
186         date_to,
187         id_flex_num,
188         request_id,
189         program_application_id,
190         program_id,
191         program_update_date,
192         attribute_category,
193         attribute1,
194         attribute2,
195         attribute3,
196         attribute4,
197         attribute5,
198         attribute6,
199         attribute7,
200         attribute8,
201         attribute9,
202         attribute10,
203         attribute11,
204         attribute12,
205         attribute13,
206         attribute14,
207         attribute15,
208         attribute16,
209         attribute17,
210         attribute18,
211         attribute19,
212         attribute20,
213         object_version_number
214     from        per_person_analyses
215     where       person_analysis_id = p_person_analysis_id
216     for	update nowait;
217 --
218   l_proc	varchar2(72) := g_package||'lck';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   hr_utility.set_location(' p_object_version_number '||p_object_version_number, 5.2);
223   		  hr_utility.set_location('g_old_rec.object_version_number :'||g_old_rec.object_version_number, 5.2);
224 
225   --
226   -- Add any mandatory argument checking here:
227   -- Example:
228   -- hr_api.mandatory_arg_error
229   --   (p_api_name       => l_proc,
230   --    p_argument       => 'object_version_number',
231   --    p_argument_value => p_object_version_number);
232   --
233   hr_api.mandatory_arg_error
234   (p_api_name       => l_proc
235   ,p_argument       => 'person_analysis_id'
236   ,p_argument_value => p_person_analysis_id);
237   --
238   hr_api.mandatory_arg_error
239   (p_api_name       => l_proc
240   ,p_argument       => 'object_version_number'
241   ,p_argument_value => p_object_version_number);
242   --
243   Open  C_Sel1;
244   Fetch C_Sel1 Into g_old_rec;
245   If C_Sel1%notfound then
246     Close C_Sel1;
247     --
248     -- The primary key is invalid therefore we must error
249     --
250     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
251     hr_utility.raise_error;
252   End If;
253   Close C_Sel1;
254   If (p_object_version_number <> g_old_rec.object_version_number) Then
255 
256   		 hr_utility.set_location(' p_object_version_number '||p_object_version_number, 5.2);
257   		  hr_utility.set_location('g_old_rec.object_version_number :'||g_old_rec.object_version_number, 5.2);
258 
259         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
260         hr_utility.raise_error;
261       End If;
262 --
263   hr_utility.set_location(' Leaving:'||l_proc, 10);
264 --
265 -- We need to trap the ORA LOCK exception
266 --
267 Exception
268   When HR_Api.Object_Locked then
269     --
270     -- The object is locked therefore we need to supply a meaningful
271     -- error message.
272     --
273     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
274     hr_utility.set_message_token('TABLE_NAME', 'per_person_analyses');
275     hr_utility.raise_error;
276 End lck;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |-----------------------------< convert_args >-----------------------------|
280 -- ----------------------------------------------------------------------------
281 Function convert_args
282         (
283         p_person_analysis_id            in number,
284         p_business_group_id             in number,
285         p_analysis_criteria_id          in number,
286         p_person_id                     in number,
287         p_comments                      in varchar2,
288         p_date_from                     in date,
289         p_date_to                       in date,
290         p_id_flex_num                   in number,
291         p_request_id                    in number,
292         p_program_application_id        in number,
293         p_program_id                    in number,
294         p_program_update_date           in date,
295         p_attribute_category            in varchar2,
296         p_attribute1                    in varchar2,
297         p_attribute2                    in varchar2,
298         p_attribute3                    in varchar2,
299         p_attribute4                    in varchar2,
300         p_attribute5                    in varchar2,
301         p_attribute6                    in varchar2,
302         p_attribute7                    in varchar2,
303         p_attribute8                    in varchar2,
304         p_attribute9                    in varchar2,
305         p_attribute10                   in varchar2,
306         p_attribute11                   in varchar2,
307         p_attribute12                   in varchar2,
308         p_attribute13                   in varchar2,
309         p_attribute14                   in varchar2,
310         p_attribute15                   in varchar2,
314         p_attribute19                   in varchar2,
311         p_attribute16                   in varchar2,
312         p_attribute17                   in varchar2,
313         p_attribute18                   in varchar2,
315         p_attribute20                   in varchar2,
316         p_object_version_number         in number
317         )
318         Return g_rec_type is
319 --
320   l_rec	  g_rec_type;
321   l_proc  varchar2(72) := g_package||'convert_args';
322 --
323 Begin
324   --
325   hr_utility.set_location('Entering:'||l_proc, 5);
326   --
327   -- Convert arguments into local l_rec structure.
328   --
329   l_rec.person_analysis_id               := p_person_analysis_id;
330   l_rec.business_group_id                := p_business_group_id;
331   l_rec.analysis_criteria_id             := p_analysis_criteria_id;
332   l_rec.person_id                        := p_person_id;
333   l_rec.comments                         := p_comments;
334   l_rec.date_from                        := p_date_from;
335   l_rec.date_to                          := p_date_to;
336   l_rec.id_flex_num                      := p_id_flex_num;
337   l_rec.request_id                       := p_request_id;
338   l_rec.program_application_id           := p_program_application_id;
339   l_rec.program_id                       := p_program_id;
340   l_rec.program_update_date              := p_program_update_date;
341   l_rec.attribute_category               := p_attribute_category;
342   l_rec.attribute1                       := p_attribute1;
343   l_rec.attribute2                       := p_attribute2;
344   l_rec.attribute3                       := p_attribute3;
345   l_rec.attribute4                       := p_attribute4;
346   l_rec.attribute5                       := p_attribute5;
347   l_rec.attribute6                       := p_attribute6;
348   l_rec.attribute7                       := p_attribute7;
349   l_rec.attribute8                       := p_attribute8;
350   l_rec.attribute9                       := p_attribute9;
351   l_rec.attribute10                      := p_attribute10;
352   l_rec.attribute11                      := p_attribute11;
353   l_rec.attribute12                      := p_attribute12;
354   l_rec.attribute13                      := p_attribute13;
355   l_rec.attribute14                      := p_attribute14;
356   l_rec.attribute15                      := p_attribute15;
357   l_rec.attribute16                      := p_attribute16;
358   l_rec.attribute17                      := p_attribute17;
359   l_rec.attribute18                      := p_attribute18;
360   l_rec.attribute19                      := p_attribute19;
361   l_rec.attribute20                      := p_attribute20;
362   l_rec.object_version_number            := p_object_version_number;
363   --
364   -- Return the plsql record structure.
365   --
366   hr_utility.set_location(' Leaving:'||l_proc, 10);
367   Return(l_rec);
368 --
369 End convert_args;
370 --
371 end per_pea_shd;