[Home] [Help]
PACKAGE BODY: APPS.IRC_LINKED_CANDIDATES_API
Source
1 PACKAGE BODY IRC_LINKED_CANDIDATES_API as
2 /* $Header: irilcapi.pkb 120.1 2010/05/26 09:55:42 chsharma noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' IRC_LINKED_CANDIDATES_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------------< create_linked_candidate >--------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_linked_candidate
13 (p_validate in boolean default false
14 ,p_duplicate_set_id in number
15 ,p_party_id in number
16 ,p_status in varchar2
17 ,p_target_party_id in number default null
18 ,p_link_id out nocopy number
19 ,p_object_version_number out nocopy number
20 ) is
21 --
22 -- Declare cursors and local variables
23 --
24 l_proc varchar2(72) := g_package||'CREATE_LINKED_CANDIDATE';
25 l_link_id number;
26 l_object_version_number number;
27 l_effective_date date;
28 begin
29 hr_utility.set_location('Entering:'|| l_proc, 10);
30 --
31 -- Issue a savepoint
32 --
33 savepoint create_linked_candidate;
34 --
35 -- Call Before Process User Hook
36 --
37 begin
38 irc_linked_candidates_bk1.create_linked_candidate_b
39 (p_duplicate_set_id => p_duplicate_set_id
40 ,p_party_id => p_party_id
41 ,p_status => p_status
42 ,p_target_party_id => p_target_party_id
43 );
44 exception
45 when hr_api.cannot_find_prog_unit then
46 hr_api.cannot_find_prog_unit_error
47 (p_module_name => 'CREATE_LINKED_CANDIDATE'
48 ,p_hook_type => 'BP'
49 );
50 end;
51 --
52 -- Process Logic
53 --
54 -- Set the effective date to the sysdate
55 l_effective_date := sysdate;
56
57 irc_ilc_ins.ins(p_effective_date => l_effective_date
58 ,p_duplicate_set_id => p_duplicate_set_id
59 ,p_party_id => p_party_id
60 ,p_status => p_status
61 ,p_target_party_id => p_target_party_id
62 ,p_link_id => l_link_id
63 ,p_object_version_number => l_object_version_number
64 );
65 -- Call After Process User Hook
66 --
67 begin
68 irc_linked_candidates_bk1.create_linked_candidate_a
69 (p_link_id => l_link_id
70 ,p_duplicate_set_id => p_duplicate_set_id
71 ,p_party_id => p_party_id
72 ,p_status => p_status
73 ,p_target_party_id => p_target_party_id
74 ,p_object_version_number => l_object_version_number
75 );
76 exception
77 when hr_api.cannot_find_prog_unit then
78 hr_api.cannot_find_prog_unit_error
79 (p_module_name => 'CREATE_LINKED_CANDIDATE'
80 ,p_hook_type => 'AP'
81 );
82 end;
83 --
84 -- When in validation only mode raise the Validate_Enabled exception
85 --
86 if p_validate then
87 raise hr_api.validate_enabled;
88 end if;
89 --
90 -- Set all IN OUT and OUT parameters with out values
91 --
92 p_link_id := l_link_id;
93 p_object_version_number := l_object_version_number;
94 --
95 hr_utility.set_location(' Leaving:'||l_proc, 70);
96 exception
97 when hr_api.validate_enabled then
98 --
99 -- As the Validate_Enabled exception has been raised
100 -- we must rollback to the savepoint
101 --
102 rollback to create_linked_candidate;
103 --
104 -- Reset IN OUT parameters and set OUT parameters
105 -- (Any key or derived arguments must be set to null
106 -- when validation only mode is being used.)
107 --
108 p_link_id := null;
109 p_object_version_number := null;
110 hr_utility.set_location(' Leaving:'||l_proc, 80);
111 when others then
112 --
113 -- A validation or unexpected error has occured
114 --
115 rollback to create_linked_candidate;
116 --
117 -- Reset IN OUT parameters and set all
118 -- OUT parameters, including warnings, to null
119 --
120 p_link_id := null;
121 p_object_version_number := null;
122 hr_utility.set_location(' Leaving:'||l_proc, 90);
123 raise;
124 end create_linked_candidate;
125 --
126 --
127 -- ----------------------------------------------------------------------------
128 -- |-----------------------< update_linked_candidate >----------------------|
129 -- ----------------------------------------------------------------------------
130 --
131 procedure update_linked_candidate
132 (p_validate in boolean default false
133 ,p_link_id in number
134 ,p_duplicate_set_id in number default hr_api.g_number
135 ,p_party_id in number default hr_api.g_number
136 ,p_status in varchar2 default hr_api.g_varchar2
137 ,p_target_party_id in number default hr_api.g_number
138 ,p_object_version_number in out nocopy number
139 ) is
140 --
141 -- Declare cursors and local variables
142 --
143 l_object_version_number number;
144 l_effective_date date;
145 l_proc varchar2(72) := g_package||'UPDATE_LINKED_CANDIDATE';
146 begin
147 hr_utility.set_location('Entering:'|| l_proc, 10);
148 --
149 -- Issue a savepoint
150 --
151 savepoint update_linked_candidate;
152 --
153 -- Call Before Process User Hook
154 --
155 begin
156 irc_linked_candidates_bk2.update_linked_candidate_b
157 (p_link_id => p_link_id
158 ,p_duplicate_set_id => p_duplicate_set_id
159 ,p_party_id => p_party_id
160 ,p_status => p_status
161 ,p_target_party_id => p_target_party_id
162 ,p_object_version_number => p_object_version_number
163 );
164 exception
165 when hr_api.cannot_find_prog_unit then
166 hr_api.cannot_find_prog_unit_error
167 (p_module_name => 'update_linked_candidate'
168 ,p_hook_type => 'BP'
169 );
170 end;
171 --
172 -- Process Logic
173 --
174 -- Set the effective date to the sysdate
175 l_effective_date := sysdate;
176 l_object_version_number := p_object_version_number;
177 if p_link_id is null then
178 -- RAISE ERROR SAYING INVALID link_ID
179 fnd_message.set_name('PER', 'IRC_XXXX_INV_LINK_ID');
180 fnd_message.raise_error;
181 end if;
182 irc_ilc_upd.upd(p_effective_date => l_effective_date
183 ,p_link_id => p_link_id
184 ,p_object_version_number => l_object_version_number
185 ,p_duplicate_set_id => p_duplicate_set_id
186 ,p_party_id => p_party_id
187 ,p_status => p_status
188 ,p_target_party_id => p_target_party_id
189 );
190 --
191 -- Call After Process User Hook
192 --
193 begin
194 irc_linked_candidates_bk2.update_linked_candidate_a
195 (p_link_id => p_link_id
196 ,p_duplicate_set_id => p_duplicate_set_id
197 ,p_party_id => p_party_id
198 ,p_status => p_status
199 ,p_target_party_id => p_target_party_id
200 ,p_object_version_number => p_object_version_number
201 );
202 exception
203 when hr_api.cannot_find_prog_unit then
204 hr_api.cannot_find_prog_unit_error
205 (p_module_name => 'update_linked_candidate'
206 ,p_hook_type => 'AP'
207 );
208 end;
209 --
210 -- When in validation only mode raise the Validate_Enabled exception
211 --
212 if p_validate then
213 raise hr_api.validate_enabled;
214 end if;
215 --
216 -- Set all IN OUT and OUT parameters with out values
217 --
218 p_object_version_number := l_object_version_number;
219 --
220 hr_utility.set_location(' Leaving:'||l_proc, 70);
221 exception
222 when hr_api.validate_enabled then
223 --
224 -- As the Validate_Enabled exception has been raised
225 -- we must rollback to the savepoint
226 --
227 rollback to update_linked_candidate;
228 --
229 -- Reset IN OUT parameters and set OUT parameters
230 -- (Any key or derived arguments must be set to null
231 -- when validation only mode is being used.)
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 80);
234 when others then
235 --
236 -- A validation or unexpected error has occured
237 --
238 rollback to update_linked_candidate;
239 --
240 -- Reset IN OUT parameters and set all
241 -- OUT parameters, including warnings, to null
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 90);
244 raise;
245 end update_linked_candidate;
246 --
247 --
248 -- ----------------------------------------------------------------------------
249 -- |-----------------------< delete_linked_candidate >----------------------|
250 -- ----------------------------------------------------------------------------
251 --
252 procedure delete_linked_candidate
253 (p_validate in boolean default false
254 ,p_link_id in number
255 ,p_object_version_number in number
256 ) is
257 --
258 -- Declare cursors and local variables
259 --
260 l_proc varchar2(72) := g_package||'DELETE_LINKED_CANDIDATE';
261 begin
262 hr_utility.set_location('Entering:'|| l_proc, 10);
263 --
264 -- Issue a savepoint
265 --
266 savepoint delete_linked_candidate;
267 --
268 -- Process Logic
269 --
270 if p_link_id is null then
271 -- RAISE ERROR SAYING INVALID link_ID
272 hr_utility.set_location('Invalid Link Id '|| l_proc, 20);
273 fnd_message.set_name('PER', 'IRC_XXXX_INV_LINK_ID');
274 fnd_message.raise_error;
275 end if;
276 --
277 hr_utility.set_location('Calling Delete Link Id '|| l_proc, 30);
278 --
279 irc_ilc_del.del(p_link_id => p_link_id
280 ,p_object_version_number => p_object_version_number
281 );
282 --
283 -- When in validation only mode raise the Validate_Enabled exception
284 --
285 if p_validate then
286 raise hr_api.validate_enabled;
287 end if;
288 --
289 hr_utility.set_location(' Leaving:'||l_proc, 40);
290 exception
291 when hr_api.validate_enabled then
292 --
293 -- As the Validate_Enabled exception has been raised
294 -- we must rollback to the savepoint
295 --
296 rollback to delete_linked_candidate;
297 --
298 hr_utility.set_location(' Leaving:'||l_proc, 50);
299 --
300 when others then
301 --
302 -- A validation or unexpected error has occured
303 --
304 rollback to delete_linked_candidate;
305 --
306 hr_utility.set_location(' Leaving:'||l_proc, 60);
307 --
308 raise;
309 end delete_linked_candidate;
310 --
311 end IRC_LINKED_CANDIDATES_API;