DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TIC_SHD

Source


1 Package Body hr_tic_shd as
2 /* $Header: hrticrhi.pkb 115.6 2002/12/03 10:59:58 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_tic_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 = 'HR_TIC_B_UK') Then
22     fnd_message.set_name('PER', 'HR_52649_TIC_NOT_UNIQUE');
23     fnd_message.raise_error;
24   ElsIf (p_constraint_name = 'HR_TIC_B_PK') Then
25     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
26     fnd_message.set_token('PROCEDURE', l_proc);
27     fnd_message.set_token('STEP','10');
28     fnd_message.raise_error;
29   ElsIf (p_constraint_name = 'HR_TIC_B_FK1') Then
30     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
31     fnd_message.set_token('PROCEDURE', l_proc);
32     fnd_message.set_token('STEP','15');
33     fnd_message.raise_error;
34   ElsIf (p_constraint_name = 'HR_TIC_B_FK2') Then
35     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
36     fnd_message.set_token('PROCEDURE', l_proc);
37     fnd_message.set_token('STEP','20');
38     fnd_message.raise_error;
39   ElsIf (p_constraint_name = 'HR_TCP_FK1') Then -- HR_TEMPLATE_ITEM_CONTEXT_PAGES
40     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
41     fnd_message.set_token('PROCEDURE', l_proc);
42     fnd_message.set_token('STEP','25');
43     fnd_message.raise_error;
44   Else
45     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
46     fnd_message.set_token('PROCEDURE', l_proc);
47     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
48     fnd_message.raise_error;
49   End If;
50   --
51 End constraint_error;
52 --
53 -- ----------------------------------------------------------------------------
54 -- |-----------------------------< api_updating >-----------------------------|
55 -- ----------------------------------------------------------------------------
56 Function api_updating
57   (p_template_item_context_id             in     number
58   ,p_object_version_number                in     number
59   )
60   Return Boolean Is
61 --
62   --
63   -- Cursor selects the 'current' row from the HR Schema
64   --
65   Cursor C_Sel1 is
66     select
67        template_item_context_id
68       ,object_version_number
69       ,template_item_id
70       ,context_type
71       ,item_context_id
72     from	hr_template_item_contexts_b
73     where	template_item_context_id = p_template_item_context_id;
74 --
75   l_fct_ret	boolean;
76 --
77 Begin
78   --
79   If (p_template_item_context_id is null and
80       p_object_version_number is null
81      ) Then
82     --
83     -- One of the primary key arguments is null therefore we must
84     -- set the returning function value to false
85     --
86     l_fct_ret := false;
87   Else
88     If (p_template_item_context_id
89         = hr_tic_shd.g_old_rec.template_item_context_id and
90         p_object_version_number
91         = hr_tic_shd.g_old_rec.object_version_number
92        ) Then
93       --
94       -- The g_old_rec is current therefore we must
95       -- set the returning function to true
96       --
97       l_fct_ret := true;
98     Else
99       --
100       -- Select the current row into g_old_rec
101       --
102       Open C_Sel1;
103       Fetch C_Sel1 Into hr_tic_shd.g_old_rec;
104       If C_Sel1%notfound Then
105         Close C_Sel1;
106         --
107         -- The primary key is invalid therefore we must error
108         --
109         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
110         fnd_message.raise_error;
111       End If;
112       Close C_Sel1;
113       If (p_object_version_number
114           <> hr_tic_shd.g_old_rec.object_version_number) Then
115         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
116         fnd_message.raise_error;
117       End If;
118       l_fct_ret := true;
119     End If;
120   End If;
121   Return (l_fct_ret);
122 --
123 End api_updating;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------------< lck >----------------------------------|
127 -- ----------------------------------------------------------------------------
128 Procedure lck
129   (p_template_item_context_id             in     number
130   ,p_object_version_number                in     number
131   ) is
132 --
133 -- Cursor selects the 'current' row from the HR Schema
134 --
135   Cursor C_Sel1 is
136     select
137        template_item_context_id
138       ,object_version_number
139       ,template_item_id
140       ,context_type
141       ,item_context_id
142     from	hr_template_item_contexts_b
143     where	template_item_context_id = p_template_item_context_id
144     for	update nowait;
145 --
146   l_proc	varchar2(72) := g_package||'lck';
147 --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'TEMPLATE_ITEM_CONTEXT_ID'
154     ,p_argument_value     => p_template_item_context_id
155     );
156   --Bug:1790746 fix Start
157   hr_api.mandatory_arg_error
158     (p_api_name		=> l_proc
159     ,p_argument 	=> 'object_version_number'
160     ,p_argument_value   => p_object_version_number
161      );
162   --Bug:1790746 fix End
163   Open  C_Sel1;
164   Fetch C_Sel1 Into hr_tic_shd.g_old_rec;
165   If C_Sel1%notfound then
166     Close C_Sel1;
167     --
168     -- The primary key is invalid therefore we must error
169     --
170     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
171     fnd_message.raise_error;
172   End If;
173   Close C_Sel1;
174   If (p_object_version_number
175       <> hr_tic_shd.g_old_rec.object_version_number) Then
176         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
177         fnd_message.raise_error;
178   End If;
179   --
180   hr_utility.set_location(' Leaving:'||l_proc, 10);
181   --
182   -- We need to trap the ORA LOCK exception
183   --
184 Exception
185   When HR_Api.Object_Locked then
186     --
187     -- The object is locked therefore we need to supply a meaningful
188     -- error message.
189     --
190     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
191     fnd_message.set_token('TABLE_NAME', 'hr_template_item_contexts_b');
192     fnd_message.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199   (p_template_item_context_id       in number
200   ,p_object_version_number          in number
201   ,p_template_item_id               in number
202   ,p_context_type                   in varchar2
203   ,p_item_context_id                in number
204   )
205   Return g_rec_type is
206 --
207   l_rec   g_rec_type;
208 --
209 Begin
210   --
211   -- Convert arguments into local l_rec structure.
212   --
213   l_rec.template_item_context_id         := p_template_item_context_id;
214   l_rec.object_version_number            := p_object_version_number;
215   l_rec.template_item_id                 := p_template_item_id;
216   l_rec.context_type                     := p_context_type;
217   l_rec.item_context_id                  := p_item_context_id;
218   --
219   -- Return the plsql record structure.
220   --
221   Return(l_rec);
222 --
223 End convert_args;
224 --
225 end hr_tic_shd;