DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APL_SHD

Source


1 Package Body per_apl_shd as
2 /* $Header: peaplrhi.pkb 120.2.12020000.3 2013/01/18 06:52:05 srannama ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_apl_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 = 'PER_APPLICATIONS_FK1') Then
37     hr_utility.set_message(801, 'HR_51183_APL_BUS_GRP_INVALID');
38     hr_utility.raise_error;
39   ElsIf (p_constraint_name = 'PER_APPLICATIONS_PK') Then
40     hr_utility.set_message(801, 'HR_51184_APL_PK');
41     hr_utility.raise_error;
42   ElsIf (p_constraint_name = 'PER_APPL_SUCCESSFUL_FLAG_CHK') Then
43     hr_utility.set_message(801, 'HR_51186_APL_CHK');
44     hr_utility.raise_error;
45   Else
46     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
47     hr_utility.set_message_token('PROCEDURE', l_proc);
48     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
49     hr_utility.raise_error;
50   End If;
51   --
52   hr_utility.set_location(' Leaving:'||l_proc, 10);
53 End constraint_error;
54 --
55 -- ----------------------------------------------------------------------------
56 -- |-----------------------------< api_updating >-----------------------------|
57 -- ----------------------------------------------------------------------------
58 Function api_updating
59   (
60   p_application_id                     in number,
61   p_object_version_number              in number
62   )      Return Boolean Is
63 --
64   --
65   -- Cursor selects the 'current' row from the HR Schema
66   --
67   Cursor C_Sel1 is
68     select
69         application_id,
70 	business_group_id,
71 	person_id,
72 	date_received,
73 	comments,
74 	current_employer,
75 	date_end,
76 	projected_hire_date,
77 	successful_flag,
78 	termination_reason,
79 	request_id,
80 	program_application_id,
81 	program_id,
82 	program_update_date,
83 	appl_attribute_category,
84 	appl_attribute1,
85 	appl_attribute2,
86 	appl_attribute3,
87 	appl_attribute4,
88 	appl_attribute5,
89 	appl_attribute6,
90 	appl_attribute7,
91 	appl_attribute8,
92 	appl_attribute9,
93 	appl_attribute10,
94 	appl_attribute11,
95 	appl_attribute12,
96 	appl_attribute13,
97 	appl_attribute14,
98 	appl_attribute15,
99 	appl_attribute16,
100 	appl_attribute17,
104 	object_version_number
101 	appl_attribute18,
102 	appl_attribute19,
103 	appl_attribute20,
105     from	per_applications
106     where	application_id = p_application_id;
107 --
108   l_proc	varchar2(72)	:= g_package||'api_updating';
109   l_fct_ret	boolean;
110 --
111 Begin
112   hr_utility.set_location('Entering:'||l_proc, 5);
113   --
114   If (
115 	p_application_id is null and
116 	p_object_version_number is null
117      ) Then
118     --
119     -- One of the primary key arguments is null therefore we must
120     -- set the returning function value to false
121     --
122     l_fct_ret := false;
123   Else
124     If (
125 	p_application_id = g_old_rec.application_id and
126 	p_object_version_number = g_old_rec.object_version_number
127        ) Then
128       hr_utility.set_location(l_proc, 10);
129       --
130       -- The g_old_rec is current therefore we must
131       -- set the returning function to true
132       --
133       l_fct_ret := true;
134     Else
135       --
136       -- Select the current row into g_old_rec
137       --
138       Open C_Sel1;
139       Fetch C_Sel1 Into g_old_rec;
140       If C_Sel1%notfound Then
141         Close C_Sel1;
142         --
143         -- The primary key is invalid therefore we must error
144         --
145         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
146         hr_utility.raise_error;
147       End If;
148       Close C_Sel1;
149       If (p_object_version_number <> g_old_rec.object_version_number) Then
150         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
151         hr_utility.raise_error;
152       End If;
153       hr_utility.set_location(l_proc, 15);
154       l_fct_ret := true;
155     End If;
156   End If;
157   hr_utility.set_location(' Leaving:'||l_proc, 20);
158   Return (l_fct_ret);
159 --
160 End api_updating;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |---------------------------------< lck >----------------------------------|
164 -- ----------------------------------------------------------------------------
165 Procedure lck
166   (
167   p_application_id                     in number,
168   p_object_version_number              in number
169   ) is
170 --
171 -- Cursor selects the 'current' row from the HR Schema
172 --
173   Cursor C_Sel1 is
174     select 	application_id,
175 	business_group_id,
176 	person_id,
177 	date_received,
178 	comments,
179 	current_employer,
180 	date_end,
181 	projected_hire_date,
182 	successful_flag,
183 	termination_reason,
184 	request_id,
185 	program_application_id,
186 	program_id,
187 	program_update_date,
188 	appl_attribute_category,
189 	appl_attribute1,
190 	appl_attribute2,
191 	appl_attribute3,
192 	appl_attribute4,
193 	appl_attribute5,
194 	appl_attribute6,
195 	appl_attribute7,
196 	appl_attribute8,
197 	appl_attribute9,
198 	appl_attribute10,
199 	appl_attribute11,
200 	appl_attribute12,
201 	appl_attribute13,
202 	appl_attribute14,
203 	appl_attribute15,
204 	appl_attribute16,
205 	appl_attribute17,
206 	appl_attribute18,
207 	appl_attribute19,
208 	appl_attribute20,
209 	object_version_number
210     from	per_applications
211     where	application_id = p_application_id
212     for	update nowait;
213 --
214   l_proc	varchar2(72) := g_package||'lck';
215 --
216 Begin
217   hr_utility.set_location('Entering:'||l_proc, 5);
218   --
219   -- Add any mandatory argument checking here:
220   -- Example:
221   -- hr_api.mandatory_arg_error
222   --   (p_api_name       => l_proc,
223   --    p_argument       => 'object_version_number',
224   --    p_argument_value => p_object_version_number);
225   --
226   Open  C_Sel1;
227   Fetch C_Sel1 Into g_old_rec;
228   If C_Sel1%notfound then
229     Close C_Sel1;
230     --
231     -- The primary key is invalid therefore we must error
232     --
233     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
234     hr_utility.raise_error;
235   End If;
236   Close C_Sel1;
237   If (p_object_version_number <> g_old_rec.object_version_number) Then
238         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
239         hr_utility.raise_error;
240       End If;
241 --
242   hr_utility.set_location(' Leaving:'||l_proc, 10);
243 --
244 -- We need to trap the ORA LOCK exception
245 --
246 Exception
247   When HR_Api.Object_Locked then
248     --
249     -- The object is locked therefore we need to supply a meaningful
250     -- error message.
251     --
252     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
253     hr_utility.set_message_token('TABLE_NAME', 'per_applications');
254     hr_utility.raise_error;
255 End lck;
256 --
257 -- ----------------------------------------------------------------------------
258 -- |-----------------------------< convert_args >-----------------------------|
259 -- ----------------------------------------------------------------------------
260 Function convert_args
261 	(
262 	p_application_id                in number,
263 	p_business_group_id             in number,
264 	p_person_id                     in number,
265 	p_date_received                 in date,
266 	p_comments                      in varchar2,
267 	p_current_employer              in varchar2,
268 	p_date_end                      in date,
269 	p_projected_hire_date           in date,
270 	p_successful_flag               in varchar2,
271 	p_termination_reason            in varchar2,
272 	p_request_id                    in number,
273 	p_program_application_id        in number,
274 	p_program_id                    in number,
275 	p_program_update_date           in date,
276 	p_appl_attribute_category       in varchar2,
277 	p_appl_attribute1               in varchar2,
278 	p_appl_attribute2               in varchar2,
279 	p_appl_attribute3               in varchar2,
280 	p_appl_attribute4               in varchar2,
281 	p_appl_attribute5               in varchar2,
282 	p_appl_attribute6               in varchar2,
283 	p_appl_attribute7               in varchar2,
284 	p_appl_attribute8               in varchar2,
285 	p_appl_attribute9               in varchar2,
286 	p_appl_attribute10              in varchar2,
287 	p_appl_attribute11              in varchar2,
288 	p_appl_attribute12              in varchar2,
289 	p_appl_attribute13              in varchar2,
290 	p_appl_attribute14              in varchar2,
291 	p_appl_attribute15              in varchar2,
292 	p_appl_attribute16              in varchar2,
293 	p_appl_attribute17              in varchar2,
294 	p_appl_attribute18              in varchar2,
295 	p_appl_attribute19              in varchar2,
296 	p_appl_attribute20              in varchar2,
297 	p_object_version_number         in number
298 	)
299 	Return g_rec_type is
300 --
301   l_rec	  g_rec_type;
302   l_proc  varchar2(72) := g_package||'convert_args';
303 --
304 Begin
305   --
306   hr_utility.set_location('Entering:'||l_proc, 5);
307   --
308   -- Convert arguments into local l_rec structure.
309   --
310   l_rec.application_id                   := p_application_id;
311   l_rec.business_group_id                := p_business_group_id;
312   l_rec.person_id                        := p_person_id;
313   l_rec.date_received                    := p_date_received;
314   l_rec.comments                         := p_comments;
315   l_rec.current_employer                 := p_current_employer;
316   l_rec.date_end                         := p_date_end;
317   l_rec.projected_hire_date              := p_projected_hire_date;
318   l_rec.successful_flag                  := p_successful_flag;
319   l_rec.termination_reason               := p_termination_reason;
320   l_rec.request_id                       := p_request_id;
321   l_rec.program_application_id           := p_program_application_id;
322   l_rec.program_id                       := p_program_id;
323   l_rec.program_update_date              := p_program_update_date;
324   l_rec.appl_attribute_category          := p_appl_attribute_category;
325   l_rec.appl_attribute1                  := p_appl_attribute1;
326   l_rec.appl_attribute2                  := p_appl_attribute2;
327   l_rec.appl_attribute3                  := p_appl_attribute3;
328   l_rec.appl_attribute4                  := p_appl_attribute4;
329   l_rec.appl_attribute5                  := p_appl_attribute5;
330   l_rec.appl_attribute6                  := p_appl_attribute6;
331   l_rec.appl_attribute7                  := p_appl_attribute7;
332   l_rec.appl_attribute8                  := p_appl_attribute8;
333   l_rec.appl_attribute9                  := p_appl_attribute9;
334   l_rec.appl_attribute10                 := p_appl_attribute10;
335   l_rec.appl_attribute11                 := p_appl_attribute11;
336   l_rec.appl_attribute12                 := p_appl_attribute12;
337   l_rec.appl_attribute13                 := p_appl_attribute13;
338   l_rec.appl_attribute14                 := p_appl_attribute14;
339   l_rec.appl_attribute15                 := p_appl_attribute15;
340   l_rec.appl_attribute16                 := p_appl_attribute16;
341   l_rec.appl_attribute17                 := p_appl_attribute17;
342   l_rec.appl_attribute18                 := p_appl_attribute18;
343   l_rec.appl_attribute19                 := p_appl_attribute19;
344   l_rec.appl_attribute20                 := p_appl_attribute20;
345   l_rec.object_version_number            := p_object_version_number;
346   --
347   -- Return the plsql record structure.
348   --
349   hr_utility.set_location(' Leaving:'||l_proc, 10);
350   Return(l_rec);
351 --
352 End convert_args;
353 --
354 end per_apl_shd;