DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PAR_SHD

Source


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