[Home] [Help]
PACKAGE BODY: APPS.HR_HNM_SHD
Source
1 Package Body hr_hnm_shd as
2 /* $Header: hrhnmrhi.pkb 115.0 2004/01/09 01:21:24 vkarandi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_hnm_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'HR_KI_HIERARCHY_NODE_MAPS_PK') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_hierarchy_node_map_id in number
40 ,p_object_version_number in number
41 )
42 Return Boolean Is
43 --
44 --
45 -- Cursor selects the 'current' row from the HR Schema
46 --
47 Cursor C_Sel1 is
48 select
49 hierarchy_node_map_id
50 ,hierarchy_id
51 ,topic_id
52 ,user_interface_id
53 ,object_version_number
54 from hr_ki_hierarchy_node_maps
55 where hierarchy_node_map_id = p_hierarchy_node_map_id;
56 --
57 l_fct_ret boolean;
58 --
59 Begin
60 --
61 If (p_hierarchy_node_map_id is null and
62 p_object_version_number is null
63 ) Then
64 --
65 -- One of the primary key arguments is null therefore we must
66 -- set the returning function value to false
67 --
68 l_fct_ret := false;
69 Else
70 If (p_hierarchy_node_map_id
71 = hr_hnm_shd.g_old_rec.hierarchy_node_map_id and
72 p_object_version_number
73 = hr_hnm_shd.g_old_rec.object_version_number
74 ) Then
75 --
76 -- The g_old_rec is current therefore we must
77 -- set the returning function to true
78 --
79 l_fct_ret := true;
80 Else
81 --
82 -- Select the current row into g_old_rec
83 --
84 Open C_Sel1;
85 Fetch C_Sel1 Into hr_hnm_shd.g_old_rec;
86 If C_Sel1%notfound Then
87 Close C_Sel1;
88 --
89 -- The primary key is invalid therefore we must error
90 --
91 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
92 fnd_message.raise_error;
93 End If;
94 Close C_Sel1;
95 If (p_object_version_number
96 <> hr_hnm_shd.g_old_rec.object_version_number) Then
97 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
98 fnd_message.raise_error;
99 End If;
100 l_fct_ret := true;
101 End If;
102 End If;
103 Return (l_fct_ret);
104 --
105 End api_updating;
106 --
107 -- ----------------------------------------------------------------------------
108 -- |---------------------------------< lck >----------------------------------|
109 -- ----------------------------------------------------------------------------
110 Procedure lck
111 (p_hierarchy_node_map_id in number
112 ,p_object_version_number in number
113 ) is
114 --
115 -- Cursor selects the 'current' row from the HR Schema
116 --
117 Cursor C_Sel1 is
118 select
119 hierarchy_node_map_id
120 ,hierarchy_id
121 ,topic_id
122 ,user_interface_id
123 ,object_version_number
124 from hr_ki_hierarchy_node_maps
125 where hierarchy_node_map_id = p_hierarchy_node_map_id
126 for update nowait;
127 --
128 l_proc varchar2(72) := g_package||'lck';
129 --
130 Begin
131 hr_utility.set_location('Entering:'||l_proc, 5);
132 --
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc
135 ,p_argument => 'HIERARCHY_NODE_MAP_ID'
136 ,p_argument_value => p_hierarchy_node_map_id
137 );
138 hr_utility.set_location(l_proc,6);
139 hr_api.mandatory_arg_error
140 (p_api_name => l_proc
141 ,p_argument => 'OBJECT_VERSION_NUMBER'
142 ,p_argument_value => p_object_version_number
143 );
144 --
145 Open C_Sel1;
146 Fetch C_Sel1 Into hr_hnm_shd.g_old_rec;
147 If C_Sel1%notfound then
148 Close C_Sel1;
149 --
150 -- The primary key is invalid therefore we must error
151 --
152 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
153 fnd_message.raise_error;
154 End If;
155 Close C_Sel1;
156 If (p_object_version_number
157 <> hr_hnm_shd.g_old_rec.object_version_number) Then
158 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
159 fnd_message.raise_error;
160 End If;
161 --
162 hr_utility.set_location(' Leaving:'||l_proc, 10);
163 --
164 -- We need to trap the ORA LOCK exception
165 --
166 Exception
167 When HR_Api.Object_Locked then
168 --
169 -- The object is locked therefore we need to supply a meaningful
170 -- error message.
171 --
172 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
173 fnd_message.set_token('TABLE_NAME', 'hr_ki_hierarchy_node_maps');
174 fnd_message.raise_error;
175 End lck;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |-----------------------------< convert_args >-----------------------------|
179 -- ----------------------------------------------------------------------------
180 Function convert_args
181 (p_hierarchy_node_map_id in number
182 ,p_hierarchy_id in number
183 ,p_topic_id in number
184 ,p_user_interface_id in number
185 ,p_object_version_number in number
186 )
187 Return g_rec_type is
188 --
189 l_rec g_rec_type;
190 --
191 Begin
192 --
193 -- Convert arguments into local l_rec structure.
194 --
195 l_rec.hierarchy_node_map_id := p_hierarchy_node_map_id;
196 l_rec.hierarchy_id := p_hierarchy_id;
197 l_rec.topic_id := p_topic_id;
198 l_rec.user_interface_id := p_user_interface_id;
199 l_rec.object_version_number := p_object_version_number;
200 --
201 -- Return the plsql record structure.
202 --
203 Return(l_rec);
204 --
205 End convert_args;
206 --
207 end hr_hnm_shd;