[Home] [Help]
PACKAGE BODY: APPS.HR_EXU_SHD
Source
1 Package Body hr_exu_shd as
2 /* $Header: hrexurhi.pkb 115.1 99/07/17 05:35:46 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_exu_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_EXU_CAL_CAU_ARC') Then
37 -- *** NEW_MESSAGE_REQUIRED ***
38 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
39 hr_utility.set_message_token('PROCEDURE', l_proc);
40 hr_utility.set_message_token('STEP','5');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'HR_EXU_CAL_FK') Then
43 -- *** NEW_MESSAGE_REQUIRED ***
44 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
45 hr_utility.set_message_token('PROCEDURE', l_proc);
46 hr_utility.set_message_token('STEP','10');
47 hr_utility.raise_error;
48 ElsIf (p_constraint_name = 'HR_EXU_CAU_FK') Then
49 -- *** NEW_MESSAGE_REQUIRED ***
50 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
51 hr_utility.set_message_token('PROCEDURE', l_proc);
52 hr_utility.set_message_token('STEP','15');
53 hr_utility.raise_error;
54 ElsIf (p_constraint_name = 'HR_EXU_PAE_FK') Then
55 -- *** NEW_MESSAGE_REQUIRED ***
56 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
57 hr_utility.set_message_token('PROCEDURE', l_proc);
58 hr_utility.set_message_token('STEP','20');
59 hr_utility.raise_error;
60 ElsIf (p_constraint_name = 'HR_EXU_PK') Then
61 -- *** NEW_MESSAGE_REQUIRED ***
62 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
63 hr_utility.set_message_token('PROCEDURE', l_proc);
64 hr_utility.set_message_token('STEP','25');
65 hr_utility.raise_error;
66 ElsIf (p_constraint_name = 'HR_EXU_UK01') Then
67 -- *** NEW_MESSAGE_REQUIRED ***
68 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
69 hr_utility.set_message_token('PROCEDURE', l_proc);
70 hr_utility.set_message_token('STEP','30');
71 hr_utility.raise_error;
72 ElsIf (p_constraint_name = 'HR_EXU_UK02') Then
73 -- *** NEW_MESSAGE_REQUIRED ***
74 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
75 hr_utility.set_message_token('PROCEDURE', l_proc);
76 hr_utility.set_message_token('STEP','35');
77 hr_utility.raise_error;
78 Else
79 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
80 fnd_message.set_token('PROCEDURE',l_proc);
81 fnd_message.set_token('CONSTRAINT_NAME',p_constraint_name);
82 fnd_message.raise_error;
83 End If;
84 --
85 hr_utility.set_location(' Leaving:'||l_proc, 10);
86 End constraint_error;
87 --
88 -- ----------------------------------------------------------------------------
89 -- |-----------------------------< api_updating >-----------------------------|
90 -- ----------------------------------------------------------------------------
91 Function api_updating
92 (
93 p_exception_usage_id in number,
94 p_object_version_number in number
95 ) Return Boolean Is
96 --
97 --
98 -- Cursor selects the 'current' row from the HR Schema
99 --
100 Cursor C_Sel1 is
101 select
102 exception_usage_id,
103 exception_reason,
104 calendar_id,
105 calendar_usage_id,
106 object_version_number,
107 exception_id
108 from hr_exception_usages
109 where exception_usage_id = p_exception_usage_id;
110 --
111 l_proc varchar2(72) := g_package||'api_updating';
112 l_fct_ret boolean;
113 --
114 Begin
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 If (
118 p_exception_usage_id is null and
119 p_object_version_number is null
120 ) Then
121 --
122 -- One of the primary key arguments is null therefore we must
123 -- set the returning function value to false
124 --
125 l_fct_ret := false;
126 Else
127 If (
128 p_exception_usage_id = g_old_rec.exception_usage_id and
129 p_object_version_number = g_old_rec.object_version_number
130 ) Then
131 hr_utility.set_location(l_proc, 10);
132 --
133 -- The g_old_rec is current therefore we must
134 -- set the returning function to true
135 --
136 l_fct_ret := true;
137 Else
138 --
139 -- Select the current row into g_old_rec
140 --
141 Open C_Sel1;
142 Fetch C_Sel1 Into g_old_rec;
143 If C_Sel1%notfound Then
144 Close C_Sel1;
145 --
146 -- The primary key is invalid therefore we must error
147 --
148 -- *** NEW_MESSAGE_REQUIRED ***
149 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
150 hr_utility.raise_error;
151 End If;
152 Close C_Sel1;
153 If (p_object_version_number <> g_old_rec.object_version_number) Then
154 -- *** NEW_MESSAGE_REQUIRED ***
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_exception_usage_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 exception_usage_id,
180 exception_reason,
181 calendar_id,
182 calendar_usage_id,
183 object_version_number,
184 exception_id
185 from hr_exception_usages
186 where exception_usage_id = p_exception_usage_id
187 for update nowait;
188 --
189 l_proc varchar2(72) := g_package||'lck';
190 --
191 Begin
192 hr_utility.set_location('Entering:'||l_proc, 5);
193 --
194 -- Add any mandatory argument checking here:
195 -- Example:
196 -- hr_api.mandatory_arg_error
197 -- (p_api_name => l_proc,
198 -- p_argument => 'object_version_number',
199 -- p_argument_value => p_object_version_number);
200 --
201 Open C_Sel1;
202 Fetch C_Sel1 Into g_old_rec;
203 If C_Sel1%notfound then
204 Close C_Sel1;
205 --
206 -- The primary key is invalid therefore we must error
207 --
208 -- *** NEW_MESSAGE_REQUIRED ***
209 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
210 hr_utility.raise_error;
211 End If;
212 Close C_Sel1;
213 If (p_object_version_number <> g_old_rec.object_version_number) Then
214 -- *** NEW_MESSAGE_REQUIRED ***
215 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
216 hr_utility.raise_error;
217 End If;
218 --
219 hr_utility.set_location(' Leaving:'||l_proc, 10);
220 --
221 -- We need to trap the ORA LOCK exception
222 --
223 Exception
224 When HR_Api.Object_Locked then
225 --
226 -- The object is locked therefore we need to supply a meaningful
227 -- error message.
228 --
229 -- *** NEW_MESSAGE_REQUIRED ***
230 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
231 hr_utility.set_message_token('TABLE_NAME', 'hr_exception_usages');
232 hr_utility.raise_error;
233 End lck;
234 --
235 -- ----------------------------------------------------------------------------
236 -- |-----------------------------< convert_args >-----------------------------|
237 -- ----------------------------------------------------------------------------
238 Function convert_args
239 (
240 p_exception_usage_id in number,
241 p_exception_reason in varchar2,
242 p_calendar_id in number,
243 p_calendar_usage_id in number,
244 p_object_version_number in number,
245 p_exception_id in number
246 )
247 Return g_rec_type is
248 --
249 l_rec g_rec_type;
250 l_proc varchar2(72) := g_package||'convert_args';
251 --
252 Begin
253 --
254 hr_utility.set_location('Entering:'||l_proc, 5);
255 --
256 -- Convert arguments into local l_rec structure.
257 --
258 l_rec.exception_usage_id := p_exception_usage_id;
259 l_rec.exception_reason := p_exception_reason;
260 l_rec.calendar_id := p_calendar_id;
261 l_rec.calendar_usage_id := p_calendar_usage_id;
262 l_rec.object_version_number := p_object_version_number;
263 l_rec.exception_id := p_exception_id;
264 --
265 -- Return the plsql record structure.
266 --
267 hr_utility.set_location(' Leaving:'||l_proc, 10);
268 Return(l_rec);
269 --
270 End convert_args;
271 --
272 end hr_exu_shd;