DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TWN_SHD

Source


1 Package Body hr_twn_shd as
2 /* $Header: hrtwnrhi.pkb 115.4 2002/12/03 13:55:19 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_twn_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_TEMPLATE_WINDOWS_B_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   ElsIf (p_constraint_name = 'HR_TEMPLATE_WINDOWS_B_FK2') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   ElsIf (p_constraint_name = 'HR_TEMPLATE_WINDOWS_B_PK') Then
32     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'HR_TEMPLATE_WINDOWS_B_UK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','20');
40     fnd_message.raise_error;
41   ElsIf (p_constraint_name = 'HR_TEMPLATE_CANVASES_B_FK1') Then
42     fnd_message.set_name('PER', 'HR_52639_TWN_TCN_EXIST');
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_window_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_window_id
68       ,object_version_number
69       ,form_template_id
70       ,form_window_id
71     from	hr_template_windows_b
72     where	template_window_id = p_template_window_id;
73 --
74   l_fct_ret	boolean;
75 --
76 Begin
77   --
78   If (p_template_window_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_template_window_id
88         = hr_twn_shd.g_old_rec.template_window_id and
89         p_object_version_number
90         = hr_twn_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 hr_twn_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           <> hr_twn_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_template_window_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        template_window_id
137       ,object_version_number
138       ,form_template_id
139       ,form_window_id
140     from	hr_template_windows_b
141     where	template_window_id = p_template_window_id
142     for	update nowait;
143 --
144   l_proc	varchar2(72) := g_package||'lck';
145 --
146 Begin
147   hr_utility.set_location('Entering:'||l_proc, 5);
148   --
149   hr_api.mandatory_arg_error
150     (p_api_name           => l_proc
151     ,p_argument           => 'TEMPLATE_WINDOW_ID'
152     ,p_argument_value     => p_template_window_id
153     );
154   --
155   Open  C_Sel1;
156   Fetch C_Sel1 Into hr_twn_shd.g_old_rec;
157   If C_Sel1%notfound then
158     Close C_Sel1;
159     --
160     -- The primary key is invalid therefore we must error
161     --
162     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
163     fnd_message.raise_error;
164   End If;
165   Close C_Sel1;
166   If (p_object_version_number
167       <> hr_twn_shd.g_old_rec.object_version_number) Then
168         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
169         fnd_message.raise_error;
170   End If;
171   --
172   hr_utility.set_location(' Leaving:'||l_proc, 10);
173   --
174   -- We need to trap the ORA LOCK exception
175   --
176 Exception
177   When HR_Api.Object_Locked then
178     --
179     -- The object is locked therefore we need to supply a meaningful
180     -- error message.
181     --
182     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
183     fnd_message.set_token('TABLE_NAME', 'hr_template_windows_b');
184     fnd_message.raise_error;
185 End lck;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |-----------------------------< convert_args >-----------------------------|
189 -- ----------------------------------------------------------------------------
190 Function convert_args
191   (p_template_window_id             in number
192   ,p_object_version_number          in number
193   ,p_form_template_id               in number
194   ,p_form_window_id                 in number
195   )
196   Return g_rec_type is
197 --
198   l_rec   g_rec_type;
199 --
200 Begin
201   --
202   -- Convert arguments into local l_rec structure.
203   --
204   l_rec.template_window_id               := p_template_window_id;
205   l_rec.object_version_number            := p_object_version_number;
206   l_rec.form_template_id                 := p_form_template_id;
207   l_rec.form_window_id                   := p_form_window_id;
208   --
209   -- Return the plsql record structure.
210   --
211   Return(l_rec);
212 --
213 End convert_args;
214 --
215 end hr_twn_shd;