[Home] [Help]
PACKAGE BODY: APPS.HXC_MAP_SHD
Source
1 Package Body hxc_map_shd as
2 /* $Header: hxcmaprhi.pkb 120.2 2005/09/23 08:17:59 nissharm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_map_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_MAPPINGS_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_mapping_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 mapping_id
63 ,name
64 ,object_version_number
65 from hxc_mappings
66 where mapping_id = p_mapping_id;
67 --
68 l_fct_ret boolean;
69 --
70 Begin
71 --
72 If (p_mapping_id is null and
73 p_object_version_number 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_mapping_id
82 = hxc_map_shd.g_old_rec.mapping_id and
83 p_object_version_number
84 = hxc_map_shd.g_old_rec.object_version_number
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_map_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 If (p_object_version_number
107 <> hxc_map_shd.g_old_rec.object_version_number) Then
108 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
109 fnd_message.raise_error;
110 End If;
111 l_fct_ret := true;
112 End If;
113 End If;
114 Return (l_fct_ret);
115 --
116 End api_updating;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |---------------------------------< lck >----------------------------------|
120 -- ----------------------------------------------------------------------------
121 Procedure lck
122 (p_mapping_id in number
123 ,p_object_version_number in number
124 ) is
125 --
126 -- Cursor selects the 'current' row from the HR Schema
127 --
128 Cursor C_Sel1 is
129 select
130 mapping_id
131 ,name
132 ,object_version_number
133 from hxc_mappings
134 where mapping_id = p_mapping_id
135 for update nowait;
136 --
137 l_proc varchar2(72);
138 --
139 Begin
140 g_debug := hr_utility.debug_enabled;
141
142 if g_debug then
143 l_proc := g_package||'lck';
144 hr_utility.set_location('Entering:'||l_proc, 5);
145 end if;
146 --
147 hr_api.mandatory_arg_error
148 (p_api_name => l_proc
149 ,p_argument => 'MAPPING_ID'
150 ,p_argument_value => p_mapping_id
151 );
152 --
153 Open C_Sel1;
154 Fetch C_Sel1 Into hxc_map_shd.g_old_rec;
155 If C_Sel1%notfound then
156 Close C_Sel1;
157 --
158 -- The primary key is invalid therefore we must error
159 --
160 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
161 fnd_message.raise_error;
162 End If;
163 Close C_Sel1;
164 If (p_object_version_number
165 <> hxc_map_shd.g_old_rec.object_version_number) Then
166 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
167 fnd_message.raise_error;
168 End If;
169 --
170 if g_debug then
171 hr_utility.set_location(' Leaving:'||l_proc, 10);
172 end if;
173 --
174 -- We need to trap the ORA LOCK exception
175 --
176 Exception
177 When HR_Api.Object_Locked then
178 --
179 -- The object is locked therefore we need to supply a meaningful
180 -- error message.
181 --
182 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
183 fnd_message.set_token('TABLE_NAME', 'hxc_mappings');
184 fnd_message.raise_error;
185 End lck;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |-----------------------------< convert_args >-----------------------------|
189 -- ----------------------------------------------------------------------------
190 Function convert_args
191 (p_mapping_id in number
192 ,p_name in varchar2
193 ,p_object_version_number in number
194 )
195 Return g_rec_type is
196 --
197 l_rec g_rec_type;
198 --
199 Begin
200 --
201 -- Convert arguments into local l_rec structure.
202 --
203 l_rec.mapping_id := p_mapping_id;
204 l_rec.name := p_name;
205 l_rec.object_version_number := p_object_version_number;
206 --
207 -- Return the plsql record structure.
208 --
209 Return(l_rec);
210 --
211 End convert_args;
212 --
213 end hxc_map_shd;