DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_DE_VLDDEF_API

Source


1 Package Body PQH_DE_VLDDEF_API as
2 /* $Header: pqdefapi.pkb 115.1 2002/12/09 22:40:19 rpasapul noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'PQH_DE_VLDDEF_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< Insert_Vldtn_Defn >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure Insert_Vldtn_Defn
13   (p_validate                      in  boolean  default false
14   ,p_effective_date                in  date
15   ,p_business_group_id             in  number
16   ,p_VALIDATION_NAME               In  Varchar2
17   ,p_EMPLOYMENT_TYPE               In  Varchar2
18   ,p_REMUNERATION_REGULATION       In  Varchar2
19   ,p_WRKPLC_VLDTN_ID               out nocopy number
20   ,p_object_version_number         out nocopy number) is
21   --
22   -- Declare cursors and local variables
23   --
24 
25   l_proc  varchar2(72)    := g_package||'Insert_Vldtn_Defn';
26   l_object_Version_Number PQH_DE_WRKPLC_VLDTNs.OBJECT_VERSION_NUMBER%TYPE;
27   L_Effective_Date        Date;
28   l_Wrkplc_vldtn_id       PQH_DE_WRKPLC_VLDTNS.WRKPLC_VLDTN_ID%TYPE;
29 
30 begin
31   hr_utility.set_location('Entering:'|| l_proc, 10);
32   --
33   -- Issue a savepoint
34   --
35   savepoint Insert_Vldtn_Defn;
36   --
37   -- Truncate the time portion from all IN date parameters
38   --
39      l_effective_date := Trunc(p_effective_Date);
40   --
41   -- Call Before Process User Hook
42   --
43   begin
44     PQH_DE_VLDDEF_BK1.Insert_Vldtn_Defn_b
45       (p_effective_date           => l_effective_date
46       ,p_business_group_id        => p_business_group_Id
47       ,p_VALIDATION_NAME          => p_VALIDATION_NAME
48       ,p_EMPLOYMENT_TYPE          => p_EMPLOYMENT_TYPE
49       ,p_REMUNERATION_REGULATION  => p_REMUNERATION_REGULATION);
50 
51   exception
52     when hr_api.cannot_find_prog_unit then
53       hr_api.cannot_find_prog_unit_error
54         (p_module_name => 'Insert_Vldtn_Defn'
55         ,p_hook_type   => 'BP'
56         );
57   end;
58   --
59   -- Validation in addition to Row Handlers
60   --
61   --
62   -- Process Logic
63      pqh_def_ins.ins
64      (p_effective_date            => l_effective_date
65      ,p_business_group_id         => p_business_group_id
66      ,p_VALIDATION_NAME           => p_VALIDATION_NAME
67      ,p_EMPLOYMENT_TYPE           => p_EMPLOYMENT_TYPE
68      ,p_REMUNERATION_REGULATION   => p_remuneration_Regulation
69      ,p_WRKPLC_VLDTN_ID           => l_Wrkplc_Vldtn_id
70      ,p_object_version_number     => l_object_version_Number);
71   --
72   -- Call After Process User Hook
73   --
74   begin
75   PQH_DE_VLDDEF_BK1.Insert_Vldtn_Defn_a
76   (p_effective_date               => l_effective_date
77   ,p_business_group_id            => p_business_group_id
78   ,p_VALIDATION_NAME              => p_VALIDATION_NAME
79   ,p_EMPLOYMENT_TYPE              => p_EMPLOYMENT_TYPE
80   ,p_REMUNERATION_REGULATION      => p_REMUNERATION_REGULATION
81   ,p_WRKPLC_VLDTN_ID              => l_WRKPLC_VLDTN_ID
82   ,p_object_version_number        => l_object_version_Number);
83 
84   exception
85     when hr_api.cannot_find_prog_unit then
86       hr_api.cannot_find_prog_unit_error
87         (p_module_name => 'Insert_Vldtn_Defn'
88         ,p_hook_type   => 'AP'
89         );
90   end;
91   --
92   -- When in validation only mode raise the Validate_Enabled exception
93   --
94   if p_validate then
95     raise hr_api.validate_enabled;
96   end if;
97   --
98   -- Set all output arguments
99   --
100   p_wrkplc_vldtn_id        := l_Wrkplc_vldtn_id;
101   p_object_version_number  := l_object_version_number;
102 
103   --
104   hr_utility.set_location(' Leaving:'||l_proc, 70);
105 exception
106   when hr_api.validate_enabled then
107     --
108     -- As the Validate_Enabled exception has been raised
109     -- we must rollback to the savepoint
110     --
111     rollback to Insert_Vldtn_Defn;
112     --
113     -- Only set output warning arguments
114     -- (Any key or derived arguments must be set to null
115     -- when validation only mode is being used.)
116     --
117     p_wrkplc_vldtn_id        := null;
118     p_object_version_number  := null;
119     hr_utility.set_location(' Leaving:'||l_proc, 80);
120 
121   when others then
122       p_wrkplc_vldtn_id        := null;
123     p_object_version_number  := null;
124     --
125     -- A validation or unexpected error has occured
126     --
127     rollback to Insert_Vldtn_Defn;
128     hr_utility.set_location(' Leaving:'||l_proc, 90);
129     raise;
130 end Insert_Vldtn_Defn;
131 
132 --
133 -- ----------------------------------------------------------------------------
134 -- |--------------------------< Update_Vldtn_Defn >--------------------------|
135 -- ----------------------------------------------------------------------------
136 
137 procedure Update_Vldtn_Defn
138   (p_validate                      in     boolean  default false
139   ,p_effective_date                in     date
140   ,p_business_group_id             in     number   Default hr_api.g_Number
141   ,p_VALIDATION_NAME               In     Varchar2 Default hr_api.g_Varchar2
142   ,p_EMPLOYMENT_TYPE               In     Varchar2 Default hr_api.g_Varchar2
143   ,p_REMUNERATION_REGULATION       In     Varchar2 Default hr_api.g_Varchar2
144   ,p_WRKPLC_VLDTN_ID               In     number
145   ,p_object_version_number         In out nocopy number) Is
146 
147   l_proc  varchar2(72)    := g_package||'Update_Vldtn_Defn';
148   l_object_Version_Number PQH_DE_WRKPLC_VLDTNs.OBJECT_VERSION_NUMBER%TYPE := P_Object_version_Number;
149   L_Effective_Date        Date;
150 
151 Begin
152   hr_utility.set_location('Entering:'|| l_proc, 10);
153   --
154   -- Issue a savepoint
155   --
156   savepoint Update_Vldtn_Defn;
157   --
158   -- Truncate the time portion from all IN date parameters
159   --
160      l_effective_date := Trunc(p_effective_Date);
161   --
162   -- Call Before Process User Hook
163   --
164   begin
165 
166   PQH_DE_VLDDEF_BK2.Update_Vldtn_Defn_b
167   (p_effective_date              => l_effective_date
168   ,p_business_group_id           => p_business_group_id
169   ,p_VALIDATION_NAME             => p_Validation_name
170   ,p_EMPLOYMENT_TYPE             => P_employment_type
171   ,p_REMUNERATION_REGULATION     => p_remuneration_Regulation
172   ,p_WRKPLC_VLDTN_ID             => p_Wrkplc_vldtn_id
173   ,p_object_version_number       => l_Object_Version_number);
174   exception
175     when hr_api.cannot_find_prog_unit then
176       hr_api.cannot_find_prog_unit_error
177         (p_module_name => 'Update_Vldtn_Defn'
178         ,p_hook_type   => 'BP'
179         );
180   end;
181 
182   pqh_def_upd.upd
183   (p_effective_date               => L_effective_date
184   ,p_wrkplc_vldtn_id              => P_wrkplc_Vldtn_id
185   ,p_validation_name              => p_validation_name
186   ,p_business_group_id            => p_business_group_id
187   ,p_employment_type              => p_employment_type
188   ,p_remuneration_regulation      => p_remuneration_regulation
189   ,p_object_version_number        => l_object_version_number);
190 
191 --
192 --
193   -- Call After Process User Hook
194   --
195   begin
196   PQH_DE_VLDDEF_BK2.Update_Vldtn_Defn_a
197   (p_effective_date              => l_effective_date
198   ,p_business_group_id           => p_business_group_id
199   ,p_VALIDATION_NAME             => p_VALIDATION_NAME
200   ,p_EMPLOYMENT_TYPE             => p_EMPLOYMENT_TYPE
201   ,p_REMUNERATION_REGULATION     => p_REMUNERATION_REGULATION
202   ,p_WRKPLC_VLDTN_ID             => p_WRKPLC_VLDTN_ID
203   ,p_object_version_number       => l_Object_Version_Number);
204 
205 
206   exception
207     when hr_api.cannot_find_prog_unit then
208       hr_api.cannot_find_prog_unit_error
209         (p_module_name => 'Update_Vldtn_Defn'
210         ,p_hook_type   => 'AP'
211         );
212   end;
213   --
214   -- When in validation only mode raise the Validate_Enabled exception
215   --
216   if p_validate then
217     raise hr_api.validate_enabled;
218   end if;
219   --
220   -- Set all output arguments
221   --
222 
223   p_object_version_number  := l_object_version_number;
224 
225   --
226   hr_utility.set_location(' Leaving:'||l_proc, 70);
227 exception
228   when hr_api.validate_enabled then
229     --
230     -- As the Validate_Enabled exception has been raised
231     -- we must rollback to the savepoint
232     --
233     rollback to Update_Vldtn_Defn;
234     --
235     -- Only set output warning arguments
236     -- (Any key or derived arguments must be set to null
237     -- when validation only mode is being used.)
238     --
239     hr_utility.set_location(' Leaving:'||l_proc, 80);
240 
241   when others then
242     p_object_version_number  := l_object_version_number;
243     --
244     -- A validation or unexpected error has occured
245     --
246     rollback to Update_Vldtn_Defn;
247     hr_utility.set_location(' Leaving:'||l_proc, 90);
248     raise;
249 end Update_Vldtn_Defn;
250 
251 --
252 -- ----------------------------------------------------------------------------
253 -- |-------------------< delete_Vldtn_Defn>------------------------------|
254 -- ----------------------------------------------------------------------------
255 procedure delete_Vldtn_Defn
256   (p_validate                      in     boolean  default false
257   ,p_WRKPLC_VLDTN_ID               In     Number
258   ,p_object_version_number         In     number) Is   --
259 
260   -- Declare cursors and local variables
261   --
262   l_proc           varchar2(72) := g_package||'delete_Vldtn_Defn';
263   --
264 begin
265   hr_utility.set_location('Entering:'|| l_proc, 10);
266   --
267   -- Issue a savepoint
268   --
269   savepoint delete_Vldtn_Defn;
270   --
271   -- Call Before Process User Hook
272   --
273   begin
274   PQH_DE_VLDDEF_BK3.Delete_Vldtn_Defn_b
275   (p_WRKPLC_VLDTN_ID               =>   p_WRKPLC_VLDTN_ID
276   ,p_object_version_number         =>   p_object_version_number);
277   exception
278     when hr_api.cannot_find_prog_unit then
279       hr_api.cannot_find_prog_unit_error
280         (p_module_name => 'delete_Vldtn_Defn'
281         ,p_hook_type   => 'BP');
282   end;
283   --
284   -- Process Logic
285   --
286   pqh_def_del.del
287     (p_WRKPLC_VLDTN_ID               =>  p_WRKPLC_VLDTN_ID
288     ,p_object_version_number         =>  p_object_version_number);
289   --
290   -- Call After Process User Hook
291   --
292   begin
293 
294    PQH_DE_VLDDEF_BK3.Delete_Vldtn_Defn_a
295   (p_WRKPLC_VLDTN_ID                => p_WRKPLC_VLDTN_ID
296   ,p_object_version_number          => p_object_version_number);
297 
298   exception
299     when hr_api.cannot_find_prog_unit then
300       hr_api.cannot_find_prog_unit_error
301         (p_module_name => 'delete_Vldtn_Defn'
302         ,p_hook_type   => 'AP');
303   end;
304   --
305   -- When in validation only mode raise the Validate_Enabled exception
306   --
307   if p_validate then
308     raise hr_api.validate_enabled;
309   end if;
310   --
311   -- Set all output arguments
312   --
313   hr_utility.set_location(' Leaving:'||l_proc, 70);
314 exception
315   when hr_api.validate_enabled then
316     --
317     -- As the Validate_Enabled exception has been raised
318     -- we must rollback to the savepoint
319     --
320     rollback to delete_Vldtn_Defn;
321     --
322     -- Only set output warning arguments
323     -- (Any key or derived arguments must be set to null
324     -- when validation only mode is being used.)
325     --
326     hr_utility.set_location(' Leaving:'||l_proc, 80);
327   when others then
328     --
329     -- A validation or unexpected error has occured
330     --
331     rollback to delete_Vldtn_Defn;
332     hr_utility.set_location(' Leaving:'||l_proc, 90);
333     raise;
334 end delete_Vldtn_Defn;
335 
336 end PQH_DE_VLDDEF_API;