[Home] [Help]
PACKAGE BODY: APPS.HXC_TBB_SHD
Source
1 package body hxc_tbb_shd as
2 /* $Header: hxctbbrhi.pkb 120.6.12010000.1 2008/07/28 11:19:46 appldev ship $ */
3 --
4 -- --------------------------------------------------------------------------
5 -- | private global definitions |
6 -- --------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_tbb_shd.'; -- global package name
9
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- --------------------------------------------------------------------------
13 -- |---------------------------< constraint_error >-------------------------|
14 -- --------------------------------------------------------------------------
15 procedure constraint_error
16 (p_constraint_name in all_constraints.constraint_name%type
17 ) is
18 --
19 l_proc varchar2(72) := g_package||'constraint_error';
20 --
21 begin
22 --
23 if (p_constraint_name = 'HXC_TIME_BUILDING_BLOCKS_FK1') Then
24 fnd_message.set_name('HXC', 'HXC_NO_APPROVAL_STYLE');
25 fnd_message.set_token('procedure', l_proc);
26 fnd_message.set_token('STEP','5');
27 fnd_message.raise_error;
28 else
29 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
30 fnd_message.set_token('procedure', l_proc);
31 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
32 fnd_message.raise_error;
33 end if;
34 --
35 end constraint_error;
36 --
37 -- --------------------------------------------------------------------------
38 -- |-----------------------------< api_updating >---------------------------|
39 -- --------------------------------------------------------------------------
40 function api_updating
41 (p_time_building_block_id in number
42 ,p_object_version_number in number
43 )
44 return boolean is
45
46
47 -- cursor selects the 'current' row from the hr schema
48
49 cursor c_sel1 is
50 select
51 time_building_block_id
52 ,type
53 ,measure
54 ,unit_of_measure
55 ,start_time
56 ,stop_time
57 ,parent_building_block_id
58 ,parent_building_block_ovn
59 ,scope
60 ,object_version_number
61 ,approval_status
62 ,resource_id
63 ,resource_type
64 ,approval_style_id
65 ,date_from
66 ,date_to
67 ,comment_text
68 ,application_set_id
69 ,data_set_id
70 ,translation_display_key
71 from hxc_time_building_blocks
72 where time_building_block_id = p_time_building_block_id;
73
74 l_fct_ret boolean;
75
76 begin
77
78 if (p_time_building_block_id is null and
79 p_object_version_number is null
80 ) then
81
82 -- one of the primary key arguments is null therefore we must
83 -- set the returning function value to false
84
85 l_fct_ret := false;
86
87 else
88
89 if (p_time_building_block_id
90 = hxc_tbb_shd.g_old_rec.time_building_block_id and
91 p_object_version_number
92 = hxc_tbb_shd.g_old_rec.object_version_number
93 ) then
94
95 -- The g_old_rec is current therefore we must
96 -- set the returning function to true
97
98 l_fct_ret := true;
99
100 else
101
102 -- select the current row into g_old_rec
103
104 open c_sel1;
105 fetch c_sel1 into hxc_tbb_shd.g_old_rec;
106
107 if c_sel1%notfound then
108 close c_sel1;
109
110 -- the primary key is invalid therefore we must error
111
112 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
113 fnd_message.raise_error;
114
115 end if;
116
117 close c_sel1;
118
119 if (p_object_version_number
120 <> hxc_tbb_shd.g_old_rec.object_version_number) Then
121 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
122 fnd_message.raise_error;
123 end if;
124
125 l_fct_ret := true;
126
127 end if;
128
129 end if;
130
131 return (l_fct_ret);
132
133 end api_updating;
134
135 -- --------------------------------------------------------------------------
136 -- |---------------------------------< lck >--------------------------------|
137 -- --------------------------------------------------------------------------
138 procedure lck
139 (p_time_building_block_id in number
140 ,p_object_version_number in number
141 ) is
142
143 -- cursor selects the 'current' row from the hr schema
144
145 cursor c_sel1 is
146 select
147 time_building_block_id
148 ,type
149 ,measure
150 ,unit_of_measure
151 ,start_time
152 ,stop_time
153 ,parent_building_block_id
154 ,parent_building_block_ovn
155 ,scope
156 ,object_version_number
157 ,approval_status
158 ,resource_id
159 ,resource_type
160 ,approval_style_id
161 ,date_from
162 ,date_to
163 ,comment_text
164 ,application_set_id
165 ,data_set_id
166 ,translation_display_key
167 from hxc_time_building_blocks
168 where time_building_block_id = p_time_building_block_id
169 and object_version_number = (select max(object_version_number)
170 from hxc_time_building_blocks
171 where time_building_block_id = p_time_building_block_id)
172 for update nowait;
173
174 l_proc varchar2(72);
175
176 begin
177
178 g_debug := hr_utility.debug_enabled;
179
180 if g_debug then
181 l_proc := g_package||'lck';
182 hr_utility.set_location('Entering:'||l_proc, 5);
183 end if;
184
185 hr_api.mandatory_arg_error
186 (p_api_name => l_proc
187 ,p_argument => 'TIME_BUILDING_BLOCK_ID'
188 ,p_argument_value => p_time_building_block_id
189 );
190
191 open c_sel1;
192 fetch c_sel1 into hxc_tbb_shd.g_old_rec;
193
194 if c_sel1%notfound then
195 close c_sel1;
196
197 -- the primary key is invalid therefore we must error
198
199 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
200 fnd_message.raise_error;
201 end if;
202
203 close c_sel1;
204
205 if (p_object_version_number
206 <> hxc_tbb_shd.g_old_rec.object_version_number) then
207 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
208 fnd_message.raise_error;
209 end if;
210
211 if g_debug then
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 end if;
214
215 exception
216 when hr_api.object_locked then
217
218 -- the object is locked therefore we need to supply a meaningful
219 -- error message.
220
221 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
222 fnd_message.set_token('TABLE_NAME', 'hxc_time_building_blocks');
223 fnd_message.raise_error;
224
225 end lck;
226
227 -- --------------------------------------------------------------------------
228 -- |-----------------------------< convert_args >---------------------------|
229 -- --------------------------------------------------------------------------
230 function convert_args
231 (p_time_building_block_id in number
232 ,p_type in varchar2
233 ,p_measure in number
234 ,p_unit_of_measure in varchar2
235 ,p_start_time in date
236 ,p_stop_time in date
237 ,p_parent_building_block_id in number
238 ,p_parent_building_block_ovn in number
239 ,p_scope in varchar2
240 ,p_object_version_number in number
241 ,p_approval_status in varchar2
242 ,p_resource_id in number
243 ,p_resource_type in varchar2
244 ,p_approval_style_id in number
245 ,p_date_from in date
246 ,p_date_to in date
247 ,p_comment_text in varchar2
248 ,p_application_set_id in number
249 ,p_data_set_id in number
250 ,p_translation_display_key in varchar2
251 ) return g_rec_type is
252
253 l_rec g_rec_type;
254
255 begin
256
257 -- convert arguments into local l_rec structure.
258
259 l_rec.time_building_block_id := p_time_building_block_id;
260 l_rec.type := p_type;
261 l_rec.measure := p_measure;
262 l_rec.unit_of_measure := p_unit_of_measure;
263 l_rec.start_time := p_start_time;
264 l_rec.stop_time := p_stop_time;
265 l_rec.parent_building_block_id := p_parent_building_block_id;
266 l_rec.parent_building_block_ovn := p_parent_building_block_ovn;
267 l_rec.scope := p_scope;
268 l_rec.object_version_number := p_object_version_number;
269 l_rec.approval_status := p_approval_status;
270 l_rec.resource_id := p_resource_id;
271 l_rec.resource_type := p_resource_type;
272 l_rec.approval_style_id := p_approval_style_id;
273 l_rec.date_from := p_date_from;
274 l_rec.date_to := p_date_to;
275 l_rec.comment_text := p_comment_text;
276 l_rec.application_set_id := p_application_set_id;
277 l_rec.data_set_id := p_data_set_id;
278 l_rec.translation_display_key := p_translation_display_key;
279
280 -- return the plsql record structure.
281
282 return(l_rec);
283
284 end convert_args;
285
286 end hxc_tbb_shd;