DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TTP_SHD

Source


1 Package Body hr_ttp_shd as
2 /* $Header: hrttprhi.pkb 115.5 2002/12/03 13:51:39 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_ttp_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_TAB_PAGES_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_TAB_PAGES_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_TAB_PAGES_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_TAB_PAGES_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_ITEM_TAB_PAGES_FK2') Then
42     fnd_message.set_name('PER', 'HR_52640_TTP_TIP_EXIST');
43     fnd_message.raise_error;
44   ElsIf (p_constraint_name = 'HR_TCP_FK2') Then -- HR_TEMPLATE_ITEM_CONTEXT_PAGES
45     fnd_message.set_name('PER', 'HR_52641_TTP_TCP_EXIST');
46     fnd_message.raise_error;
47   Else
48     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51     fnd_message.raise_error;
52   End If;
53   --
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (p_template_tab_page_id                 in     number
61   ,p_object_version_number                in     number
62   )
63   Return Boolean Is
64 --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70        template_tab_page_id
71       ,object_version_number
72       ,template_canvas_id
73       ,form_tab_page_id
74     from	hr_template_tab_pages_b
75     where	template_tab_page_id = p_template_tab_page_id;
76 --
77   l_fct_ret	boolean;
78 --
79 Begin
80   --
81   If (p_template_tab_page_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 (p_template_tab_page_id
91         = hr_ttp_shd.g_old_rec.template_tab_page_id and
92         p_object_version_number
93         = hr_ttp_shd.g_old_rec.object_version_number
94        ) Then
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 hr_ttp_shd.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         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
112         fnd_message.raise_error;
113       End If;
114       Close C_Sel1;
115       If (p_object_version_number
116           <> hr_ttp_shd.g_old_rec.object_version_number) Then
117         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
118         fnd_message.raise_error;
119       End If;
120       l_fct_ret := true;
121     End If;
122   End If;
123   Return (l_fct_ret);
124 --
125 End api_updating;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |---------------------------------< lck >----------------------------------|
129 -- ----------------------------------------------------------------------------
130 Procedure lck
131   (p_template_tab_page_id                 in     number
132   ,p_object_version_number                in     number
133   ) is
134 --
135 -- Cursor selects the 'current' row from the HR Schema
136 --
137   Cursor C_Sel1 is
138     select
139        template_tab_page_id
140       ,object_version_number
141       ,template_canvas_id
142       ,form_tab_page_id
143     from	hr_template_tab_pages_b
144     where	template_tab_page_id = p_template_tab_page_id
145     for	update nowait;
146 --
147   l_proc	varchar2(72) := g_package||'lck';
148 --
149 Begin
150   hr_utility.set_location('Entering:'||l_proc, 5);
151   --
152   hr_api.mandatory_arg_error
153     (p_api_name           => l_proc
154     ,p_argument           => 'TEMPLATE_TAB_PAGE_ID'
155     ,p_argument_value     => p_template_tab_page_id
156     );
157   --Bug:1790746 fix Start
158   hr_api.mandatory_arg_error
159     (p_api_name		=> l_proc
160     ,p_argument 	=> 'object_version_number'
161     ,p_argument_value   => p_object_version_number
162      );
163   --Bug:1790746 fix End
164   Open  C_Sel1;
165   Fetch C_Sel1 Into hr_ttp_shd.g_old_rec;
166   If C_Sel1%notfound then
167     Close C_Sel1;
168     --
169     -- The primary key is invalid therefore we must error
170     --
171     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
172     fnd_message.raise_error;
173   End If;
174   Close C_Sel1;
175   If (p_object_version_number
176       <> hr_ttp_shd.g_old_rec.object_version_number) Then
177         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
178         fnd_message.raise_error;
179   End If;
180   --
181   hr_utility.set_location(' Leaving:'||l_proc, 10);
182   --
183   -- We need to trap the ORA LOCK exception
184   --
185 Exception
186   When HR_Api.Object_Locked then
187     --
188     -- The object is locked therefore we need to supply a meaningful
189     -- error message.
190     --
191     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
192     fnd_message.set_token('TABLE_NAME', 'hr_template_tab_pages_b');
193     fnd_message.raise_error;
194 End lck;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |-----------------------------< convert_args >-----------------------------|
198 -- ----------------------------------------------------------------------------
199 Function convert_args
200   (p_template_tab_page_id           in number
201   ,p_object_version_number          in number
202   ,p_template_canvas_id             in number
203   ,p_form_tab_page_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_tab_page_id             := p_template_tab_page_id;
214   l_rec.object_version_number            := p_object_version_number;
215   l_rec.template_canvas_id               := p_template_canvas_id;
216   l_rec.form_tab_page_id                 := p_form_tab_page_id;
217   --
218   -- Return the plsql record structure.
219   --
220   Return(l_rec);
221 --
222 End convert_args;
223 --
224 end hr_ttp_shd;