DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_DRU_SHD

Source


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