[Home] [Help]
PACKAGE BODY: APPS.PER_STC_SHD
Source
1 Package Body per_stc_shd as
2 /* $Header: pestcrhi.pkb 120.1 2005/08/29 11:48:34 ndorai noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_stc_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'PER_SOLUTION_TYPE_CMPTS_FK1') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 ElsIf (p_constraint_name = 'PER_SOLUTION_TYPE_CMPTS_PK') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 Else
32 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35 fnd_message.raise_error;
36 End If;
37 --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44 (p_component_name in varchar2
45 ,p_solution_type_name in varchar2
46 ,p_legislation_code in varchar2
47 ,p_object_version_number in number
48 )
49 Return Boolean Is
50 --
51 --
52 -- Cursor selects the 'current' row from the HR Schema
53 --
54 Cursor C_Sel1 is
55 select
56 component_name
57 ,solution_type_name
58 ,legislation_code
59 ,api_name
60 ,parent_component_name
61 ,updateable
62 ,extensible
63 ,object_version_number
64 from per_solution_type_cmpts
65 where component_name = p_component_name
66 and solution_type_name = p_solution_type_name;
67 --
68 l_fct_ret boolean;
69 --
70 Begin
71 --
72 If (p_component_name is null and
73 p_solution_type_name is null and
74 p_legislation_code 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_component_name
84 = per_stc_shd.g_old_rec.component_name and
85 p_solution_type_name
86 = per_stc_shd.g_old_rec.solution_type_name and
87 p_legislation_code
88 = per_stc_shd.g_old_rec.legislation_code and
89 p_object_version_number
90 = per_stc_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 per_stc_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 <> per_stc_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_component_name in varchar2
129 ,p_solution_type_name in varchar2
130 ,p_legislation_code in varchar2
131 ,p_object_version_number in number
132 ) is
133 --
134 -- Cursor selects the 'current' row from the HR Schema
135 --
136 Cursor C_Sel1 is
137 select
138 component_name
139 ,solution_type_name
140 ,legislation_code
141 ,api_name
142 ,parent_component_name
143 ,updateable
144 ,extensible
145 ,object_version_number
146 from per_solution_type_cmpts
147 where component_name = p_component_name
148 and solution_type_name = p_solution_type_name
149 for update nowait;
150 --
151 l_proc varchar2(72) := g_package||'lck';
152 --
153 Begin
154 hr_utility.set_location('Entering:'||l_proc, 5);
155 --
156 hr_api.mandatory_arg_error
157 (p_api_name => l_proc
158 ,p_argument => 'COMPONENT_NAME'
159 ,p_argument_value => p_component_name
160 );
161 hr_utility.set_location(l_proc,6);
162 hr_api.mandatory_arg_error
163 (p_api_name => l_proc
164 ,p_argument => 'SOLUTION_TYPE_NAME'
165 ,p_argument_value => p_solution_type_name
166 );
167 hr_utility.set_location(l_proc,7);
168 hr_api.mandatory_arg_error
169 (p_api_name => l_proc
170 ,p_argument => 'LEGISLATION_CODE'
171 ,p_argument_value => p_legislation_code
172 );
173 hr_utility.set_location(l_proc,8);
174 hr_api.mandatory_arg_error
175 (p_api_name => l_proc
176 ,p_argument => 'OBJECT_VERSION_NUMBER'
177 ,p_argument_value => p_object_version_number
178 );
179 --
180 Open C_Sel1;
181 Fetch C_Sel1 Into per_stc_shd.g_old_rec;
182 If C_Sel1%notfound then
183 Close C_Sel1;
184 --
185 -- The primary key is invalid therefore we must error
186 --
187 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
188 fnd_message.raise_error;
189 End If;
190 Close C_Sel1;
191 If (p_object_version_number
192 <> per_stc_shd.g_old_rec.object_version_number) Then
193 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
194 fnd_message.raise_error;
195 End If;
196 --
197 hr_utility.set_location(' Leaving:'||l_proc, 10);
198 --
199 -- We need to trap the ORA LOCK exception
200 --
201 Exception
202 When HR_Api.Object_Locked then
203 --
204 -- The object is locked therefore we need to supply a meaningful
205 -- error message.
206 --
207 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
208 fnd_message.set_token('TABLE_NAME', 'per_solution_type_cmpts');
209 fnd_message.raise_error;
210 End lck;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |-----------------------------< convert_args >-----------------------------|
214 -- ----------------------------------------------------------------------------
215 Function convert_args
216 (p_component_name in varchar2
217 ,p_solution_type_name in varchar2
218 ,p_legislation_code in varchar2
219 ,p_api_name in varchar2
220 ,p_parent_component_name in varchar2
221 ,p_updateable in varchar2
222 ,p_extensible in varchar2
223 ,p_object_version_number in number
224 )
225 Return g_rec_type is
226 --
227 l_rec g_rec_type;
228 --
229 Begin
230 --
231 -- Convert arguments into local l_rec structure.
232 --
233 l_rec.component_name := p_component_name;
234 l_rec.solution_type_name := p_solution_type_name;
235 l_rec.legislation_code := p_legislation_code;
236 l_rec.api_name := p_api_name;
237 l_rec.parent_component_name := p_parent_component_name;
238 l_rec.updateable := p_updateable;
239 l_rec.extensible := p_extensible;
240 l_rec.object_version_number := p_object_version_number;
241 --
242 -- Return the plsql record structure.
243 --
244 Return(l_rec);
245 --
246 End convert_args;
247 --
248 end per_stc_shd;