DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_BJS_SHD

Source


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