DBA Data[Home] [Help]
Skip to content

PACKAGE BODY: APPS.HR_PER_DEPLYMT_CONTACT_SWI

Source


1 Package Body hr_per_deplymt_contact_swi As
2 /* $Header: hrpdcswi.pkb 120.1 2012/01/20 13:45:57 vepravee ship $ */
3 --
4 -- Package variables
5 --
6 g_package  varchar2(33) := 'hr_per_deplymt_contact_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |----------------------< create_per_deplymt_contact >----------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_per_deplymt_contact
12   (p_validate                     in     number    default hr_api.g_false_num
13   ,p_person_deployment_id         in     number
14   ,p_contact_relationship_id      in     number
15   ,p_per_deplymt_contact_id       in     number
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_per_deplymt_contact_id         number;
27   l_proc    varchar2(72) := g_package ||'create_per_deplymt_contact';
28 Begin
29   hr_utility.set_location(' Entering:' || l_proc,10);
30   --
31   -- Issue a savepoint
32   --
33   savepoint create_per_deplymt_contact_swi;
34   --
35   -- Initialise Multiple Message Detection
36   --
37   hr_multi_message.enable_message_list;
38   --
39   -- Remember IN OUT parameter IN values
40   --
41   --
42   -- Convert constant values to their corresponding boolean value
43   --
44   l_validate :=
45     hr_api.constant_to_boolean
46       (p_constant_value => p_validate);
47   --
48   -- Register Surrogate ID or user key values
49   --
50   hr_pdc_ins.set_base_key_value
51     (p_person_deplymt_contact_id => p_per_deplymt_contact_id
52     );
53   --
54   -- Call API
55   --
56   hr_per_deplymt_contact_api.create_per_deplymt_contact
57     (p_validate                     => l_validate
58     ,p_person_deployment_id         => p_person_deployment_id
59     ,p_contact_relationship_id      => p_contact_relationship_id
60     ,p_per_deplymt_contact_id       => l_per_deplymt_contact_id
61     ,p_object_version_number        => p_object_version_number
62     );
63   --
64   -- Convert API warning boolean parameter values to specific
65   -- messages and add them to Multiple Message List
66   --
67   --
68   -- Convert API non-warning boolean parameter values
69   --
70   --
71   -- Derive the API return status value based on whether
72   -- messages of any type exist in the Multiple Message List.
73   -- Also disable Multiple Message Detection.
74   --
75   p_return_status := hr_multi_message.get_return_status_disable;
76   hr_utility.set_location(' Leaving:' || l_proc,20);
77   --
78 exception
79   when hr_multi_message.error_message_exist then
80     --
81     -- Catch the Multiple Message List exception which
82     -- indicates API processing has been aborted because
83     -- at least one message exists in the list.
84     --
85     rollback to create_per_deplymt_contact_swi;
86     --
87     -- Reset IN OUT parameters and set OUT parameters
88     --
89     p_object_version_number        := null;
90     p_return_status := hr_multi_message.get_return_status_disable;
91     hr_utility.set_location(' Leaving:' || l_proc, 30);
92   when others then
93     --
94     -- When Multiple Message Detection is enabled catch
95     -- any Application specific or other unexpected
96     -- exceptions.  Adding appropriate details to the
97     -- Multiple Message List.  Otherwise re-raise the
98     -- error.
99     --
100     rollback to create_per_deplymt_contact_swi;
101     if hr_multi_message.unexpected_error_add(l_proc) then
102        hr_utility.set_location(' Leaving:' || l_proc,40);
103        raise;
104     end if;
105     --
106     -- Reset IN OUT and set OUT parameters
107     --
108     p_object_version_number        := null;
109     p_return_status := hr_multi_message.get_return_status_disable;
110     hr_utility.set_location(' Leaving:' || l_proc,50);
111 end create_per_deplymt_contact;
112 -- ----------------------------------------------------------------------------
113 -- |----------------------< delete_per_deplymt_contact >----------------------|
114 -- ----------------------------------------------------------------------------
115 PROCEDURE delete_per_deplymt_contact
116   (p_validate                     in     number    default hr_api.g_false_num
117   ,p_per_deplymt_contact_id       in     number
118   ,p_object_version_number        in     number
119   ,p_return_status                   out nocopy varchar2
120   ) is
121   --
122   -- Variables for API Boolean parameters
123   l_validate                      boolean;
124   --
125   -- Variables for IN/OUT parameters
126   --
127   -- Other variables
128   l_proc    varchar2(72) := g_package ||'delete_per_deplymt_contact';
129 Begin
130   hr_utility.set_location(' Entering:' || l_proc,10);
131   --
132   -- Issue a savepoint
133   --
134   savepoint delete_per_deplymt_contact_swi;
135   --
136   -- Initialise Multiple Message Detection
137   --
138   hr_multi_message.enable_message_list;
139   --
140   -- Remember IN OUT parameter IN values
141   --
142   --
143   -- Convert constant values to their corresponding boolean value
144   --
145   l_validate :=
146     hr_api.constant_to_boolean
147       (p_constant_value => p_validate);
148   --
149   -- Register Surrogate ID or user key values
150   --
151   --
152   -- Call API
153   --
154   hr_per_deplymt_contact_api.delete_per_deplymt_contact
155     (p_validate                     => l_validate
156     ,p_per_deplymt_contact_id       => p_per_deplymt_contact_id
157     ,p_object_version_number        => p_object_version_number
158     );
159   --
160   -- Convert API warning boolean parameter values to specific
161   -- messages and add them to Multiple Message List
162   --
163   --
164   -- Convert API non-warning boolean parameter values
165   --
166   --
167   -- Derive the API return status value based on whether
168   -- messages of any type exist in the Multiple Message List.
169   -- Also disable Multiple Message Detection.
170   --
171   p_return_status := hr_multi_message.get_return_status_disable;
172   hr_utility.set_location(' Leaving:' || l_proc,20);
173   --
174 exception
175   when hr_multi_message.error_message_exist then
176     --
177     -- Catch the Multiple Message List exception which
178     -- indicates API processing has been aborted because
179     -- at least one message exists in the list.
180     --
181     rollback to delete_per_deplymt_contact_swi;
182     --
183     -- Reset IN OUT parameters and set OUT parameters
184     --
185     p_return_status := hr_multi_message.get_return_status_disable;
186     hr_utility.set_location(' Leaving:' || l_proc, 30);
187   when others then
188     --
189     -- When Multiple Message Detection is enabled catch
190     -- any Application specific or other unexpected
191     -- exceptions.  Adding appropriate details to the
192     -- Multiple Message List.  Otherwise re-raise the
193     -- error.
194     --
195     rollback to delete_per_deplymt_contact_swi;
196     if hr_multi_message.unexpected_error_add(l_proc) then
197        hr_utility.set_location(' Leaving:' || l_proc,40);
198        raise;
199     end if;
200     --
201     -- Reset IN OUT and set OUT parameters
202     --
203     p_return_status := hr_multi_message.get_return_status_disable;
204     hr_utility.set_location(' Leaving:' || l_proc,50);
205 end delete_per_deplymt_contact;
206 
207 
208 Procedure process_api
209 ( p_document            in         CLOB
210  ,p_return_status       out nocopy VARCHAR2
211  ,p_validate            in         number    default hr_api.g_false_num
212  ,p_effective_date      in         date      default null
213 )
214 IS
215    l_postState VARCHAR2(2);
216    l_return_status VARCHAR2(1);
217    l_commitElement xmldom.DOMElement;
218    l_object_version_number number;
219    l_parser xmlparser.Parser;
220    l_CommitNode xmldom.DOMNode;
221    l_proc    varchar2(72) := g_package || 'process_api';
222 
223     l_occurrence number;
224     lv_action varchar2(30);
225 
226 BEGIN
227    --hr_utility.trace_on(null,'ORCLE');
228    hr_utility.set_location(' Entering:' || l_proc,10);
229    hr_utility.set_location(' CLOB --> xmldom.DOMNode:' || l_proc,15);
230  savepoint deployment_process_api;
231    l_parser      := xmlparser.newParser;
232    xmlparser.ParseCLOB(l_parser,p_document);
233    l_CommitNode  := xmldom.makeNode(xmldom.getDocumentElement(xmlparser.getDocument(l_parser)));
234 
235    hr_utility.set_location('Extracting the PostState:' || l_proc,20);
236 
237    l_commitElement := xmldom.makeElement(l_CommitNode);
238    l_postState := xmldom.getAttribute(l_commitElement, 'PS');
239 
240 
241 
242    create_per_deplymt_contact
243 (p_validate                     => p_validate
244   ,p_person_deployment_id         => hr_transaction_swi.getvarchar2value(l_commitnode,'PersonDeploymentId',null)
245   ,p_contact_relationship_id         => hr_transaction_swi.getvarchar2value(l_commitnode,'ContactRelationshipId',null)
246   ,p_per_deplymt_contact_id         => hr_transaction_swi.getvarchar2value(l_commitnode,'PersonDeplymtContactId',null)
247     ,p_object_version_number        => l_object_version_number
248     ,p_return_status                => l_return_status);
249 
250 
251   p_return_status := l_return_status;
252 	hr_utility.set_location( l_proc||'p_return_status = '||p_return_status,38);
253    hr_utility.set_location('Exiting:' || l_proc,40);
254 EXCEPTION
255   WHEN OTHERS THEN
256     rollback to deployment_process_api;
257     hr_utility.trace('Exception in .process_api:' || SQLERRM );
258     hr_utility.set_location(' Leaving:' || l_proc,50);
259 
260     raise;
261 
262 END process_api;
263 
264 end hr_per_deplymt_contact_swi;