DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AU_PROCESSES_API

Source


1 Package Body pay_au_processes_api as
2 /* $Header: pyaprapi.pkb 120.0 2005/05/29 02:58 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33);
7 --
8 -- ------------------------------------------------------------------------
9 -- |--------------------------< create_au_process >------------------------|
10 -- ------------------------------------------------------------------------
11 --
12 procedure create_au_process
13   (p_validate                      in      boolean  default false,
14    p_short_name                    in      varchar2,
15    p_name                          in      varchar2,
16    p_enabled_flag                  in      varchar2,
17    p_business_group_id             in      number,
18    p_legislation_code              IN      varchar2,
19    p_description                   IN      varchar2,
20    p_accrual_category              IN      varchar2,
21    p_process_id                    out nocopy number,
22    p_object_version_number         out nocopy number)  is
23   --
24   -- Declare cursors and local variables
25   --
26   --
27   -- Out variables
28   --
29   l_process_id                 pay_au_processes.process_id%TYPE;
30   l_object_version_number      pay_au_processes.object_version_number%TYPE;
31   --
32   l_proc                       varchar2(72);
33   --
34   -- Declare a cursor that will check whether the passed
35   -- in short_name, business_group_id and legislation_code or
36   -- name, business_group_id and legislation_code for a unique
37   -- combination
38   --
39   cursor csr_valid_combo is
40   select process_id from pay_au_processes pap
41   where  pap.legislation_code = p_legislation_code
42   and    (pap.business_group_id is null
43           or pap.business_group_id = p_business_group_id)
44   and    (pap.short_name = p_short_name
45           or pap.name = p_name);
46   --
47 begin
48   l_proc      := g_package||'create_au_process';
49   --
50   hr_utility.set_location('Entering:'|| l_proc, 5);
51   --
52   -- Issue a savepoint if operating in validation only mode.
53   --
54   if p_validate then
55     savepoint create_au_process;
56   end if;
57   --
58   hr_utility.set_location(l_proc, 10);
59   --
60   -- Validation in addition to Table Handlers
61   --
62   -- Process Logic
63   --
64   --------------------------------------------------------
65   -- Check for unique short name,business_group_id and
66   -- legislation_code combo --
67   --------------------------------------------------------
68      open csr_valid_combo;
69      fetch csr_valid_combo into l_process_id;
70 
71      -- If the process does not exist then create it.
72      -- Do not error if the process does exist, simply return.
73      --
74      if csr_valid_combo%notfound then
75         --
76         -- Insert the process.
77         --
78            pay_apr_ins.ins
79            (
80             p_process_id                   => l_process_id,
81             p_short_name                   => p_short_name,
82             p_name                         => p_name,
83             p_enabled_flag                 => p_enabled_flag,
84             p_business_group_id            => p_business_group_id,
85             p_legislation_code             => p_legislation_code,
86             p_description                  => p_description,
87             p_accrual_category             => p_accrual_category,
88             p_object_version_number        => l_object_version_number
89            );
90      end if;
91      close csr_valid_combo;
92   --
93   hr_utility.set_location(l_proc, 20);
94   --
95   -- When in validation only mode raise the Validate_Enabled exception
96   --
97   if p_validate then
98     raise hr_api.validate_enabled;
99   end if;
100   --
101   -- Set all output arguments
102   --
103   p_process_id := l_process_id;
104   p_object_version_number := l_object_version_number;
105   --
106   hr_utility.set_location(' Leaving:'||l_proc, 100);
107 exception
108   when hr_api.validate_enabled then
109     --
110     -- Only set output warning arguments
111     -- (Any key or derived arguments must be set to null
112     -- when validation only mode is being used.)
113     --
114     p_process_id  := null;
115     --
116     -- As the Validate_Enabled exception has been raised
117     -- we must rollback to the savepoint
118     --
119     ROLLBACK TO create_au_process;
120     --
121 end create_au_process;
122 --
123 -- ------------------------------------------------------------------------
124 -- |--------------------------< delete_au_process >------------------------|
125 -- ------------------------------------------------------------------------
126 --
127 procedure delete_au_process
128   (p_validate                      in      boolean  default false,
129    p_process_id                    in      number,
130    p_object_version_number         in      number)  is
131   --
132   l_proc                       varchar2(72);
133   --
134 begin
135   l_proc                       := g_package||'delete_au_process';
136   --
137   hr_utility.set_location('Entering:'|| l_proc, 5);
138   --
139   -- Issue a savepoint if operating in validation only mode.
140   --
141   if p_validate then
142     savepoint delete_au_process;
143   end if;
144   --
145   hr_utility.set_location(l_proc, 10);
146   --
147   -- Validation in addition to Table Handlers
148   --
149   -- None required.
150   --
151   -- Process Logic
152   --
153     pay_apr_del.del
154       (p_process_id                => p_process_id,
155        p_object_version_number     => p_object_version_number);
156   --
157   hr_utility.set_location(l_proc, 20);
158   --
159   -- When in validation only mode raise the Validate_Enabled exception
160   --
161   if p_validate then
162     raise hr_api.validate_enabled;
163   end if;
164   --
165   hr_utility.set_location(' Leaving:'||l_proc, 100);
166 exception
167   when hr_api.validate_enabled then
168     --
169     -- As the Validate_Enabled exception has been raised
170     -- we must rollback to the savepoint
171     --
172     ROLLBACK TO delete_au_process;
173 end delete_au_process;
174 --
175 --
176 -- ------------------------------------------------------------------------
177 -- |--------------------------< update_au_process >-----------------------|
178 -- ------------------------------------------------------------------------
179 --
180 procedure update_au_process
181   (p_validate                      in      boolean  default false,
182    p_process_id                    in      number,
183    p_short_name                    in      varchar2,
184    p_name                          in      varchar2,
185    p_enabled_flag                  in      varchar2,
186    p_business_group_id             in      number,
187    p_legislation_code              in      varchar2,
188    p_description                   in      varchar2,
189    p_accrual_category              in      varchar2,
190    p_object_version_number         in out  nocopy   number
191   )  is
192   --
193   l_proc                       varchar2(72);
194   --
195 begin
196   l_proc := g_package||'update_au_process';
197   hr_utility.set_location('Entering:'|| l_proc, 5);
198   --
199   -- Issue a savepoint if operating in validation only mode.
200   --
201   if p_validate then
202     savepoint update_au_process;
203   end if;
204   --
205   hr_utility.set_location(l_proc, 10);
206   --
207   -- Validation in addition to Table Handlers
208   --
209   -- None required.
210   --
211   -- Process Logic
212   --
213     pay_apr_upd.upd
214       (p_process_id                   => p_process_id,
215        p_object_version_number        => p_object_version_number,
216        p_short_name                   => p_short_name,
217        p_name                         => p_name,
218        p_enabled_flag                 => p_enabled_flag,
219        p_business_group_id            => p_business_group_id,
220        p_legislation_code             => p_legislation_code,
221        p_description                  => p_description,
222        p_accrual_category             => p_accrual_category
223        );
224   --
225   hr_utility.set_location(l_proc, 20);
226   --
227   -- When in validation only mode raise the Validate_Enabled exception
228   --
229   if p_validate then
230     raise hr_api.validate_enabled;
231   end if;
232   --
233   hr_utility.set_location(' Leaving:'||l_proc, 100);
234 exception
235   when hr_api.validate_enabled then
236     --
237     -- As the Validate_Enabled exception has been raised
238     -- we must rollback to the savepoint
239     --
240     ROLLBACK TO update_au_process;
241 end update_au_process;
242 --
243 --
244 begin
245   g_package  := '  pay_au_processes_api.';
246 end pay_au_processes_api;