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