[Home] [Help]
PACKAGE BODY: APPS.GHR_PDH_SHD
Source
1 PACKAGE BODY ghr_pdh_shd AS
2 /* $Header: ghpdhrhi.pkb 120.1 2006/01/17 06:21:22 sumarimu noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ghr_pdh_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16 l_proc varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19 hr_utility.set_location('Entering:'||l_proc, 5);
20 --
21 If (p_constraint_name = 'GHR_PD_ROUTING_HIST_FK1') Then
22 hr_utility.set_message(8301,'GHR_99999_INV_PD_REQUEST_ID' );
23 hr_utility.raise_error;
24 ElsIf (p_constraint_name = 'GHR_PD_ROUTING_HIST_FK2') Then
25 hr_utility.set_message(8301,'GHR_38100_INV_ROUT_LIST_ID');
26 hr_utility.raise_error;
27 ElsIf (p_constraint_name = 'GHR_PD_ROUTING_HIST_PK') Then
28 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
29 hr_utility.set_message_token('PROCEDURE', l_proc);
30 hr_utility.set_message_token('STEP','15');
31 hr_utility.raise_error;
32 Else
33 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT'); --
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
36 hr_utility.raise_error;
37 End If;
38 --
39 hr_utility.set_location(' Leaving:'||l_proc, 10);
40 End constraint_error;
41 --
42 -- ----------------------------------------------------------------------------
43 -- |-----------------------------< api_updating >-----------------------------|
44 -- ----------------------------------------------------------------------------
45 Function api_updating
46 (
47 p_pd_routing_history_id in number,
48 p_object_version_number in number
49 ) Return Boolean Is
50 --
51 --
52 -- Cursor selects the 'current' row from the HR Schema
53 --
54 Cursor C_Sel1 is
55 select pd_routing_history_id,
56 position_description_id,
57 initiator_flag,
58 requester_flag,
59 approver_flag,
60 reviewer_flag,
61 authorizer_flag,
62 personnelist_flag,
63 approved_flag,
64 user_name,
65 user_name_employee_id ,
66 user_name_emp_first_name,
67 user_name_emp_last_name,
68 user_name_emp_middle_names,
69 action_taken,
70 groupbox_id,
71 routing_list_id,
72 routing_seq_number,
73 date_notification_sent,
74 object_version_number,
75 item_key from ghr_pd_routing_history
76 where pd_routing_history_id = p_pd_routing_history_id;
80 --
77 --
78 l_proc varchar2(72) := g_package||'api_updating';
79 l_fct_ret boolean;
81 Begin
82 hr_utility.set_location('Entering:'||l_proc, 5);
83 --
84 If (
85 p_pd_routing_history_id is null and
86 p_object_version_number is null
87 ) Then
88 --
89 -- One of the primary key arguments is null therefore we must
90 -- set the returning function value to false
91 --
92 l_fct_ret := false;
93 Else
94 If (
95 p_pd_routing_history_id = g_old_rec.pd_routing_history_id and
96 p_object_version_number = g_old_rec.object_version_number
97 ) Then
98 hr_utility.set_location(l_proc, 10);
99 --
100 -- The g_old_rec is current therefore we must
101 -- set the returning function to true
102 --
103 l_fct_ret := true;
104 Else
105 --
106 -- Select the current row into g_old_rec
107 --
108 Open C_Sel1;
109 Fetch C_Sel1 Into g_old_rec;
110 If C_Sel1%notfound Then
111 Close C_Sel1;
112 --
113 -- The primary key is invalid therefore we must error
114 --
115 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
116 hr_utility.raise_error;
117 End If;
118 Close C_Sel1;
119 If (p_object_version_number <> g_old_rec.object_version_number) Then
120 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
121 hr_utility.raise_error;
122 End If;
123 hr_utility.set_location(l_proc, 15);
124 l_fct_ret := true;
125 End If;
126 End If;
127 hr_utility.set_location(' Leaving:'||l_proc, 20);
128 Return (l_fct_ret);
129 --
130 End api_updating;
131 --
132 -- ----------------------------------------------------------------------------
133 -- |---------------------------------< lck >----------------------------------|
134 -- ----------------------------------------------------------------------------
135 Procedure lck
136 (
137 p_pd_routing_history_id in number,
138 p_object_version_number in number
139 ) is
140 --
141 -- Cursor selects the 'current' row from the HR Schema
142 --
143 Cursor C_Sel1 is
144 select
145 pd_routing_history_id,
146 position_description_id,
147 initiator_flag,
148 requester_flag,
149 approver_flag,
150 reviewer_flag,
151 authorizer_flag,
152 personnelist_flag,
153 approved_flag,
154 user_name,
155 user_name_employee_id,
156 user_name_emp_first_name,
157 user_name_emp_last_name,
158 user_name_emp_middle_names,
159 action_taken,
160 groupbox_id,
161 routing_list_id,
162 routing_seq_number,
163 date_notification_sent,
164 object_version_number,
165 item_key
166 from ghr_pd_routing_history
167 where pd_routing_history_id = p_pd_routing_history_id
168 for update nowait;
169 --
170 l_proc varchar2(72) := g_package||'lck';
171 --
172 Begin
173 hr_utility.set_location('Entering:'||l_proc, 5);
174 --
175 -- Add any mandatory argument checking here:
176 -- Example:
177 -- hr_api.mandatory_arg_error
178 -- (p_api_name => l_proc,
179 -- p_argument => 'object_version_number',
180 -- p_argument_value => p_object_version_number);
181 --
182 Open C_Sel1;
183 Fetch C_Sel1 Into g_old_rec;
184 If C_Sel1%notfound then
185 Close C_Sel1;
186 --
187 -- The primary key is invalid therefore we must error
188 --
189 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
190 hr_utility.raise_error;
191 End If;
192 Close C_Sel1;
193 If (p_object_version_number <> g_old_rec.object_version_number) Then
194 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
195 hr_utility.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 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
209 hr_utility.set_message_token('TABLE_NAME', 'ghr_pd_routing_history');
210 hr_utility.raise_error;
211 End lck;
212 --
213 -- ----------------------------------------------------------------------------
214 -- |-----------------------------< convert_args >-----------------------------|
215 -- ----------------------------------------------------------------------------
216 Function convert_args
217 (
218 p_pd_routing_history_id in number,
219 p_position_description_id in number,
220 p_initiator_flag in varchar2,
221 p_requester_flag in varchar2,
222 p_approver_flag in varchar2,
223 p_reviewer_flag in varchar2,
224 p_authorizer_flag in varchar2,
225 p_personnelist_flag in varchar2,
226 p_approved_flag in varchar2,
227 p_user_name in varchar2,
228 p_user_name_employee_id in number,
229 p_user_name_emp_first_name in varchar2,
230 p_user_name_emp_last_name in varchar2,
231 p_user_name_emp_middle_names in varchar2,
232 p_action_taken in varchar2,
233 p_groupbox_id in number,
234 p_routing_list_id in number,
235 p_routing_seq_number in number,
236 p_date_notification_sent in date,
237 p_object_version_number in number,
238 p_item_key in varchar2
239 )
240 Return g_rec_type is
241 --
242 l_rec g_rec_type;
243 l_proc varchar2(72) := g_package||'convert_args';
244 --
245 Begin
246 --
247 hr_utility.set_location('Entering:'||l_proc, 5);
248 --
249 -- Convert arguments into local l_rec structure.
250 --
251 l_rec.pd_routing_history_id := p_pd_routing_history_id;
252 l_rec.position_description_id := p_position_description_id;
253 l_rec.initiator_flag := p_initiator_flag;
254 l_rec.requester_flag := p_requester_flag;
255 l_rec.approver_flag := p_approver_flag;
256 l_rec.reviewer_flag := p_reviewer_flag;
257 l_rec.authorizer_flag := p_authorizer_flag;
258 l_rec.personnelist_flag := p_personnelist_flag;
259 l_rec.approved_flag := p_approved_flag;
260 l_rec.user_name := p_user_name;
261 l_rec.user_name_employee_id := p_user_name_employee_id;
262 l_rec.user_name_emp_first_name := p_user_name_emp_first_name;
263 l_rec.user_name_emp_last_name := p_user_name_emp_last_name;
264 l_rec.user_name_emp_middle_names := p_user_name_emp_middle_names;
265 l_rec.action_taken := p_action_taken;
266 l_rec.groupbox_id := p_groupbox_id;
267 l_rec.routing_list_id := p_routing_list_id;
268 l_rec.routing_seq_number := p_routing_seq_number;
269 l_rec.date_notification_sent := p_date_notification_sent;
270 l_rec.object_version_number := p_object_version_number;
271 l_rec.item_key := p_item_key;
272 --
273 -- Return the plsql record structure.
274 --
275 hr_utility.set_location(' Leaving:'||l_proc, 10);
276 Return(l_rec);
277 --
278 End convert_args;
279 --
280 end ghr_pdh_shd;