DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_LKR_SHD

Source


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