DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PER_DEPLYMT_CONTACT_API

Source


1 Package Body HR_PER_DEPLYMT_CONTACT_API as
2 /* $Header: hrpdcapi.pkb 120.0 2005/09/23 06:45:04 adhunter noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  HR_PER_DEPLYMT_CONTACT_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_per_deplymt_contact >------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_per_deplymt_contact
13   (p_validate                         in     boolean  default false
14   ,p_person_deployment_id             in     number
15   ,p_contact_relationship_id          in     number
16   ,p_per_deplymt_contact_id              out nocopy   number
17   ,p_object_version_number               out nocopy   number
18   ) is
19   --
20   -- Declare cursors and local variables
21   --
22   l_per_deplymt_contact_id    number;
23   l_object_version_number number;
24   l_proc                varchar2(72) := g_package||'create_per_deplymt_contact';
25 begin
26   hr_utility.set_location('Entering:'|| l_proc, 10);
27   --
28   -- Issue a savepoint
29   --
30   savepoint create_per_deplymt_contact;
31   --
32   -- Remember IN OUT parameter IN values
33   --
34   --
35   -- Truncate the time portion from all IN date parameters
36   --
37   --
38   -- Call Before Process User Hook
39   --
40   begin
41     hr_per_deplymt_contact_bk1.create_per_deplymt_contact_b
42       (p_person_deployment_id          => p_person_deployment_id
43       ,p_contact_relationship_id          => p_contact_relationship_id
44       );
45   exception
46     when hr_api.cannot_find_prog_unit then
47       hr_api.cannot_find_prog_unit_error
48         (p_module_name => 'CREATE_PER_DEPLYMT_CONTACT'
49         ,p_hook_type   => 'BP'
50         );
51   end;
52   --
53   -- Validation in addition to Row Handlers
54   --
55 
56   --
57   -- Process Logic
58   --
59   hr_pdc_ins.ins
60      (p_person_deployment_id           => p_person_deployment_id
61      ,p_contact_relationship_id        => p_contact_relationship_id
62      ,p_person_deplymt_contact_id      => l_per_deplymt_contact_id
63      ,p_object_version_number          => l_object_version_number
64      );
65   --
66   -- Call After Process User Hook
67   --
68   begin
69     hr_per_deplymt_contact_bk1.create_per_deplymt_contact_a
70       (p_person_deployment_id          => p_person_deployment_id
71       ,p_contact_relationship_id       => p_contact_relationship_id
72       ,p_per_deplymt_contact_id        => l_per_deplymt_contact_id
73       ,p_object_version_number         => l_object_version_number
74       );
75   exception
76     when hr_api.cannot_find_prog_unit then
77       hr_api.cannot_find_prog_unit_error
78         (p_module_name => 'CREATE_PER_DEPLYMT_CONTACT'
79         ,p_hook_type   => 'AP'
80         );
81   end;
82   --
83   -- When in validation only mode raise the Validate_Enabled exception
84   --
85   if p_validate then
86     raise hr_api.validate_enabled;
87   end if;
88   --
89   -- Set all IN OUT and OUT parameters with out values
90   --
91   p_per_deplymt_contact_id := l_per_deplymt_contact_id;
92   p_object_version_number  := l_object_version_number;
93   --
94   hr_utility.set_location(' Leaving:'||l_proc, 70);
95 exception
96   when hr_api.validate_enabled then
97     --
98     -- As the Validate_Enabled exception has been raised
99     -- we must rollback to the savepoint
100     --
101     rollback to create_per_deplymt_contact;
102     --
103     -- Reset IN OUT parameters and set OUT parameters
104     -- (Any key or derived arguments must be set to null
105     -- when validation only mode is being used.)
106     --
107     p_per_deplymt_contact_id := null;
108     p_object_version_number  := null;
109     hr_utility.set_location(' Leaving:'||l_proc, 80);
110   when others then
111     --
112     -- A validation or unexpected error has occured
113     --
114     rollback to create_per_deplymt_contact;
115     --
116     -- Reset IN OUT parameters and set all
117     -- OUT parameters, including warnings, to null
118     --
119     p_per_deplymt_contact_id := null;
120     p_object_version_number  := null;
121     hr_utility.set_location(' Leaving:'||l_proc, 90);
122     raise;
123 end CREATE_PER_DEPLYMT_CONTACT;
124 --
125 --
126 -- ----------------------------------------------------------------------------
127 -- |--------------------------< delete_per_deplymt_contact >------------------|
128 -- ----------------------------------------------------------------------------
129 --
130 procedure delete_per_deplymt_contact
131   (p_validate                      in     boolean  default false
132   ,p_per_deplymt_contact_id        in     number
133   ,p_object_version_number         in     number
134   ) is
135   --
136   -- Declare cursors and local variables
137   --
138   l_proc                varchar2(72) := g_package||'delete_per_deplymt_contact';
139 begin
140   hr_utility.set_location('Entering:'|| l_proc, 10);
141   --
142   -- Issue a savepoint
143   --
144   savepoint delete_per_deplymt_contact;
145   --
146   -- Remember IN OUT parameter IN values
147   --
148   --
149   -- Truncate the time portion from all IN date parameters
150   --
151   --
152   -- Call Before Process User Hook
153   --
154   begin
155     hr_per_deplymt_contact_bk2.delete_per_deplymt_contact_b
156       (p_per_deplymt_contact_id         => p_per_deplymt_contact_id
157       ,p_object_version_number          => p_object_version_number
158       );
159   exception
160     when hr_api.cannot_find_prog_unit then
161       hr_api.cannot_find_prog_unit_error
162         (p_module_name => 'DELETE_PER_DEPLYMT_CONTACT'
163         ,p_hook_type   => 'BP'
164         );
165   end;
166   --
167   -- Validation in addition to Row Handlers
168   --
169 
170   --
171   -- Process Logic
172   --
173   hr_pdc_del.del
174      (p_person_deplymt_contact_id      => p_per_deplymt_contact_id
175      ,p_object_version_number          => p_object_version_number
176      );
177   --
178   -- Call After Process User Hook
179   --
180   begin
181     hr_per_deplymt_contact_bk2.delete_per_deplymt_contact_a
182       (p_per_deplymt_contact_id         => p_per_deplymt_contact_id
183       ,p_object_version_number          => p_object_version_number
184       );
185   exception
186     when hr_api.cannot_find_prog_unit then
187       hr_api.cannot_find_prog_unit_error
188         (p_module_name => 'DELETE_PER_DEPLYMT_CONTACT'
189         ,p_hook_type   => 'AP'
190         );
191   end;
192   --
193   -- When in validation only mode raise the Validate_Enabled exception
194   --
195   if p_validate then
196     raise hr_api.validate_enabled;
197   end if;
198   --
199   -- Set all IN OUT and OUT parameters with out values
200   --
201   --
202   hr_utility.set_location(' Leaving:'||l_proc, 70);
203 exception
204   when hr_api.validate_enabled then
205     --
206     -- As the Validate_Enabled exception has been raised
207     -- we must rollback to the savepoint
208     --
209     rollback to delete_per_deplymt_contact;
210     --
211     -- Reset IN OUT parameters and set OUT parameters
212     -- (Any key or derived arguments must be set to null
213     -- when validation only mode is being used.)
214     --
215     hr_utility.set_location(' Leaving:'||l_proc, 80);
216   when others then
217     --
218     -- A validation or unexpected error has occured
219     --
220     rollback to delete_per_deplymt_contact;
221     --
222     -- Reset IN OUT parameters and set all
223     -- OUT parameters, including warnings, to null
224     --
225     hr_utility.set_location(' Leaving:'||l_proc, 90);
226     raise;
227 end DELETE_PER_DEPLYMT_CONTACT;
228 --
229 end HR_PER_DEPLYMT_CONTACT_API;