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