DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_QSF_SHD

Source


1 Package Body hr_qsf_shd as
2 /* $Header: hrqsfrhi.pkb 120.1.12020000.3 2013/03/20 12:06:16 bmaheshw ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)  := '  hr_qsf_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc   varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   If (p_constraint_name = 'HR_QUEST_FIELDS_FK') Then
22     fnd_message.set_name('PER', 'PER_52416_QSF_INVAL_TEMP_ID');
23     fnd_message.raise_error;
24   ElsIf (p_constraint_name = 'HR_QUEST_FIELDS_PK') Then
25     -- Unlikely to fail.
26     hr_utility.set_message('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
27     hr_utility.set_message_token('PROCEDURE', l_proc);
28     hr_utility.set_message_token('STEP','10');
29     hr_utility.raise_error;
30   ElsIf (p_constraint_name = 'HR_QUEST_FIELDS_SQL_FLAG_CHK') Then
31     fnd_message.set_name('PER', 'PER_52417_QSF_REQD_FLAG_INVAL');
32     fnd_message.raise_error;
33   ElsIf (p_constraint_name = 'HR_QUEST_FIELDS_TYPE_CHK') Then
34     fnd_message.set_name('PER', 'PER_52418_QSF_TYPE_INVALID');
35     fnd_message.raise_error;
36   Else
37     hr_utility.set_message('PER', 'HR_7877_API_INVALID_CONSTRAINT');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
40     hr_utility.raise_error;
41   End If;
42   --
43   hr_utility.set_location(' Leaving:'||l_proc, 10);
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50   (
51   p_field_id                           in number,
52   p_object_version_number              in number
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     field_id,
61   questionnaire_template_id,
62   name,
63   type,
64   html_text,
65   sql_required_flag,
66   sql_text,
67   object_version_number
68   ,validation_type
69   ,validation_detail
70   ,display_sequence
71     from  hr_quest_fields
72     where  field_id = p_field_id;
73 --
74   l_proc  varchar2(72)  := g_package||'api_updating';
75   l_fct_ret  boolean;
76 --
77 Begin
78   hr_utility.set_location('Entering:'||l_proc, 5);
79   --
80   If (
81   p_field_id is null and
82   p_object_version_number is null
83      ) Then
84     --
85     -- One of the primary key arguments is null therefore we must
86     -- set the returning function value to false
87     --
88     l_fct_ret := false;
89   Else
90     If (
91   p_field_id = g_old_rec.field_id and
92   p_object_version_number = g_old_rec.object_version_number
93        ) Then
94       hr_utility.set_location(l_proc, 10);
95       --
96       -- The g_old_rec is current therefore we must
97       -- set the returning function to true
98       --
99       l_fct_ret := true;
100     Else
101       --
102       -- Select the current row into g_old_rec
103       --
104       Open C_Sel1;
105       Fetch C_Sel1 Into g_old_rec;
106       If C_Sel1%notfound Then
107         Close C_Sel1;
108         --
109         -- The primary key is invalid therefore we must error
110         --
111         hr_utility.set_message('PER', 'HR_7220_INVALID_PRIMARY_KEY');
112         hr_utility.raise_error;
113       End If;
114       Close C_Sel1;
115       If (p_object_version_number <> g_old_rec.object_version_number) Then
116         hr_utility.set_message('PER', 'HR_7155_OBJECT_INVALID');
117         hr_utility.raise_error;
118       End If;
119       hr_utility.set_location(l_proc, 15);
120       l_fct_ret := true;
121     End If;
122   End If;
123   hr_utility.set_location(' Leaving:'||l_proc, 20);
124   Return (l_fct_ret);
125 --
126 End api_updating;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |---------------------------------< lck >----------------------------------|
130 -- ----------------------------------------------------------------------------
131 Procedure lck
132   (
133   p_field_id                           in number,
134   p_object_version_number              in number
135   ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139   Cursor C_Sel1 is
140     select   field_id,
141   questionnaire_template_id,
142   name,
143   type,
144   html_text,
145   sql_required_flag,
146   sql_text,
147   object_version_number
148   ,validation_type
149   ,validation_detail
150   ,display_sequence
151     from  hr_quest_fields
152     where  field_id = p_field_id
153     for  update nowait;
154 --
155   l_proc  varchar2(72) := g_package||'lck';
156 --
157 Begin
158   hr_utility.set_location('Entering:'||l_proc, 5);
159   --
160   hr_api.mandatory_arg_error
161     (p_api_name  => l_proc
162     ,p_argument  => 'field_id'
163     ,p_argument_value => p_field_id);
164   --
165   hr_api.mandatory_arg_error
166     (p_api_name  => l_proc
167     ,p_argument  => 'object_version_number'
168     ,p_argument_value => p_object_version_number);
169   --
170   Open  C_Sel1;
171   Fetch C_Sel1 Into g_old_rec;
172   If C_Sel1%notfound then
173     Close C_Sel1;
174     --
175     -- The primary key is invalid therefore we must error
176     --
177     hr_utility.set_message('PER', 'HR_7220_INVALID_PRIMARY_KEY');
178     hr_utility.raise_error;
179   End If;
180   Close C_Sel1;
181   If (p_object_version_number <> g_old_rec.object_version_number) Then
182         hr_utility.set_message('PER', 'HR_7155_OBJECT_INVALID');
183         hr_utility.raise_error;
184       End If;
185 --
186   hr_utility.set_location(' Leaving:'||l_proc, 10);
187 --
188 -- We need to trap the ORA LOCK exception
189 --
190 Exception
191   When HR_Api.Object_Locked then
192     --
193     -- The object is locked therefore we need to supply a meaningful
194     -- error message.
195     --
196     hr_utility.set_message('PER', 'HR_7165_OBJECT_LOCKED');
197     hr_utility.set_message_token('TABLE_NAME', 'hr_quest_fields');
198     hr_utility.raise_error;
199 End lck;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |-----------------------------< convert_args >-----------------------------|
203 -- ----------------------------------------------------------------------------
204 Function convert_args
205   (
206   p_field_id                      in number,
207   p_questionnaire_template_id     in number,
208   p_name                          in varchar2,
209   p_type                          in varchar2,
210   p_html_text                     in CLOB,
211   p_sql_required_flag             in varchar2,
212   p_sql_text                      in varchar2,
213   p_object_version_number         in number
214   ,p_validation_type              in     varchar2
215   ,p_validation_detail            in     varchar2
216   ,p_display_sequence             in     number
217   )
218   Return g_rec_type is
219 --
220   l_rec    g_rec_type;
221   l_proc  varchar2(72) := g_package||'convert_args';
222 --
223 Begin
224   --
225   hr_utility.set_location('Entering:'||l_proc, 5);
226   --
227   -- Convert arguments into local l_rec structure.
228   --
229   l_rec.field_id                         := p_field_id;
230   l_rec.questionnaire_template_id        := p_questionnaire_template_id;
231   l_rec.name                             := p_name;
232   l_rec.type                             := p_type;
233   l_rec.html_text                        := p_html_text;
234   l_rec.sql_required_flag                := p_sql_required_flag;
235   l_rec.sql_text                         := p_sql_text;
236   l_rec.object_version_number            := p_object_version_number;
237   l_rec.validation_type                  := p_validation_type;
238   l_rec.validation_detail                := p_validation_detail;
239   l_rec.display_sequence                 := p_display_sequence;
240   --
241   -- Return the plsql record structure.
242   --
243   hr_utility.set_location(' Leaving:'||l_proc, 10);
244   Return(l_rec);
245 --
246 End convert_args;
247 --
248 end hr_qsf_shd;