1 Package Body irc_template_association_swi As
2 /* $Header: iritaswi.pkb 120.0 2005/09/27 08:12 sayyampe noship $ */
3 --
4 -- Package variables
5 --
6 g_package varchar2(33) := 'irc_template_association_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |----------------------< create_template_association >---------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_template_association
12 (p_validate in number default hr_api.g_false_num
13 ,p_template_id in number
14 ,p_effective_date in date default null
15 ,p_default_association in varchar2 default null
16 ,p_job_id in number default null
17 ,p_position_id in number default null
18 ,p_organization_id in number default null
19 ,p_start_date in date default null
20 ,p_end_date in date default null
21 ,p_object_version_number out nocopy number
22 ,p_template_association_id in number
23 ,p_return_status out nocopy varchar2
24 ) is
25 --
26 -- Variables for API Boolean parameters
27 l_validate boolean;
28 --
29 -- Variables for IN/OUT parameters
30 --
31 -- Other variables
32 l_template_association_id number;
33 l_proc varchar2(72) := g_package ||'create_template_association';
34 Begin
35 hr_utility.set_location(' Entering:' || l_proc,10);
36 --
37 -- Issue a savepoint
38 --
39 savepoint create_template_assoc_swi;
40 --
41 -- Initialise Multiple Message Detection
42 --
43 hr_multi_message.enable_message_list;
44 --
45 -- Remember IN OUT parameter IN values
46 --
47 --
48 -- Convert constant values to their corresponding boolean value
49 --
50 l_validate :=
51 hr_api.constant_to_boolean
52 (p_constant_value => p_validate);
53
54 --
55 -- Register Surrogate ID or user key values
56 --
57 irc_ita_ins.set_base_key_value
58 (p_template_association_id => p_template_association_id
59 );
60 --
61 -- Call API
62 --
63 irc_template_association_api.create_template_association
64 (p_validate => l_validate
65 ,p_template_id => p_template_id
66 ,p_effective_date => p_effective_date
67 ,p_default_association => p_default_association
68 ,p_job_id => p_job_id
69 ,p_position_id => p_position_id
70 ,p_organization_id => p_organization_id
71 ,p_start_date => p_start_date
72 ,p_end_date => p_end_date
73 ,p_object_version_number => p_object_version_number
74 ,p_template_association_id => l_template_association_id
75 );
76 --
77 -- Convert API warning boolean parameter values to specific
78 -- messages and add them to Multiple Message List
79 --
80 --
81 -- Convert API non-warning boolean parameter values
82 --
83 --
84 -- Derive the API return status value based on whether
85 -- messages of any type exist in the Multiple Message List.
86 -- Also disable Multiple Message Detection.
87 --
88 p_return_status := hr_multi_message.get_return_status_disable;
89 hr_utility.set_location(' Leaving:' || l_proc,20);
90 --
91 exception
92 when hr_multi_message.error_message_exist then
93 --
94 -- Catch the Multiple Message List exception which
95 -- indicates API processing has been aborted because
96 -- at least one message exists in the list.
97 --
98 rollback to create_template_assoc_swi;
99 --
100 -- Reset IN OUT parameters and set OUT parameters
101 --
102 p_object_version_number := null;
103 p_return_status := hr_multi_message.get_return_status_disable;
104 hr_utility.set_location(' Leaving:' || l_proc, 30);
105 when others then
106 --
107 -- When Multiple Message Detection is enabled catch
108 -- any Application specific or other unexpected
109 -- exceptions. Adding appropriate details to the
110 -- Multiple Message List. Otherwise re-raise the
111 -- error.
112 --
113 rollback to create_template_assoc_swi;
114 if hr_multi_message.unexpected_error_add(l_proc) then
115 hr_utility.set_location(' Leaving:' || l_proc,40);
116 raise;
117 end if;
118 --
119 -- Reset IN OUT and set OUT parameters
120 --
121 p_object_version_number := null;
122 p_return_status := hr_multi_message.get_return_status_disable;
123 hr_utility.set_location(' Leaving:' || l_proc,50);
124 end create_template_association;
125 -- ----------------------------------------------------------------------------
126 -- |----------------------< update_template_association >---------------------|
127 -- ----------------------------------------------------------------------------
128 PROCEDURE update_template_association
129 (p_validate in number default hr_api.g_false_num
130 ,p_effective_date in date default hr_api.g_date
131 ,p_template_association_id in number
132 ,p_template_id in number
133 ,p_default_association in varchar2 default hr_api.g_varchar2
134 ,p_job_id in number default hr_api.g_number
135 ,p_position_id in number default hr_api.g_number
136 ,p_organization_id in number default hr_api.g_number
137 ,p_start_date in date default hr_api.g_date
138 ,p_end_date in date default hr_api.g_date
139 ,p_object_version_number in out nocopy number
140 ,p_return_status out nocopy varchar2
141 ) is
142 --
143 -- Variables for API Boolean parameters
144 l_validate boolean;
145 --
146 -- Variables for IN/OUT parameters
147 l_object_version_number number;
148 --
149 -- Other variables
150 l_proc varchar2(72) := g_package ||'update_template_association';
151 Begin
152 hr_utility.set_location(' Entering:' || l_proc,10);
153 --
154 -- Issue a savepoint
155 --
156 savepoint update_template_assoc_swi;
157 --
158 -- Initialise Multiple Message Detection
159 --
160 hr_multi_message.enable_message_list;
161 --
162 -- Remember IN OUT parameter IN values
163 --
164 l_object_version_number := p_object_version_number;
165 --
166 -- Convert constant values to their corresponding boolean value
167 --
168 l_validate :=
169 hr_api.constant_to_boolean
170 (p_constant_value => p_validate);
171 --
172 -- Register Surrogate ID or user key values
173 --
174 --
175 -- Call API
176 --
177 irc_template_association_api.update_template_association
178 (p_validate => l_validate
179 ,p_effective_date => p_effective_date
180 ,p_template_association_id => p_template_association_id
181 ,p_template_id => p_template_id
182 ,p_default_association => p_default_association
183 ,p_job_id => p_job_id
184 ,p_position_id => p_position_id
185 ,p_organization_id => p_organization_id
186 ,p_start_date => p_start_date
187 ,p_end_date => p_end_date
188 ,p_object_version_number => p_object_version_number
189 );
190 --
191 -- Convert API warning boolean parameter values to specific
192 -- messages and add them to Multiple Message List
193 --
194 --
195 -- Convert API non-warning boolean parameter values
196 --
197 --
198 -- Derive the API return status value based on whether
199 -- messages of any type exist in the Multiple Message List.
200 -- Also disable Multiple Message Detection.
201 --
202 p_return_status := hr_multi_message.get_return_status_disable;
203 hr_utility.set_location(' Leaving:' || l_proc,20);
204 --
205 exception
206 when hr_multi_message.error_message_exist then
207 --
208 -- Catch the Multiple Message List exception which
209 -- indicates API processing has been aborted because
210 -- at least one message exists in the list.
211 --
212 rollback to update_template_assoc_swi;
213 --
214 -- Reset IN OUT parameters and set OUT parameters
215 --
216 p_object_version_number := l_object_version_number;
217 p_return_status := hr_multi_message.get_return_status_disable;
218 hr_utility.set_location(' Leaving:' || l_proc, 30);
219 when others then
220 --
221 -- When Multiple Message Detection is enabled catch
222 -- any Application specific or other unexpected
223 -- exceptions. Adding appropriate details to the
224 -- Multiple Message List. Otherwise re-raise the
225 -- error.
226 --
227 rollback to update_template_assoc_swi;
228 if hr_multi_message.unexpected_error_add(l_proc) then
229 hr_utility.set_location(' Leaving:' || l_proc,40);
230 raise;
231 end if;
232 --
233 -- Reset IN OUT and set OUT parameters
234 --
235 p_object_version_number := l_object_version_number;
236 p_return_status := hr_multi_message.get_return_status_disable;
237 hr_utility.set_location(' Leaving:' || l_proc,50);
238 end update_template_association;
239 -- ----------------------------------------------------------------------------
240 -- |----------------------< delete_template_association >---------------------|
241 -- ----------------------------------------------------------------------------
242 PROCEDURE delete_template_association
243 (p_validate in number default hr_api.g_false_num
244 ,p_template_association_id in number
245 ,p_object_version_number in number
246 ,p_return_status out nocopy varchar2
247 ) is
248 --
249 -- Variables for API Boolean parameters
250 l_validate boolean;
251 --
252 -- Variables for IN/OUT parameters
253 --
254 -- Other variables
255 l_proc varchar2(72) := g_package ||'delete_template_association';
256 Begin
257 hr_utility.set_location(' Entering:' || l_proc,10);
258 --
259 -- Issue a savepoint
260 --
261 savepoint delete_template_assoc_swi;
262 --
263 -- Initialise Multiple Message Detection
264 --
265 hr_multi_message.enable_message_list;
266 --
267 -- Remember IN OUT parameter IN values
268 --
269 --
270 -- Convert constant values to their corresponding boolean value
271 --
272 l_validate :=
273 hr_api.constant_to_boolean
274 (p_constant_value => p_validate);
275 --
276 -- Register Surrogate ID or user key values
277 --
278 --
279 -- Call API
280 --
281 irc_template_association_api.delete_template_association
282 (p_validate => l_validate
283 ,p_template_association_id => p_template_association_id
284 ,p_object_version_number => p_object_version_number
285 );
286 --
287 -- Convert API warning boolean parameter values to specific
288 -- messages and add them to Multiple Message List
289 --
290 --
291 -- Convert API non-warning boolean parameter values
292 --
293 --
294 -- Derive the API return status value based on whether
295 -- messages of any type exist in the Multiple Message List.
296 -- Also disable Multiple Message Detection.
297 --
298 p_return_status := hr_multi_message.get_return_status_disable;
299 hr_utility.set_location(' Leaving:' || l_proc,20);
300 --
301 exception
302 when hr_multi_message.error_message_exist then
303 --
304 -- Catch the Multiple Message List exception which
305 -- indicates API processing has been aborted because
306 -- at least one message exists in the list.
307 --
308 rollback to delete_template_assoc_swi;
309 --
310 -- Reset IN OUT parameters and set OUT parameters
311 --
312 p_return_status := hr_multi_message.get_return_status_disable;
313 hr_utility.set_location(' Leaving:' || l_proc, 30);
314 when others then
315 --
316 -- When Multiple Message Detection is enabled catch
317 -- any Application specific or other unexpected
318 -- exceptions. Adding appropriate details to the
319 -- Multiple Message List. Otherwise re-raise the
320 -- error.
321 --
322 rollback to delete_template_assoc_swi;
323 if hr_multi_message.unexpected_error_add(l_proc) then
324 hr_utility.set_location(' Leaving:' || l_proc,40);
325 raise;
326 end if;
327 --
328 -- Reset IN OUT and set OUT parameters
329 --
330 p_return_status := hr_multi_message.get_return_status_disable;
331 hr_utility.set_location(' Leaving:' || l_proc,50);
332 end delete_template_association;
333 end irc_template_association_swi;