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