DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HTR_SHD

Source


1 Package Body hxc_htr_shd as
2 /* $Header: hxchtrrhi.pkb 120.2 2005/09/23 07:45:11 nissharm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_htr_shd.';  -- Global package name
9 
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------< return_api_dml_status >-------------------------|
14 -- ----------------------------------------------------------------------------
15 Function return_api_dml_status Return Boolean Is
16 --
17 Begin
18   --
19   Return (nvl(g_api_dml, false));
20   --
21 End return_api_dml_status;
22 --
23 -- ----------------------------------------------------------------------------
24 -- |---------------------------< constraint_error >---------------------------|
25 -- ----------------------------------------------------------------------------
26 Procedure constraint_error
27   (p_constraint_name in all_constraints.constraint_name%TYPE
28   ) Is
29 --
30   l_proc 	varchar2(72) := g_package||'constraint_error';
31 --
32 Begin
33   --
34   If (p_constraint_name = 'HXC_TIME_APPLICATIONS_PK') Then
35     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
36     fnd_message.set_token('PROCEDURE', l_proc);
37     fnd_message.set_token('STEP','5');
38     fnd_message.raise_error;
39   Else
40     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
41     fnd_message.set_token('PROCEDURE', l_proc);
42     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
43     fnd_message.raise_error;
44   End If;
45   --
46 End constraint_error;
47 --
48 -- ----------------------------------------------------------------------------
49 -- |-----------------------------< api_updating >-----------------------------|
50 -- ----------------------------------------------------------------------------
51 Function api_updating
52   (p_time_recipient_id                    in     number
53   ,p_object_version_number                in     number
54   )
55   Return Boolean Is
56 --
57   --
58   -- Cursor selects the 'current' row from the HR Schema
59   --
60   Cursor C_Sel1 is
61     select
62        time_recipient_id
63       ,name
64       ,application_id
65       ,object_version_number
66       ,application_retrieval_function
67       ,application_update_process
68       ,appl_validation_process
69       ,application_period_function
70       ,appl_dynamic_template_process
71       ,extension_function1
72       ,extension_function2
73     from	hxc_time_recipients
74     where	time_recipient_id = p_time_recipient_id;
75 --
76   l_fct_ret	boolean;
77 --
78 Begin
79   --
80   If (p_time_recipient_id is null and
81       p_object_version_number is null
82      ) Then
83     --
84     -- One of the primary key arguments is null therefore we must
85     -- set the returning function value to false
86     --
87     l_fct_ret := false;
88   Else
89     If (p_time_recipient_id
90         = hxc_htr_shd.g_old_rec.time_recipient_id and
91         p_object_version_number
92         = hxc_htr_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     Else
100       --
101       -- Select the current row into g_old_rec
102       --
103       Open C_Sel1;
104       Fetch C_Sel1 Into hxc_htr_shd.g_old_rec;
105       If C_Sel1%notfound Then
106         Close C_Sel1;
107         --
108         -- The primary key is invalid therefore we must error
109         --
110         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
111         fnd_message.raise_error;
112       End If;
113       Close C_Sel1;
114       If (p_object_version_number
115           <> hxc_htr_shd.g_old_rec.object_version_number) Then
116         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
117         fnd_message.raise_error;
118       End If;
119       l_fct_ret := true;
120     End If;
121   End If;
122   Return (l_fct_ret);
123 --
124 End api_updating;
125 --
126 -- ----------------------------------------------------------------------------
127 -- |---------------------------------< lck >----------------------------------|
128 -- ----------------------------------------------------------------------------
129 Procedure lck
130   (p_time_recipient_id                    in     number
131   ,p_object_version_number                in     number
132   ) is
133 --
134 -- Cursor selects the 'current' row from the HR Schema
135 --
136   Cursor C_Sel1 is
137     select
138        time_recipient_id
139       ,name
140       ,application_id
141       ,object_version_number
142       ,application_retrieval_function
143       ,application_update_process
144       ,appl_validation_process
145       ,application_period_function
146       ,appl_dynamic_template_process
147       ,extension_function1
148       ,extension_function2
149     from	hxc_time_recipients
150     where	time_recipient_id = p_time_recipient_id
151     for	update nowait;
152 --
153   l_proc	varchar2(72);
154 --
155 Begin
156   g_debug := hr_utility.debug_enabled;
157 
158   if g_debug then
159   	l_proc := g_package||'lck';
160   	hr_utility.set_location('Entering:'||l_proc, 5);
161   end if;
162   --
163   hr_api.mandatory_arg_error
164     (p_api_name           => l_proc
165     ,p_argument           => 'TIME_RECIPIENT_ID'
166     ,p_argument_value     => p_time_recipient_id
167     );
168   --
169   if g_debug then
170   	hr_utility.set_location('Locking:'||l_proc, 1000);
171   end if;
172   Open  C_Sel1;
173   Fetch C_Sel1 Into hxc_htr_shd.g_old_rec;
174   if g_debug then
175   	hr_utility.set_location('After Locking:'||l_proc, 2000);
176   end if;
177   If C_Sel1%notfound then
178     Close C_Sel1;
179     --
180     -- The primary key is invalid therefore we must error
181     --
182     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
183     fnd_message.raise_error;
184   End If;
185   Close C_Sel1;
186   If (p_object_version_number
187       <> hxc_htr_shd.g_old_rec.object_version_number) Then
188         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
189         fnd_message.raise_error;
190   End If;
191   --
192   if g_debug then
193   	hr_utility.set_location(' Leaving:'||l_proc, 10);
194   end if;
195   --
196   -- We need to trap the ORA LOCK exception
197   --
198 Exception
199   When HR_Api.Object_Locked then
200     --
201     -- The object is locked therefore we need to supply a meaningful
202     -- error message.
203     --
204     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
205     fnd_message.set_token('TABLE_NAME', 'hxc_time_recipients');
206     fnd_message.raise_error;
207 End lck;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |-----------------------------< convert_args >-----------------------------|
211 -- ----------------------------------------------------------------------------
212 Function convert_args
213   (p_time_recipient_id              in number
214   ,p_name                           in varchar2
215   ,p_appl_retrieval_function        in varchar2
216   ,p_appl_update_process            in varchar2
217   ,p_appl_validation_process        in varchar2
218   ,p_appl_period_function           in varchar2
219   ,p_appl_dyn_template_process      in varchar2
220   ,p_extension_function1            in varchar2
221   ,p_extension_function2            in varchar2
222   ,p_application_id                 in number
223   ,p_object_version_number          in number
224   )
225   Return g_rec_type is
226 --
227   l_rec   g_rec_type;
228 --
229 Begin
230   --
231   -- Convert arguments into local l_rec structure.
232   --
233   l_rec.time_recipient_id                := p_time_recipient_id;
234   l_rec.name                             := p_name;
235   l_rec.application_id                   := p_application_id;
236   l_rec.object_version_number            := p_object_version_number;
237   l_rec.application_retrieval_function   := p_appl_retrieval_function;
238   l_rec.application_update_process       := p_appl_update_process;
239   l_rec.appl_validation_process          := p_appl_validation_process;
240   l_rec.application_period_function      := p_appl_period_function;
241   l_rec.appl_dynamic_template_process    := p_appl_dyn_template_process;
242   l_rec.extension_function1              := p_extension_function1;
243   l_rec.extension_function2              := p_extension_function2;
244   --
245   -- Return the plsql record structure.
246   --
247   Return(l_rec);
248 --
249 End convert_args;
250 --
251 end hxc_htr_shd;