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