DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ADI_LOB_SHD

Source


1 Package Body hr_adi_lob_shd as
2 /* $Header: hrlobrhi.pkb 120.0 2005/05/31 01:18:46 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_adi_lob_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 = 'FND_LOBS_U1') 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_file_id                              in     number
40   )
41   Return Boolean Is
42   --
43   --
44   -- Cursor selects the 'current' row from the HR Schema
45   --
46   Cursor C_Sel1 is
47     select
48        file_id
49       ,file_name
50       ,file_content_type
51       ,upload_date
52       ,program_name
53       ,program_tag
54       ,file_format
55     from        fnd_lobs
56     where       file_id = p_file_id;
57   --
58   l_fct_ret     boolean;
59   --
60 Begin
61   --
62   If (p_file_id is null
63      ) Then
64     --
65     -- One of the primary key arguments is null therefore we must
66     -- set the returning function value to false
67     --
68     l_fct_ret := false;
69   Else
70     If (p_file_id
71         = hr_adi_lob_shd.g_old_rec.file_id
72        ) Then
73       --
74       -- The g_old_rec is current therefore we must
75       -- set the returning function to true
76       --
77       l_fct_ret := true;
78     Else
79       --
80       -- Select the current row into g_old_rec
81       --
82       Open C_Sel1;
83       Fetch C_Sel1 Into hr_adi_lob_shd.g_old_rec;
84       If C_Sel1%notfound Then
85         Close C_Sel1;
86         --
87         -- The primary key is invalid therefore we must error
88         --
89         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
90         fnd_message.raise_error;
91       End If;
92       Close C_Sel1;
93       --
94       l_fct_ret := true;
95     End If;
96   End If;
97   Return (l_fct_ret);
98 --
99 End api_updating;
100 --
101 -- ----------------------------------------------------------------------------
102 -- |---------------------------------< lck >----------------------------------|
103 -- ----------------------------------------------------------------------------
104 Procedure lck
105   (p_file_id                              in     number
106   ) is
107 --
108 -- Cursor selects the 'current' row from the HR Schema
109 --
110   Cursor C_Sel1 is
111     select
112        file_id
113       ,file_name
114       ,file_content_type
115       ,upload_date
116       ,program_name
117       ,program_tag
118       ,file_format
119     from        fnd_lobs
120     where       file_id = p_file_id
121     for update nowait;
122 --
123   l_proc        varchar2(72) := g_package||'lck';
124 --
125 Begin
126   hr_utility.set_location('Entering:'||l_proc, 5);
127   --
128   hr_api.mandatory_arg_error
129     (p_api_name           => l_proc
130     ,p_argument           => 'FILE_ID'
131     ,p_argument_value     => p_file_id
132     );
133   --
134   Open  C_Sel1;
135   Fetch C_Sel1 Into hr_adi_lob_shd.g_old_rec;
136   If C_Sel1%notfound then
137     Close C_Sel1;
138     --
139     -- The primary key is invalid therefore we must error
140     --
141     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
142     fnd_message.raise_error;
143   End If;
144   Close C_Sel1;
145   --
146   --
147   hr_utility.set_location(' Leaving:'||l_proc, 10);
148   --
149   -- We need to trap the ORA LOCK exception
150   --
151 Exception
152   When HR_Api.Object_Locked then
153     --
154     -- The object is locked therefore we need to supply a meaningful
155     -- error message.
156     --
157     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
158     fnd_message.set_token('TABLE_NAME', 'fnd_lobs');
159     fnd_message.raise_error;
160 End lck;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |-----------------------------< convert_args >-----------------------------|
164 -- ----------------------------------------------------------------------------
165 Function convert_args
166   (p_file_id                        in number
167   ,p_file_name                      in varchar2
168   ,p_file_content_type              in varchar2
169   ,p_upload_date                    in date
170   ,p_program_name                   in varchar2
171   ,p_program_tag                    in varchar2
172   ,p_file_format                    in varchar2
173   )
174   Return g_rec_type is
175 --
176   l_rec   g_rec_type;
177 --
178 Begin
179   --
180   -- Convert arguments into local l_rec structure.
181   --
182   l_rec.file_id                          := p_file_id;
183   l_rec.file_name                        := p_file_name;
184   l_rec.file_content_type                := p_file_content_type;
185   l_rec.upload_date                      := p_upload_date;
186   l_rec.program_name                     := p_program_name;
187   l_rec.program_tag                      := p_program_tag;
188   l_rec.file_format                      := p_file_format;
189   --
190   -- Return the plsql record structure.
191   --
192   Return(l_rec);
193 --
194 End convert_args;
195 --
196 end hr_adi_lob_shd;