[Home] [Help]
PACKAGE BODY: APPS.IRC_VARIABLE_COMP_ELEMENT_SWI
Source
1 Package Body irc_variable_comp_element_swi As
2 /* $Header: irvceswi.pkb 120.1.12010000.2 2009/10/05 18:32:13 amikukum ship $ */
3 --
4 -- Package variables
5 --
6 g_package varchar2(33) := 'irc_variable_comp_element_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |---------------------< create_variable_compensation >---------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_variable_compensation
12 (p_validate in number default hr_api.g_false_num
13 ,p_vacancy_id in number
14 ,p_variable_comp_lookup in varchar2
15 ,p_effective_date in date
16 ,p_object_version_number out nocopy number
17 ,p_return_status out nocopy varchar2
18 ) is
19 --
20 -- Variables for API Boolean parameters
21 l_validate boolean;
22 --
23 -- Variables for IN/OUT parameters
24 --
25 -- Other variables
26 l_proc varchar2(72) := g_package ||'create_variable_compensation';
27 Begin
28 hr_utility.set_location(' Entering:' || l_proc,10);
29 --
30 -- Issue a savepoint
31 --
32 savepoint create_variable_comp_swi;
33 --
34 -- Initialise Multiple Message Detection
35 --
36 hr_multi_message.enable_message_list;
37 --
38 -- Remember IN OUT parameter IN values
39 --
40 --
41 -- Convert constant values to their corresponding boolean value
42 --
43 l_validate :=
44 hr_api.constant_to_boolean
45 (p_constant_value => p_validate);
46 --
47 -- Register Surrogate ID or user key values
48 --
49 --
50 -- Call API
51 --
52 irc_variable_comp_element_api.create_variable_compensation
53 (p_validate => l_validate
54 ,p_vacancy_id => p_vacancy_id
55 ,p_variable_comp_lookup => p_variable_comp_lookup
56 ,p_effective_date => p_effective_date
57 ,p_object_version_number => p_object_version_number
58 );
59 --
60 -- Convert API warning boolean parameter values to specific
61 -- messages and add them to Multiple Message List
62 --
63 --
64 -- Convert API non-warning boolean parameter values
65 --
66 --
67 -- Derive the API return status value based on whether
68 -- messages of any type exist in the Multiple Message List.
69 -- Also disable Multiple Message Detection.
70 --
71 p_return_status := hr_multi_message.get_return_status_disable;
72 hr_utility.set_location(' Leaving:' || l_proc,20);
73 --
74 exception
75 when hr_multi_message.error_message_exist then
76 --
77 -- Catch the Multiple Message List exception which
78 -- indicates API processing has been aborted because
79 -- at least one error message exists in the list.
80 --
81 rollback to create_variable_comp_swi;
82 --
83 -- Reset IN OUT paramters and set OUT parameters
84 --
85 p_object_version_number := null;
86 p_return_status := hr_multi_message.get_return_status_disable;
87 hr_utility.set_location(' Leaving:' || l_proc,30);
88 when others then
89 --
90 -- When Multiple Message Detection is enabled catch
91 -- any Application specific or other unexpected
92 -- exceptions. Adding appropriate details to the
93 -- Multiple Message List. Otherwise re-raise
94 -- the error.
95 --
96 rollback to create_variable_comp_swi;
97 if hr_multi_message.unexpected_error_add(l_proc) then
98 hr_utility.set_location(' Leaving:' || l_proc, 40);
99 raise;
100 end if;
101 --
102 -- Reset IN OUT parameters and set OUT parameters
103 --
104 p_object_version_number := null;
105 p_return_status := hr_multi_message.get_return_status_disable;
106 hr_utility.set_location(' Leaving: ' || l_proc, 50);
107 end create_variable_compensation;
108 -- ----------------------------------------------------------------------------
109 -- |---------------------< delete_variable_compensation >---------------------|
110 -- ----------------------------------------------------------------------------
111 PROCEDURE delete_variable_compensation
112 (p_validate in number default hr_api.g_false_num
113 ,p_vacancy_id in number
114 ,p_variable_comp_lookup in varchar2
115 ,p_object_version_number in number
116 ,p_return_status out nocopy varchar2
117 ) is
118 --
119 --
120 l_object_version_number irc_variable_comp_elements.object_version_number%TYPE;
121 --
122 cursor get_object_version_number(p_vacancy_id irc_variable_comp_elements.vacancy_id%TYPE,
123 p_variable_comp_lookup irc_variable_comp_elements.variable_comp_lookup%TYPE) is
124 select object_version_number
125 from irc_variable_comp_elements
126 where vacancy_id = p_vacancy_id
127 and variable_comp_lookup = p_variable_comp_lookup;
128 --
129 -- Variables for API Boolean parameters
130 l_validate boolean;
131 --
132 -- Variables for IN/OUT parameters
133 --
134 -- Other variables
135 l_proc varchar2(72) := g_package ||'delete_variable_compensation';
136 Begin
137 hr_utility.set_location(' Entering:' || l_proc,10);
138 --
139 -- Issue a savepoint
140 --
141 savepoint delete_variable_comp_swi;
142 --
143 -- Initialise Multiple Message Detection
144 --
145 hr_multi_message.enable_message_list;
146 --
147 -- Remember IN OUT parameter IN values
148 --
149 --
150 -- Convert constant values to their corresponding boolean value
151 --
152 l_validate :=
153 hr_api.constant_to_boolean
154 (p_constant_value => p_validate);
155 --
156 -- Register Surrogate ID or user key values
157 --
158 --
159 -- Call API
160 --
161 l_object_version_number := p_object_version_number;
162 if(p_object_version_number is null or p_object_version_number < 0) then
163 open get_object_version_number(p_vacancy_id,p_variable_comp_lookup);
164 fetch get_object_version_number into l_object_version_number;
165 close get_object_version_number;
166 end if;
167 --
168 --
169 irc_variable_comp_element_api.delete_variable_compensation
170 (p_validate => l_validate
171 ,p_vacancy_id => p_vacancy_id
172 ,p_variable_comp_lookup => p_variable_comp_lookup
173 ,p_object_version_number => l_object_version_number
174 );
175 --
176 -- Convert API warning boolean parameter values to specific
177 -- messages and add them to Multiple Message List
178 --
179 --
180 -- Convert API non-warning boolean parameter values
181 --
182 --
183 -- Derive the API return status value based on whether
184 -- messages of any type exist in the Multiple Message List.
185 -- Also disable Multiple Message Detection.
186 --
187 p_return_status := hr_multi_message.get_return_status_disable;
188 hr_utility.set_location(' Leaving:' || l_proc,20);
189 --
190 exception
191 when hr_multi_message.error_message_exist then
192 --
193 -- Catch the Multiple Message List exception which
194 -- indicates API processing has been aborted because
195 -- at least one error message exists in the list.
196 --
197 rollback to delete_variable_comp_swi;
198 --
199 -- Reset IN OUT paramters and set OUT parameters
200 --
201 p_return_status := hr_multi_message.get_return_status_disable;
202 hr_utility.set_location(' Leaving:' || l_proc,30);
203 when others then
204 --
205 -- When Multiple Message Detection is enabled catch
206 -- any Application specific or other unexpected
207 -- exceptions. Adding appropriate details to the
208 -- Multiple Message List. Otherwise re-raise
209 -- the error.
210 --
211 rollback to delete_variable_comp_swi;
212 if hr_multi_message.unexpected_error_add(l_proc) then
213 hr_utility.set_location(' Leaving:' || l_proc, 40);
214 raise;
215 end if;
216 --
217 -- Reset IN OUT parameters and set OUT parameters
218 --
219 p_return_status := hr_multi_message.get_return_status_disable;
220 hr_utility.set_location(' Leaving: ' || l_proc, 50);
221 end delete_variable_compensation;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |----------------------------< process_api >-------------------------------|
225 -- ----------------------------------------------------------------------------
226
227 procedure process_api
228 (
229 p_document in CLOB
230 ,p_return_status out nocopy VARCHAR2
231 ,p_validate in number default hr_api.g_false_num
232 ,p_effective_date in date default null
233 )
234 IS
235 l_postState VARCHAR2(2);
236 l_return_status VARCHAR2(1);
237 l_object_version_number number;
238 l_commitElement xmldom.DOMElement;
239 l_parser xmlparser.Parser;
240 l_CommitNode xmldom.DOMNode;
241
242 l_proc varchar2(72) := g_package || 'process_offers_api';
243 l_effective_date date := trunc(sysdate);
244
245 BEGIN
246 --
247 hr_utility.set_location(' Entering:' || l_proc,10);
248 hr_utility.set_location(' CLOB --> xmldom.DOMNode:' || l_proc,15);
249 --
250 l_parser := xmlparser.newParser;
251 xmlparser.ParseCLOB(l_parser,p_document);
252 l_CommitNode := xmldom.makeNode(xmldom.getDocumentElement(xmlparser.getDocument(l_parser)));
253 --
254 hr_utility.set_location('Extracting the PostState:' || l_proc,20);
255
256 l_commitElement := xmldom.makeElement(l_CommitNode);
257 l_postState := xmldom.getAttribute(l_commitElement, 'PS');
258 --
259 --Get the values for in/out parameters
260 --
261 l_object_version_number := hr_transaction_swi.getNumberValue(l_CommitNode,'ObjectVersionNumber');
262 --
263 if p_effective_date is null then
264 l_effective_date := trunc(sysdate);
265 else
266 l_effective_date := p_effective_date;
267 end if;
268 --
269 if l_postState = '0' then
270 --
271 hr_utility.set_location('creating :' || l_proc,30);
272 --
273 create_variable_compensation
274 (p_validate => p_validate
275 ,p_effective_date => l_effective_date
276 ,p_vacancy_id => hr_transaction_swi.getNumberValue(l_CommitNode,'VacancyId',NULL)
277 ,p_variable_comp_lookup => hr_transaction_swi.getVarchar2Value(l_CommitNode,'VariableCompLookup',NULL)
278 ,p_object_version_number => l_object_version_number
279 ,p_return_status => l_return_status
280 );
281 --
282 elsif l_postState = '3' then
283 --
284 hr_utility.set_location('deleting :' || l_proc,33);
285 --
286 delete_variable_compensation
287 (p_validate => p_validate
288 ,p_object_version_number => l_object_version_number
289 ,p_vacancy_id => hr_transaction_swi.getNumberValue(l_CommitNode,'VacancyId',NULL)
290 ,p_variable_comp_lookup => hr_transaction_swi.getVarchar2Value(l_CommitNode,'VariableCompLookup',NULL)
291 ,p_return_status => l_return_status
292 );
293 --
294 end if;
295
296 p_return_status := l_return_status;
297
298 hr_utility.set_location
299 ('Exiting :'|| l_proc || ': return status :'|| l_return_status || ':',40);
300
301 end process_api;
302 --
303 end irc_variable_comp_element_swi;