DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_HIERARCHY_ELEMENT_INTERNAL

Source


1 Package Body hr_hierarchy_element_internal as
2 /* $Header: peosebsi.pkb 115.4 2002/12/06 16:21:21 pkakar noship $ */
3 
4 g_package varchar2(30) := 'hr_hierarchy_element_internal';
5 --
6 -- ----------------------------------------------------------------------------
7 -- |----------------<  create_hier_element_internal >-------------------------|
8 -- ----------------------------------------------------------------------------
9 -- {Start Of Comments}
10 --
11 -- Description:
12 --   This business support process calls the business process to creates a
13 --   new parent-child element in an organization hierarchy. When called from
14 --   here, p_validate is always set to false.
15 --
16 -- Prerequisites:
17 --   Parent Organization must be active from the Hierarchy Version date
18 --
19 -- In Parameters:
20 --  Name                           Reqd Type     Description
21 --
22 --  p_organization_id_parent       yes  number   fk to hr_all_organization_units
23 --  p_org_structure_version_id     yes  number   fk to per_org_structure_versions
24 --  p_organization_id_child        yes  number   fk to hr_all_organization_units
25 --  p_business_group_id            yes  number   business group context
26 --  p_date_from                    yes  DATE     required to check parent org is
27 --                                               active for hierarchy version
28 --  p_security_profile_id          yes  NUMBER   used to add orgs in hierarchy
29 --                                               to per_organization_list
30 --  p_view_all_orgs                yes  VARCHAR2 flag used to define if
31 --                                               per_organization_list should
32 --                                               be populated (secure_user)
33 --  p_end_of_time                  yes  DATE     end of time
34 --  p_hr_installed                 yes  VARCHAR2 check fnd_product_installations
35 --                                               set to 'I' if installed
36 --  p_pa_installed                 yes  VARCHAR2 check fnd_product_installations
37 --                                               set to 'I' if installed
38 --  p_warning_raised                no  VARCHAR2 flag if org is not active from
39 --                                               Hierarchy Version date
40 --
41 --
42 -- Post Success:
43 --  row is created
44 --
45 --
46 -- Post Failure:
47 --
48 --   The procedure will raise an error.
49 --
50 -- Access Status:
51 --   Internal Development Use Only.
52 --
53 -- {End Of Comments}
54 --
55 procedure create_hier_element_internal
56   (p_organization_id_parent        in     number
57   ,p_org_structure_version_id      in     number
58   ,p_organization_id_child         in     number
59   ,p_business_group_id             in     number   default null
60   ,p_effective_date                in     DATE
61   ,p_date_from                     in     DATE
62   ,p_security_profile_id           in     NUMBER
63   ,p_view_all_orgs                 in     VARCHAR2
64   ,p_end_of_time                   in     DATE
65   ,p_hr_installed                  in     VARCHAR2
66   ,p_pa_installed                  in     VARCHAR2
67   ,p_pos_control_enabled_flag      in     varchar2
68   ,p_warning_raised                IN OUT NOCOPY VARCHAR2
69   ,p_org_structure_element_id         out nocopy number
70   ,p_object_version_number            out nocopy number
71   ) is
72 
73   --
74   -- Declare cursors and local variables
75   --
76 
77 
78   l_proc                varchar2(72) := g_package||'create_hier_element_internal';
79 
80   l_warning_raised           varchar2(30) := p_warning_raised;
81   l_org_structure_element_id number;
82   l_object_version_number    number;
83 
84 begin
85   hr_utility.set_location('Entering:'|| l_proc, 10);
86   --
87   -- Validation in addition to Row Handlers
88   --
89 
90 
91 
92   --
93   -- Process Logic
94   --
95 
96   hr_hierarchy_element_api.create_hierarchy_element
97   (p_validate                      => false
98   ,p_organization_id_parent        => p_organization_id_parent
99   ,p_org_structure_version_id      => p_org_structure_version_id
100   ,p_organization_id_child         => p_organization_id_child
101   ,p_business_group_id             => p_business_group_id
102   ,p_effective_date                => p_effective_date
103   ,p_date_from                     => p_date_from
104   ,p_security_profile_id           => p_security_profile_id
105   ,p_view_all_orgs                 => p_view_all_orgs
106   ,p_end_of_time                   => p_end_of_time
107   ,p_hr_installed                  => p_hr_installed
108   ,p_pa_installed                  => p_pa_installed
109   ,p_pos_control_enabled_flag      => p_pos_control_enabled_flag
110   ,p_warning_raised                => l_warning_raised
111   ,p_org_structure_element_id      => l_org_structure_element_id
112   ,p_object_version_number         => l_object_version_number
113   );
114 
115   --
116   -- Set all output arguments
117   --
118 
119   p_warning_raised           := l_warning_raised;
120   p_org_structure_element_id := l_org_structure_element_id;
121   p_object_version_number    := l_object_version_number;
122 
123   hr_utility.set_location(' Leaving:'||l_proc, 40);
124 
125 end create_hier_element_internal;
126 --
127 --
128 -- ----------------------------------------------------------------------------
129 -- |----------------<  update_hier_element_internal >-------------------------|
130 -- ----------------------------------------------------------------------------
131 -- {Start Of Comments}
132 --
133 -- Description:
134 --   This business support process calls the business process to update a
135 --   parent-child element in an organization hierarchy. When called from
136 --   here, p_validate is always set to false.
137 --
138 -- Prerequisites:
139 --   none
140 --
141 -- In Parameters:
142 --  Name                           Reqd Type     Description
143 --
144 --  p_org_structure_element_id     yes  number   primary key
145 --  p_organization_id_parent       yes  number   fk to hr_all_organization_units
146 --  p_organization_id_child        yes  number   fk to hr_all_organization_units
147 --  p_object_version_number        yes  number   object version number
148 --
149 --
150 -- Post Success:
151 --  row is updated
152 --
153 --
154 -- Post Failure:
155 --
156 --   The procedure will raise an error.
157 --
158 --
159 -- Access Status:
160 --   Internal Development Use Only.
161 --
162 -- {End Of Comments}
163 --
164 procedure update_hier_element_internal
165   (p_org_structure_element_id      in     number
166   ,p_effective_date                in     date
167   ,p_organization_id_parent        in     number   default hr_api.g_number
168   ,p_organization_id_child         in     number   default hr_api.g_number
169   ,p_pos_control_enabled_flag      in     varchar2 default hr_api.g_varchar2
170   ,p_object_version_number         in out nocopy number
171   ) is
172 
173 
174   --
175   -- Declare cursors and local variables
176   --
177 
178 
179   l_proc                varchar2(72) := g_package||'update_hier_element_internal';
180 
181   l_object_version_number number := p_object_version_number;
182 begin
183   hr_utility.set_location('Entering:'|| l_proc, 10);
184   --
185   -- Validation in addition to Row Handlers
186   --
187 
188 
189 
190   --
191   -- Process Logic
192   --
193 
194   hr_hierarchy_element_api.update_hierarchy_element
195   (p_validate                      => false
196   ,p_org_structure_element_id      => p_org_structure_element_id
197   ,p_organization_id_parent        => p_organization_id_parent
198   ,p_organization_id_child         => p_organization_id_child
199   ,p_effective_date                => p_effective_date
200   ,p_pos_control_enabled_flag      => p_pos_control_enabled_flag
201   ,p_object_version_number         => l_object_version_number
202   );
203 
204   --
205   -- Set all output arguments
206   --
207 
208   p_object_version_number := l_object_version_number;
209 
210   hr_utility.set_location(' Leaving:'||l_proc, 40);
211 
212 end update_hier_element_internal;
213 
214 --
215 --
216 -- ----------------------------------------------------------------------------
217 -- |----------------<  delete_hier_element_internal >-------------------------|
218 -- ----------------------------------------------------------------------------
219 -- {Start Of Comments}
220 --
221 -- Description:
222 --   This business support process calls the business process to remove a
223 --   parent-child element from an organization hierarchy. When called from
224 --   here, p_validate is always set to false.
225 --
226 -- Prerequisites:
227 --   element cannot be deleted if children exist.
228 -- If the child org in the element = top org in an
229 -- security_profile and hierarchies are the same
230 -- then cannot delete it.
231 -- Similarly if the parent_org in the element = top org in a
232 -- security_profile and hierarchies are the same
233 -- then you cannot delete it if it is the parent of no other
234 -- org_structure_element for this version.
235 -- If an Org structure has been specified for
236 -- PA use then it should not be allowed to be deleted.
237 --
238 --
239 -- In Parameters:
240 --  Name                           Reqd Type     Description
241 --
242 --  p_org_structure_element_id     yes  number   primary key
243 --  p_object_version_number        yes  number   object version number
244 --  p_hr_installed                 yes  VARCHAR2 check fnd_product_installations
245 --                                               set to 'I' if installed
246 --  p_pa_installed                 yes  VARCHAR2 check fnd_product_installations
247 --                                               set to 'I' if installed
248 --  p_exists_in_hierarchy          yes  VARCHAR2 set in value to 'Y'
249 --                                               is set to 'Y' if the child org is
250 --                                               present in the hierarchy after
251 --                                               the delete, else set to 'N'
252 --
253 --
254 -- Post Success:
255 --  row is deleted
256 --
257 --
258 -- Post Failure:
259 --
260 --   The procedure will raise an error.
261 --
262 --
263 -- Access Status:
264 --   Internal Development Use Only.
265 --
266 -- {End Of Comments}
267 --
268 procedure delete_hier_element_internal
269   (p_org_structure_element_id      in     number
270   ,p_object_version_number         in     number
271   ,p_hr_installed                  in     VARCHAR2
272   ,p_pa_installed                  in     VARCHAR2
273   ,p_exists_in_hierarchy           in out nocopy VARCHAR2
274   ) is
275 
276   --
277   -- Declare cursors and local variables
278   --
279 
280 
281   l_proc                varchar2(72) := g_package||'delete_hier_element_internal';
282 
283   l_exists_in_hierarchy varchar2(30) := p_exists_in_hierarchy;
284 
285 begin
286   hr_utility.set_location('Entering:'|| l_proc, 10);
287   --
288   -- Validation in addition to Row Handlers
289   --
290 
291 
292 
293   --
294   -- Process Logic
295   --
296 
297   hr_hierarchy_element_api.delete_hierarchy_element
298   (p_validate                      => false
299   ,p_org_structure_element_id      => p_org_structure_element_id
300   ,p_object_version_number         => p_object_version_number
301   ,p_hr_installed                  => p_hr_installed
302   ,p_pa_installed                  => p_pa_installed
303   ,p_exists_in_hierarchy           => l_exists_in_hierarchy
304   );
305 
306 
307   --
308   -- Set all output arguments
309   --
310 
311   l_exists_in_hierarchy := p_exists_in_hierarchy;
312 
313   hr_utility.set_location(' Leaving:'||l_proc, 40);
314 
315 end delete_hier_element_internal;
316 
317 --
318 end hr_hierarchy_element_internal;