DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAN_SHD

Source


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