[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 2006/03/13 02:37:38 cnholmes noship $ */
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 -- Variables for API Boolean parameters
120 l_validate boolean;
121 --
122 -- Variables for IN/OUT parameters
123 --
124 -- Other variables
125 l_proc varchar2(72) := g_package ||'delete_variable_compensation';
126 Begin
127 hr_utility.set_location(' Entering:' || l_proc,10);
128 --
129 -- Issue a savepoint
130 --
131 savepoint delete_variable_comp_swi;
132 --
133 -- Initialise Multiple Message Detection
134 --
135 hr_multi_message.enable_message_list;
136 --
137 -- Remember IN OUT parameter IN values
138 --
139 --
140 -- Convert constant values to their corresponding boolean value
141 --
142 l_validate :=
143 hr_api.constant_to_boolean
144 (p_constant_value => p_validate);
145 --
146 -- Register Surrogate ID or user key values
147 --
148 --
149 -- Call API
150 --
151 irc_variable_comp_element_api.delete_variable_compensation
152 (p_validate => l_validate
153 ,p_vacancy_id => p_vacancy_id
154 ,p_variable_comp_lookup => p_variable_comp_lookup
155 ,p_object_version_number => p_object_version_number
156 );
157 --
158 -- Convert API warning boolean parameter values to specific
159 -- messages and add them to Multiple Message List
160 --
161 --
162 -- Convert API non-warning boolean parameter values
163 --
164 --
165 -- Derive the API return status value based on whether
166 -- messages of any type exist in the Multiple Message List.
167 -- Also disable Multiple Message Detection.
168 --
169 p_return_status := hr_multi_message.get_return_status_disable;
170 hr_utility.set_location(' Leaving:' || l_proc,20);
171 --
172 exception
173 when hr_multi_message.error_message_exist then
174 --
175 -- Catch the Multiple Message List exception which
176 -- indicates API processing has been aborted because
177 -- at least one error message exists in the list.
178 --
179 rollback to delete_variable_comp_swi;
180 --
181 -- Reset IN OUT paramters and set OUT parameters
182 --
183 p_return_status := hr_multi_message.get_return_status_disable;
184 hr_utility.set_location(' Leaving:' || l_proc,30);
185 when others then
186 --
187 -- When Multiple Message Detection is enabled catch
188 -- any Application specific or other unexpected
189 -- exceptions. Adding appropriate details to the
190 -- Multiple Message List. Otherwise re-raise
191 -- the error.
192 --
193 rollback to delete_variable_comp_swi;
194 if hr_multi_message.unexpected_error_add(l_proc) then
195 hr_utility.set_location(' Leaving:' || l_proc, 40);
196 raise;
197 end if;
198 --
199 -- Reset IN OUT parameters and set OUT parameters
200 --
201 p_return_status := hr_multi_message.get_return_status_disable;
202 hr_utility.set_location(' Leaving: ' || l_proc, 50);
203 end delete_variable_compensation;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |----------------------------< process_api >-------------------------------|
207 -- ----------------------------------------------------------------------------
208
209 procedure process_api
210 (
211 p_document in CLOB
212 ,p_return_status out nocopy VARCHAR2
213 ,p_validate in number default hr_api.g_false_num
214 ,p_effective_date in date default null
215 )
216 IS
217 l_postState VARCHAR2(2);
218 l_return_status VARCHAR2(1);
219 l_object_version_number number;
220 l_commitElement xmldom.DOMElement;
221 l_parser xmlparser.Parser;
222 l_CommitNode xmldom.DOMNode;
223
224 l_proc varchar2(72) := g_package || 'process_offers_api';
225 l_effective_date date := trunc(sysdate);
226
227 BEGIN
228 --
229 hr_utility.set_location(' Entering:' || l_proc,10);
230 hr_utility.set_location(' CLOB --> xmldom.DOMNode:' || l_proc,15);
231 --
232 l_parser := xmlparser.newParser;
233 xmlparser.ParseCLOB(l_parser,p_document);
234 l_CommitNode := xmldom.makeNode(xmldom.getDocumentElement(xmlparser.getDocument(l_parser)));
235 --
236 hr_utility.set_location('Extracting the PostState:' || l_proc,20);
237
238 l_commitElement := xmldom.makeElement(l_CommitNode);
239 l_postState := xmldom.getAttribute(l_commitElement, 'PS');
240 --
241 --Get the values for in/out parameters
242 --
243 l_object_version_number := hr_transaction_swi.getNumberValue(l_CommitNode,'ObjectVersionNumber');
244 --
245 if p_effective_date is null then
246 l_effective_date := trunc(sysdate);
247 else
248 l_effective_date := p_effective_date;
249 end if;
250 --
251 if l_postState = '0' then
252 --
253 hr_utility.set_location('creating :' || l_proc,30);
254 --
255 create_variable_compensation
256 (p_validate => p_validate
257 ,p_effective_date => l_effective_date
258 ,p_vacancy_id => hr_transaction_swi.getNumberValue(l_CommitNode,'VacancyId',NULL)
259 ,p_variable_comp_lookup => hr_transaction_swi.getVarchar2Value(l_CommitNode,'VariableCompLookup',NULL)
260 ,p_object_version_number => l_object_version_number
261 ,p_return_status => l_return_status
262 );
263 --
264 elsif l_postState = '3' then
265 --
266 hr_utility.set_location('deleting :' || l_proc,33);
267 --
268 delete_variable_compensation
269 (p_validate => p_validate
270 ,p_object_version_number => l_object_version_number
271 ,p_vacancy_id => hr_transaction_swi.getNumberValue(l_CommitNode,'VacancyId',NULL)
272 ,p_variable_comp_lookup => hr_transaction_swi.getVarchar2Value(l_CommitNode,'VariableCompLookup',NULL)
273 ,p_return_status => l_return_status
274 );
275 --
276 end if;
277
278 p_return_status := l_return_status;
279
280 hr_utility.set_location
281 ('Exiting :'|| l_proc || ': return status :'|| l_return_status || ':',40);
282
283 end process_api;
284 --
285 end irc_variable_comp_element_swi;