DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TRN_SHD

Source


1 Package Body hr_trn_shd as
2 /* $Header: hrtrnrhi.pkb 120.2 2005/09/21 04:59:16 hpandya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_trn_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 = 'CHK_TRANSACTION_PRIVILEGE') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   ElsIf (p_constraint_name = 'HR_API_TRANSACTIONS_PK') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   Else
47     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50     hr_utility.raise_error;
51   End If;
52   --
53   hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (
61   p_transaction_id                     in number
62   )      Return Boolean Is
63 --
64   --
65   -- Cursor selects the 'current' row from the HR Schema
66   --
67   Cursor C_Sel1 is
68     select transaction_id,
69     creator_person_id,
70     transaction_privilege,
71     product_code,
72     url,
73     status,
74     transaction_state,  --ns
75     section_display_name,
76     function_id,
77     transaction_ref_table,
78     transaction_ref_id,
79     transaction_type,
80     assignment_id,
81     api_addtnl_info,
82     selected_person_id,
83     item_type,
84     item_key,
85     transaction_effective_date,
86     process_name,
87     plan_id ,
88     rptg_grp_id,
89     effective_date_option,
90     creator_role,
91     last_update_role,
92     parent_transaction_id,
93     relaunch_function,
94     transaction_group,
95     transaction_identifier,
96     transaction_document
97     from    hr_api_transactions
98     where   transaction_id = p_transaction_id;
99   --
100   -- plan_id, rptg_grp_id, effective_date_option added by sanej
101 --
102   l_proc    varchar2(72)    := g_package||'api_updating';
103   l_fct_ret boolean;
104 --
105 Begin
106   hr_utility.set_location('Entering:'||l_proc, 5);
107   --
108   If (
109     p_transaction_id is null
110      ) Then
111     --
112     -- One of the primary key arguments is null therefore we must
113     -- set the returning function value to false
114     --
115     l_fct_ret := false;
116   Else
117     If (
118     p_transaction_id = g_old_rec.transaction_id
119        ) Then
120       hr_utility.set_location(l_proc, 10);
121       --
122       -- The g_old_rec is current therefore we must
123       -- set the returning function to true
124       --
125       l_fct_ret := true;
126     Else
127       --
128       -- Select the current row into g_old_rec
129       --
130       Open C_Sel1;
131       Fetch C_Sel1 Into g_old_rec;
132       If C_Sel1%notfound Then
133         Close C_Sel1;
134         --
135         -- The primary key is invalid therefore we must error
136         --
137         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
138         hr_utility.raise_error;
139       End If;
140       Close C_Sel1;
141       --
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_transaction_id                     in number
157   ) is
158 --
159 -- Cursor selects the 'current' row from the HR Schema
160 --
161   Cursor C_Sel1 is
162     select  transaction_id,
163     creator_person_id,
164     transaction_privilege,
165     product_code,
166     url,
167     status,
168     transaction_state, --ns
169     section_display_name,
170     function_id,
171     transaction_ref_table,
172     transaction_ref_id,
173     transaction_type,
174     assignment_id,
175     api_addtnl_info,
176     selected_person_id,
177     item_type,
178     item_key,
179     transaction_effective_date,
180     process_name,
181     plan_id ,
182     rptg_grp_id,
183     effective_date_option,
184     creator_role,
185     last_update_role,
186     parent_transaction_id,
187     relaunch_function,
188     transaction_group,
189     transaction_identifier,
190     transaction_document
191     from    hr_api_transactions
192     where   transaction_id = p_transaction_id
193     for update nowait;
194   --
195   -- plan_id, rptg_grp_id, effective_date_option added by sanej
196 --
197   l_proc    varchar2(72) := g_package||'lck';
198 --
199 Begin
200   hr_utility.set_location('Entering:'||l_proc, 5);
201   --
202   -- Add any mandatory argument checking here:
203   -- Example:
204   -- hr_api.mandatory_arg_error
205   --   (p_api_name       => l_proc,
206   --    p_argument       => 'object_version_number',
207   --    p_argument_value => p_object_version_number);
208   --
209   Open  C_Sel1;
210   Fetch C_Sel1 Into g_old_rec;
211   If C_Sel1%notfound then
212     Close C_Sel1;
213     --
214     -- The primary key is invalid therefore we must error
215     --
216     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
217     hr_utility.raise_error;
218   End If;
219   Close C_Sel1;
220   --
221 --
222   hr_utility.set_location(' Leaving:'||l_proc, 10);
223 --
224 -- We need to trap the ORA LOCK exception
225 --
226 Exception
227   When HR_Api.Object_Locked then
228     --
229     -- The object is locked therefore we need to supply a meaningful
230     -- error message.
231     --
232     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
233     hr_utility.set_message_token('TABLE_NAME', 'hr_api_transactions');
234     hr_utility.raise_error;
235 End lck;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |-----------------------------< convert_args >-----------------------------|
239 -- ----------------------------------------------------------------------------
240 Function convert_args
241     (
242     p_transaction_id                in number,
243     p_creator_person_id             in number,
244     p_transaction_privilege         in varchar2
245     )
246     Return g_rec_type is
247 --
248   l_rec   g_rec_type;
249   l_proc  varchar2(72) := g_package||'convert_args';
250 --
251 Begin
252   --
253   hr_utility.set_location('Entering:'||l_proc, 5);
254   --
255   -- Convert arguments into local l_rec structure.
256   --
257 
258    hr_utility.trace(' Start convert_args ');
259 
260   l_rec.transaction_id                   := p_transaction_id;
261   l_rec.creator_person_id                := p_creator_person_id;
262   l_rec.transaction_privilege            := p_transaction_privilege;
263   --
264   -- Return the plsql record structure.
265   --
266 
267     hr_utility.trace(' End convert_args ');
268 
269   hr_utility.set_location(' Leaving:'||l_proc, 10);
270   Return(l_rec);
271 --
272 End convert_args;
273 --
274 Function convert_args
275     (
276     p_transaction_id                in number,
277     p_creator_person_id             in number,
278     p_transaction_privilege         in varchar2,
279     p_product_code                    in varchar2,
280     p_url                           in varchar2,
281     p_status                        in varchar2,
282     p_transaction_state             in varchar2, --ns
283     p_section_display_name           in varchar2,
284     p_function_id                   in number,
285     p_transaction_ref_table         in varchar2,
286     p_transaction_ref_id            in number,
287     p_transaction_type              in varchar2,
288     p_assignment_id                 in number,
289     p_api_addtnl_info               in varchar2,
290     p_selected_person_id            in number,
291     p_item_type                     in varchar2,
292     p_item_key                      in varchar2,
293     p_transaction_effective_date    in date,
294     p_process_name                  in varchar2,
295     p_plan_id                      in number,
296     p_rptg_grp_id                  in number,
297     p_effective_date_option        in varchar2,
298     p_creator_role                 in varchar2,
299     p_last_update_role             in varchar2,
300     p_parent_transaction_id        in number,
301     p_relaunch_function            in varchar2,
302     p_transaction_group            in varchar2,
303     p_transaction_identifier       in varchar2,
304     p_transaction_document         in clob
305 
306     )
307     Return g_rec_type is
308 --
309 -- p_plan_id, p_rptg_grp_id, p_effective_date_option added by sanej
310 --
311   l_rec   g_rec_type;
312   l_proc  varchar2(72) := g_package||'convert_args';
313 --
314 Begin
315   --
316   hr_utility.set_location('Entering:'||l_proc, 5);
317   --
318   -- Convert arguments into local l_rec structure.
319   --
320 
321   l_rec.transaction_id                   := p_transaction_id;
322   l_rec.creator_person_id                := p_creator_person_id;
323   l_rec.transaction_privilege            := p_transaction_privilege;
324   l_rec.product_code                     := p_product_code;
325   l_rec.url                              := p_url;
326   l_rec.status                           := p_status;
327   l_rec.transaction_state                := p_transaction_state;  --ns
328   l_rec.section_display_name             := p_section_display_name;
329   l_rec.function_id                      := p_function_id;
330   l_rec.transaction_ref_table            := p_transaction_ref_table;
331   l_rec.transaction_ref_id               := p_transaction_ref_id;
332   l_rec.transaction_type                 := p_transaction_type;
333   l_rec.assignment_id                    := p_assignment_id;
334   l_rec.api_addtnl_info                  := p_api_addtnl_info;
335   l_rec.selected_person_id               := p_selected_person_id;
336   l_rec.item_type                        := p_item_type;
337   l_rec.Item_key                         := p_item_key;
338   l_rec.transaction_effective_date       := p_transaction_effective_date;
339   l_rec.process_name                     := p_process_name;
340   l_rec.plan_id                          := p_plan_id ;
341   l_rec.rptg_grp_id                      := p_rptg_grp_id ;
342   l_rec.effective_date_option            := p_effective_date_option ;
343   l_rec.creator_role                     := p_creator_role;
344   l_rec.last_update_role                 := p_last_update_role;
345   l_rec.parent_transaction_id            := p_parent_transaction_id;
346   l_rec.relaunch_function                := p_relaunch_function;
347   l_rec.transaction_group                := p_transaction_group;
348   l_rec.transaction_identifier           := p_transaction_identifier;
349   l_rec.transaction_document             := p_transaction_document;
350   --
351   -- plan_id, rptg_grp_id, effective_date_option added by sanej
352 
353   --
354   -- Return the plsql record structure.
355   --
356   hr_utility.set_location(' Leaving:'||l_proc, 10);
357   Return(l_rec);
358 --
359 End convert_args;
360 
361 end hr_trn_shd;