DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_AST_SHD

Source


1 Package Body per_ast_shd as
2 /* $Header: peastrhi.pkb 120.7.12010000.2 2008/10/20 14:11:39 kgowripe ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_ast_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc,5);
20   --
21   If (p_constraint_name = 'PER_ASS_TYPES_RATE_NULL_CHK') Then
22     hr_utility.set_message(801, 'HR_51508_AST_R_ASSCLASS_ERR2');
23     hr_utility.raise_error;
24   ElsIf (p_constraint_name = 'PER_ASSESSMENT_TYPES_FK2') Then
25     hr_utility.set_message(801, 'HR_51507_AST_RATE_ID_INVAL');
26     hr_utility.raise_error;
27   ElsIf (p_constraint_name = 'PER_ASS_TYPES_RATE_NOTNULL_CHK') Then
28     hr_utility.set_message(801, 'HR_51506_AST_R_ASSCLAS_ERR');
29     hr_utility.raise_error;
30   ElsIf (p_constraint_name = 'PER_ASSESSMENT_TYPES_FK3') Then
31     hr_utility.set_message(801, 'HR_51504_AST_WEIGHT_ID_INVAL');
32     hr_utility.raise_error;
33   ElsIf (p_constraint_name = 'PER_ASSESSMENT_TYPES_NAME_UK1') Then
34     hr_utility.set_message(801, 'HR_51499_AST_NAME_NOT_UNIQ');
35      hr_utility.raise_error;
36   ElsIf (p_constraint_name = 'PER_ASSESSMENT_TYPE_PK') Then
37     -- The primary key is generated via a sequence, so it should never
38     -- be invalid
39     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
40     hr_utility.raise_error;
41   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK2') Then
42     hr_utility.set_message(800, 'HR_52605_AST_APT_EXISTS');
43     hr_utility.raise_error;
44   Else
45     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
46     hr_utility.set_message_token('PROCEDURE', l_proc);
47     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
48     hr_utility.raise_error;
49   End If;
50   --
51   hr_utility.set_location(' Leaving:'||l_proc, 10);
52 End constraint_error;
53 --
54 -- ----------------------------------------------------------------------------
55 -- |-----------------------------< api_updating >-----------------------------|
56 -- ----------------------------------------------------------------------------
57 Function api_updating
58   (
59   p_assessment_type_id                 in number,
60   p_object_version_number              in number
61   )      Return Boolean Is
62 --
63   --
64   -- Cursor selects the 'current' row from the HR Schema
65   --
66   Cursor C_Sel1 is
67     select assessment_type_id,
68 	name,
69 	business_group_id,
70 	description,
71 	rating_scale_id,
72 	weighting_scale_id,
73 	rating_scale_comment,
74 	weighting_scale_comment,
75 	assessment_classification,
76 	display_assessment_comments,
77 	date_from,
78 	date_to,
79 	comments,
80 	instructions,
81 	weighting_classification,
82         line_score_formula,
83         total_score_formula,
84 	object_version_number,
85 	attribute_category,
86 	attribute1,
87 	attribute2,
88 	attribute3,
89         attribute4,
90 	attribute5,
91 	attribute6,
92 	attribute7,
93 	attribute8,
94 	attribute9,
95 	attribute10,
96 	attribute11,
97 	attribute12,
98 	attribute13,
99 	attribute14,
100 	attribute15,
101 	attribute16,
102 	attribute17,
103 	attribute18,
104 	attribute19,
105 	attribute20,
106     type,
107     line_score_formula_id,
108     default_job_competencies,
109     available_flag
110     from	per_assessment_types
111     where	assessment_type_id = p_assessment_type_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_assessment_type_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_assessment_type_id = g_old_rec.assessment_type_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 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171   (
172   p_assessment_type_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  	assessment_type_id,
181 	name,
182 	business_group_id,
183 	description,
184 	rating_scale_id,
185 	weighting_scale_id,
186 	rating_scale_comment,
187 	weighting_scale_comment,
188 	assessment_classification,
189 	display_assessment_comments,
190 	date_from,
191 	date_to,
192 	comments,
193 	instructions,
194         weighting_classification,
195         line_score_formula,
196         total_score_formula,
197 	object_version_number,
198 	attribute_category,
199 	attribute1,
200 	attribute2,
201 	attribute3,
202 	attribute4,
203 	attribute5,
204 	attribute6,
205 	attribute7,
206 	attribute8,
207 	attribute9,
208 	attribute10,
209 	attribute11,
210 	attribute12,
211 	attribute13,
212 	attribute14,
213 	attribute15,
214 	attribute16,
215 	attribute17,
216 	attribute18,
217 	attribute19,
218 	attribute20,
219     type,
220     line_score_formula_id,
221     default_job_competencies,
222     available_flag
223     from	per_assessment_types
224     where	assessment_type_id = p_assessment_type_id
225     for	update nowait;
226 --
227   l_proc	varchar2(72) := g_package||'lck';
228 --
229 Begin
230   hr_utility.set_location('Entering:'||l_proc, 5);
231   --
232   -- Add any mandatory argument checking here:
233   -- Example:
234   -- hr_api.mandatory_arg_error
235   --   (p_api_name       => l_proc,
236   --    p_argument       => 'object_version_number',
237   --    p_argument_value => p_object_version_number);
238   --
239   Open  C_Sel1;
240   Fetch C_Sel1 Into g_old_rec;
241   If C_Sel1%notfound then
242     Close C_Sel1;
243     --
244     -- The primary key is invalid therefore we must error
245     --
246     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
247     hr_utility.raise_error;
248   End If;
249   Close C_Sel1;
250   If (p_object_version_number <> g_old_rec.object_version_number) Then
251         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
252         hr_utility.raise_error;
253       End If;
254 --
255   hr_utility.set_location(' Leaving:'||l_proc, 10);
256 --
257 -- We need to trap the ORA LOCK exception
258 --
259 Exception
260   When HR_Api.Object_Locked then
261     --
262     -- The object is locked therefore we need to supply a meaningful
263     -- error message.
264     --
265     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
266     hr_utility.set_message_token('TABLE_NAME', 'per_assessment_types');
267     hr_utility.raise_error;
268 End lck;
269 --
270 -- ----------------------------------------------------------------------------
271 -- |-----------------------------< convert_args >-----------------------------|
272 -- ----------------------------------------------------------------------------
273 Function convert_args
274 	(
275 	p_assessment_type_id            in number,
276 	p_name                          in varchar2,
277 	p_business_group_id             in number,
278 	p_description                   in varchar2,
279 	p_rating_scale_id               in number,
280 	p_weighting_scale_id            in number,
281 	p_rating_scale_comment          in varchar2,
282 	p_weighting_scale_comment       in varchar2,
283 	p_assessment_classification     in varchar2,
284 	p_display_assessment_comments   in varchar2,
285 	p_date_from			in date,
286 	p_date_to			in date,
287 	p_comments                      in varchar2,
288 	p_instructions                  in varchar2,
289         p_weighting_classification      in varchar2,
290         p_line_score_formula            in varchar2,
291         p_total_score_formula           in varchar2,
292 	p_object_version_number         in number,
293 	p_attribute_category            in varchar2,
294 	p_attribute1                    in varchar2,
295 	p_attribute2                    in varchar2,
296 	p_attribute3                    in varchar2,
297 	p_attribute4                    in varchar2,
298 	p_attribute5                    in varchar2,
299 	p_attribute6                    in varchar2,
300 	p_attribute7                    in varchar2,
301 	p_attribute8                    in varchar2,
302 	p_attribute9                    in varchar2,
303 	p_attribute10                   in varchar2,
304 	p_attribute11                   in varchar2,
305 	p_attribute12                   in varchar2,
306 	p_attribute13                   in varchar2,
307 	p_attribute14                   in varchar2,
308 	p_attribute15                   in varchar2,
309 	p_attribute16                   in varchar2,
310 	p_attribute17                   in varchar2,
311 	p_attribute18                   in varchar2,
312 	p_attribute19                   in varchar2,
313 	p_attribute20                   in varchar2,
314 	p_type                          in varchar2,
315 	p_line_score_formula_id         in number,
316 	p_default_job_competencies      in varchar2,
317 	p_available_flag                in varchar2
318 	)
319 	Return g_rec_type is
320 --
321   l_rec	  g_rec_type;
322   l_proc  varchar2(72) := g_package||'convert_args';
323 --
324 Begin
325   --
326   hr_utility.set_location('Entering:'||l_proc, 5);
327   --
328   -- Convert arguments into local l_rec structure.
329   --
330   l_rec.assessment_type_id               := p_assessment_type_id;
331   l_rec.name                             := p_name;
332   l_rec.business_group_id                := p_business_group_id;
333   l_rec.description                      := p_description;
334   l_rec.rating_scale_id                  := p_rating_scale_id;
335   l_rec.weighting_scale_id               := p_weighting_scale_id;
336   l_rec.rating_scale_comment             := p_rating_scale_comment;
337   l_rec.weighting_scale_comment          := p_weighting_scale_comment;
338   l_rec.assessment_classification        := p_assessment_classification;
339   l_rec.display_assessment_comments      := p_display_assessment_comments;
340   l_rec.date_from			 := p_date_from;
341   l_rec.date_to				 := p_date_to;
342   l_rec.comments                         := p_comments;
343   l_rec.instructions                     := p_instructions;
344   l_rec.weighting_classification         := p_weighting_classification;
345   l_rec.line_score_formula               := p_line_score_formula;
346   l_rec.total_score_formula		 := p_total_score_formula;
347   l_rec.object_version_number            := p_object_version_number;
348   l_rec.attribute_category               := p_attribute_category;
349   l_rec.attribute1                       := p_attribute1;
350   l_rec.attribute2                       := p_attribute2;
351   l_rec.attribute3                       := p_attribute3;
352   l_rec.attribute4                       := p_attribute4;
353   l_rec.attribute5                       := p_attribute5;
354   l_rec.attribute6                       := p_attribute6;
355   l_rec.attribute7                       := p_attribute7;
356   l_rec.attribute8                       := p_attribute8;
357   l_rec.attribute9                       := p_attribute9;
358   l_rec.attribute10                      := p_attribute10;
359   l_rec.attribute11                      := p_attribute11;
360   l_rec.attribute12                      := p_attribute12;
361   l_rec.attribute13                      := p_attribute13;
362   l_rec.attribute14                      := p_attribute14;
363   l_rec.attribute15                      := p_attribute15;
364   l_rec.attribute16                      := p_attribute16;
365   l_rec.attribute17                      := p_attribute17;
366   l_rec.attribute18                      := p_attribute18;
367   l_rec.attribute19                      := p_attribute19;
368   l_rec.attribute20                      := p_attribute20;
369   l_rec.type                             := p_type;
370   l_rec.line_score_formula_id            := p_line_score_formula_id;
371   l_rec.default_job_competencies         := p_default_job_competencies;
372   l_rec.available_flag                   := p_available_flag;
373 
374   --
375   -- Return the plsql record structure.
376   --
377   hr_utility.set_location(' Leaving:'||l_proc, 10);
378   Return(l_rec);
379 --
380 End convert_args;
381 --
382 end per_ast_shd;