[Home] [Help]
PACKAGE BODY: APPS.HXC_LCK_SHD
Source
1 Package Body hxc_lck_shd as
2 /* $Header: hxclocktypesrhi.pkb 120.2 2005/09/23 08:08:21 nissharm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_lck_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_LOCKER_TYPES_PK') Then
24 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
25 fnd_message.set_token('PROCEDURE', l_proc);
26 fnd_message.set_token('STEP','5');
27 fnd_message.raise_error;
28 Else
29 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
30 fnd_message.set_token('PROCEDURE', l_proc);
31 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
32 fnd_message.raise_error;
33 End If;
34 --
35 End constraint_error;
36 --
37 -- ----------------------------------------------------------------------------
38 -- |-----------------------------< api_updating >-----------------------------|
39 -- ----------------------------------------------------------------------------
40 Function api_updating
41 (p_locker_type_id 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 locker_type_id
51 ,locker_type
52 ,process_type
53 from hxc_locker_types
54 where locker_type_id = p_locker_type_id;
55 --
56 l_fct_ret boolean;
57 --
58 Begin
59 --
60 If (p_locker_type_id is null
61 ) Then
62 --
63 -- One of the primary key arguments is null therefore we must
64 -- set the returning function value to false
65 --
66 l_fct_ret := false;
67 Else
68 If (p_locker_type_id
69 = hxc_lck_shd.g_old_rec.locker_type_id
70 ) Then
71 --
72 -- The g_old_rec is current therefore we must
73 -- set the returning function to true
74 --
75 l_fct_ret := true;
76 Else
77 --
78 -- Select the current row into g_old_rec
79 --
80 Open C_Sel1;
81 Fetch C_Sel1 Into hxc_lck_shd.g_old_rec;
82 If C_Sel1%notfound Then
83 Close C_Sel1;
84 --
85 -- The primary key is invalid therefore we must error
86 --
87 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
88 fnd_message.raise_error;
89 End If;
90 Close C_Sel1;
91 --
92 l_fct_ret := true;
93 End If;
94 End If;
95 Return (l_fct_ret);
96 --
97 End api_updating;
98 --
99 -- ----------------------------------------------------------------------------
100 -- |---------------------------------< lck >----------------------------------|
101 -- ----------------------------------------------------------------------------
102 Procedure lck
103 (p_locker_type_id in number
104 ) is
105 --
106 -- Cursor selects the 'current' row from the HR Schema
107 --
108 Cursor C_Sel1 is
109 select
110 locker_type_id
111 ,locker_type
112 ,process_type
113 from hxc_locker_types
114 where locker_type_id = p_locker_type_id
115 for update nowait;
116 --
117 l_proc varchar2(72);
118 --
119 Begin
120 g_debug := hr_utility.debug_enabled;
121
122 if g_debug then
123 l_proc := g_package||'lck';
124 hr_utility.set_location('Entering:'||l_proc, 5);
125 end if;
126 --
127 hr_api.mandatory_arg_error
128 (p_api_name => l_proc
129 ,p_argument => 'LOCKER_TYPE_ID'
130 ,p_argument_value => p_locker_type_id
131 );
132 --
133 Open C_Sel1;
134 Fetch C_Sel1 Into hxc_lck_shd.g_old_rec;
135 If C_Sel1%notfound then
136 Close C_Sel1;
137 --
138 -- The primary key is invalid therefore we must error
139 --
140 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
141 fnd_message.raise_error;
142 End If;
143 Close C_Sel1;
144 --
145 --
146 if g_debug then
147 hr_utility.set_location(' Leaving:'||l_proc, 10);
148 end if;
149 --
150 -- We need to trap the ORA LOCK exception
151 --
152 Exception
153 When HR_Api.Object_Locked then
154 --
155 -- The object is locked therefore we need to supply a meaningful
156 -- error message.
157 --
158 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
159 fnd_message.set_token('TABLE_NAME', 'hxc_locker_types');
160 fnd_message.raise_error;
161 End lck;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |-----------------------------< convert_args >-----------------------------|
165 -- ----------------------------------------------------------------------------
166 Function convert_args
167 (p_locker_type_id in number
168 ,p_locker_type in varchar2
169 ,p_process_type in varchar2
170 )
171 Return g_rec_type is
172 --
173 l_rec g_rec_type;
174 --
175 Begin
176 --
177 -- Convert arguments into local l_rec structure.
178 --
179 l_rec.locker_type_id := p_locker_type_id;
180 l_rec.locker_type := p_locker_type;
181 l_rec.process_type := p_process_type;
182 --
183 -- Return the plsql record structure.
184 --
185 Return(l_rec);
186 --
187 End convert_args;
188 --
189 end hxc_lck_shd;