[Home] [Help]
PACKAGE BODY: APPS.HR_CAU_SHD
Source
1 Package Body hr_cau_shd as
2 /* $Header: hrcaurhi.pkb 120.0 2005/05/29 02:29:58 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_cau_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_CAU_CAL_FK') Then
37 --
38 hr_utility.set_message(801, 'HR_51068_CAU_CAL_FK');
39 --
40 ElsIf (p_constraint_name = 'HR_CAU_PPU_FK') Then
41 --
42 hr_utility.set_message(801, 'HR_51069_CAU_PPU_FK');
43 --
44 ElsIf (p_constraint_name = 'HR_CAU_START_END') Then
45 --
46 hr_utility.set_message(801, 'HR_51070_CAU_START_END');
47 --
48 Else
49 --
50 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
51 hr_utility.set_message_token('PROCEDURE', l_proc);
52 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
53 hr_utility.raise_error;
54 --
55 End If;
56 --
57 hr_utility.raise_error;
58 --
59 hr_utility.set_location(' Leaving:'||l_proc, 10);
60 End constraint_error;
61 --
62 -- ----------------------------------------------------------------------------
63 -- |-----------------------------< api_updating >-----------------------------|
64 -- ----------------------------------------------------------------------------
65 Function api_updating
66 (
67 p_calendar_usage_id in number,
68 p_object_version_number in number
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 calendar_id,
77 calendar_usage_id,
78 primary_key_value,
79 purpose_usage_id,
80 start_date,
81 end_date,
82 object_version_number
83 from hr_calendar_usages
84 where calendar_usage_id = p_calendar_usage_id;
85 --
86 l_proc varchar2(72) := g_package||'api_updating';
87 l_fct_ret boolean;
88 --
89 Begin
90 hr_utility.set_location('Entering:'||l_proc, 5);
91 --
92 If (
93 p_calendar_usage_id is null and
94 p_object_version_number is null
95 ) Then
96 --
97 -- One of the primary key arguments is null therefore we must
98 -- set the returning function value to false
99 --
100 l_fct_ret := false;
101 Else
102 If (
103 p_calendar_usage_id = g_old_rec.calendar_usage_id and
104 p_object_version_number = g_old_rec.object_version_number
105 ) Then
106 hr_utility.set_location(l_proc, 10);
107 --
108 -- The g_old_rec is current therefore we must
109 -- set the returning function to true
110 --
111 l_fct_ret := true;
112 Else
113 --
114 -- Select the current row into g_old_rec
115 --
116 Open C_Sel1;
117 Fetch C_Sel1 Into g_old_rec;
118 If C_Sel1%notfound Then
119 Close C_Sel1;
120 --
121 -- The primary key is invalid therefore we must error
122 --
123 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
124 hr_utility.raise_error;
125 End If;
126 Close C_Sel1;
127 If (p_object_version_number <> g_old_rec.object_version_number) Then
128 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
129 hr_utility.raise_error;
130 End If;
131 hr_utility.set_location(l_proc, 15);
132 l_fct_ret := true;
133 End If;
134 End If;
135 hr_utility.set_location(' Leaving:'||l_proc, 20);
136 Return (l_fct_ret);
137 --
138 End api_updating;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |---------------------------------< lck >----------------------------------|
142 -- ----------------------------------------------------------------------------
143 Procedure lck
144 (
145 p_calendar_usage_id in number,
146 p_object_version_number in number
147 ) is
148 --
149 -- Cursor selects the 'current' row from the HR Schema
150 --
151 Cursor C_Sel1 is
152 select calendar_id,
153 calendar_usage_id,
154 primary_key_value,
155 purpose_usage_id,
156 start_date,
157 end_date,
158 object_version_number
159 from hr_calendar_usages
160 where calendar_usage_id = p_calendar_usage_id
161 for update nowait;
162 --
163 l_proc varchar2(72) := g_package||'lck';
164 --
165 Begin
166 hr_utility.set_location('Entering:'||l_proc, 5);
167 --
168 -- Add any mandatory argument checking here:
169 -- Example:
170 -- hr_api.mandatory_arg_error
171 -- (p_api_name => l_proc,
172 -- p_argument => 'object_version_number',
173 -- p_argument_value => p_object_version_number);
174 --
175 Open C_Sel1;
176 Fetch C_Sel1 Into g_old_rec;
177 If C_Sel1%notfound then
178 Close C_Sel1;
179 --
180 -- The primary key is invalid therefore we must error
181 --
182 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
183 hr_utility.raise_error;
184 End If;
185 Close C_Sel1;
186 If (p_object_version_number <> g_old_rec.object_version_number) Then
187 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
188 hr_utility.raise_error;
189 End If;
190 --
191 hr_utility.set_location(' Leaving:'||l_proc, 10);
192 --
193 -- We need to trap the ORA LOCK exception
194 --
195 Exception
196 When HR_Api.Object_Locked then
197 --
198 -- The object is locked therefore we need to supply a meaningful
199 -- error message.
200 --
201 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
202 hr_utility.set_message_token('TABLE_NAME', 'hr_calendar_usages');
203 hr_utility.raise_error;
204 End lck;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |-----------------------------< convert_args >-----------------------------|
208 -- ----------------------------------------------------------------------------
209 Function convert_args
210 (
211 p_calendar_id in number,
212 p_calendar_usage_id in number,
213 p_primary_key_value in number,
214 p_purpose_usage_id in number,
215 p_start_date in date,
216 p_end_date in date,
217 p_object_version_number in number
218 )
219 Return g_rec_type is
220 --
221 l_rec g_rec_type;
222 l_proc varchar2(72) := g_package||'convert_args';
223 --
224 Begin
225 --
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 -- Convert arguments into local l_rec structure.
229 --
230 l_rec.calendar_id := p_calendar_id;
231 l_rec.calendar_usage_id := p_calendar_usage_id;
232 l_rec.primary_key_value := p_primary_key_value;
233 l_rec.purpose_usage_id := p_purpose_usage_id;
234 l_rec.start_date := p_start_date;
235 l_rec.end_date := p_end_date;
236 l_rec.object_version_number := p_object_version_number;
237 --
238 -- Return the plsql record structure.
239 --
240 hr_utility.set_location(' Leaving:'||l_proc, 10);
241 Return(l_rec);
242 --
243 End convert_args;
244 --
245 end hr_cau_shd;