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