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