[Home] [Help]
PACKAGE BODY: APPS.PER_PGT_SHD
Source
1 Package Body per_pgt_shd as
2 /* $Header: pepgtrhi.pkb 115.2 2003/06/05 07:38:23 cxsimpso noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pgt_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 = 'PER_GEN_HIER_NODE_TYPES_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_hier_node_type_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 hier_node_type_id
50 ,business_group_id
51 ,hierarchy_type
52 ,parent_node_type
53 ,child_node_type
54 ,child_value_set
55 ,object_version_number
56 ,identifier_key
57 from per_gen_hier_node_types
58 where hier_node_type_id = p_hier_node_type_id;
59 --
60 l_fct_ret boolean;
61 --
62 Begin
63 --
64 If (p_hier_node_type_id is null and
65 p_object_version_number is null
66 ) Then
67 --
68 -- One of the primary key arguments is null therefore we must
69 -- set the returning function value to false
70 --
71 l_fct_ret := false;
72 Else
73 If (p_hier_node_type_id
74 = per_pgt_shd.g_old_rec.hier_node_type_id and
75 p_object_version_number
76 = per_pgt_shd.g_old_rec.object_version_number
77 ) Then
78 --
79 -- The g_old_rec is current therefore we must
80 -- set the returning function to true
81 --
82 l_fct_ret := true;
83 Else
84 --
85 -- Select the current row into g_old_rec
86 --
87 Open C_Sel1;
88 Fetch C_Sel1 Into per_pgt_shd.g_old_rec;
89 If C_Sel1%notfound Then
90 Close C_Sel1;
91 --
92 -- The primary key is invalid therefore we must error
93 --
94 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
95 fnd_message.raise_error;
96 End If;
97 Close C_Sel1;
98 If (p_object_version_number
99 <> per_pgt_shd.g_old_rec.object_version_number) Then
100 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
101 fnd_message.raise_error;
102 End If;
103 l_fct_ret := true;
104 End If;
105 End If;
106 Return (l_fct_ret);
107 --
108 End api_updating;
109 --
110 -- ----------------------------------------------------------------------------
111 -- |---------------------------------< lck >----------------------------------|
112 -- ----------------------------------------------------------------------------
113 Procedure lck
114 (p_hier_node_type_id in number
115 ,p_object_version_number in number
116 ) is
117 --
118 -- Cursor selects the 'current' row from the HR Schema
119 --
120 Cursor C_Sel1 is
121 select
122 hier_node_type_id
123 ,business_group_id
124 ,hierarchy_type
125 ,parent_node_type
126 ,child_node_type
127 ,child_value_set
128 ,object_version_number
129 ,identifier_key
130 from per_gen_hier_node_types
131 where hier_node_type_id = p_hier_node_type_id
132 for update nowait;
133 --
134 l_proc varchar2(72) := g_package||'lck';
135 --
136 Begin
137 hr_utility.set_location('Entering:'||l_proc, 5);
138 --
139 hr_api.mandatory_arg_error
140 (p_api_name => l_proc
141 ,p_argument => 'HIER_NODE_TYPE_ID'
142 ,p_argument_value => p_hier_node_type_id
143 );
144 hr_utility.set_location(l_proc,6);
145 hr_api.mandatory_arg_error
146 (p_api_name => l_proc
147 ,p_argument => 'OBJECT_VERSION_NUMBER'
148 ,p_argument_value => p_object_version_number
149 );
150 --
151 Open C_Sel1;
152 Fetch C_Sel1 Into per_pgt_shd.g_old_rec;
153 If C_Sel1%notfound then
154 Close C_Sel1;
155 --
156 -- The primary key is invalid therefore we must error
157 --
158 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
159 fnd_message.raise_error;
160 End If;
161 Close C_Sel1;
162 If (p_object_version_number
163 <> per_pgt_shd.g_old_rec.object_version_number) Then
164 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
165 fnd_message.raise_error;
166 End If;
167 --
168 hr_utility.set_location(' Leaving:'||l_proc, 10);
169 --
170 -- We need to trap the ORA LOCK exception
171 --
172 Exception
173 When HR_Api.Object_Locked then
174 --
175 -- The object is locked therefore we need to supply a meaningful
176 -- error message.
177 --
178 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
179 fnd_message.set_token('TABLE_NAME', 'per_gen_hier_node_types');
180 fnd_message.raise_error;
181 End lck;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |-----------------------------< convert_args >-----------------------------|
185 -- ----------------------------------------------------------------------------
186 Function convert_args
187 (p_hier_node_type_id in number
188 ,p_business_group_id in number
189 ,p_hierarchy_type in varchar2
190 ,p_parent_node_type in varchar2
191 ,p_child_node_type in varchar2
192 ,p_child_value_set in varchar2
193 ,p_object_version_number in number
194 ,p_identifier_key in varchar2
195 )
196 Return g_rec_type is
197 --
198 l_rec g_rec_type;
199 --
200 Begin
201 --
202 -- Convert arguments into local l_rec structure.
203 --
204 l_rec.hier_node_type_id := p_hier_node_type_id;
205 l_rec.business_group_id := p_business_group_id;
206 l_rec.hierarchy_type := p_hierarchy_type;
207 l_rec.parent_node_type := p_parent_node_type;
208 l_rec.child_node_type := p_child_node_type;
209 l_rec.child_value_set := p_child_value_set;
210 l_rec.object_version_number := p_object_version_number;
211 l_rec.identifier_key := p_identifier_key;
212 --
213 -- Return the plsql record structure.
214 --
215 Return(l_rec);
216 --
217 End convert_args;
218 --
219 end per_pgt_shd;