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