1 Package ben_psg_shd as
2 /* $Header: bepsgrhi.pkh 120.0 2005/09/29 06:18:42 ssarkar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (pil_assignment_id number(15)
10 ,per_in_ler_id number(15)
11 ,applicant_assignment_id number(15)
12 ,offer_assignment_id number(15)
13 ,object_version_number number(9)
14 );
15 --
16 -- ----------------------------------------------------------------------------
17 -- | Global Definitions - Internal Development Use Only |
18 -- ----------------------------------------------------------------------------
19 --
20 g_old_rec g_rec_type; -- Global record definition
21 -- Global table name
22 g_tab_nam constant varchar2(30) := 'BEN_PIL_ASSIGNMENT';
23 g_api_dml boolean; -- Global api dml status
24 --
25 -- ----------------------------------------------------------------------------
26 -- |------------------------< return_api_dml_status >-------------------------|
27 -- ----------------------------------------------------------------------------
28 -- {Start Of Comments}
29 --
30 -- Description:
31 -- This function will return the current g_api_dml private global
32 -- boolean status.
33 -- The g_api_dml status determines if at the time of the function
34 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
35 -- is being issued from within an api.
36 -- If the status is TRUE then a dml statement is being issued from
37 -- within this entity api.
38 -- This function is primarily to support database triggers which
39 -- need to maintain the object_version_number for non-supported
40 -- dml statements (i.e. dml statement issued outside of the api layer).
41 --
42 -- Prerequisites:
43 -- None.
44 --
45 -- In Parameters:
46 -- None.
47 --
48 -- Post Success:
49 -- Processing continues.
50 -- If the function returns a TRUE value then, dml is being executed from
51 -- within this api.
52 --
53 -- Post Failure:
54 -- None.
55 --
56 -- Access Status:
57 -- Internal Row Handler Use Only.
58 --
59 -- {End Of Comments}
60 -- ----------------------------------------------------------------------------
61 Function return_api_dml_status Return Boolean;
62 --
63 -- ----------------------------------------------------------------------------
64 -- |---------------------------< constraint_error >---------------------------|
65 -- ----------------------------------------------------------------------------
66 -- {Start Of Comments}
67 --
68 -- Description:
69 -- This procedure is called when a constraint has been violated (i.e.
70 -- The exception hr_api.check_integrity_violated,
71 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
72 -- hr_api.unique_integrity_violated has been raised).
73 -- The exceptions can only be raised as follows:
74 -- 1) A check constraint can only be violated during an INSERT or UPDATE
75 -- dml operation.
76 -- 2) A parent integrity constraint can only be violated during an
77 -- INSERT or UPDATE dml operation.
78 -- 3) A child integrity constraint can only be violated during an
79 -- DELETE dml operation.
80 -- 4) A unique integrity constraint can only be violated during INSERT or
81 -- UPDATE dml operation.
82 --
83 -- Prerequisites:
84 -- 1) Either hr_api.check_integrity_violated,
85 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
86 -- hr_api.unique_integrity_violated has been raised with the subsequent
87 -- stripping of the constraint name from the generated error message
88 -- text.
89 -- 2) Standalone validation test which corresponds with a constraint error.
90 --
91 -- In Parameter:
92 -- p_constraint_name is in upper format and is just the constraint name
93 -- (e.g. not prefixed by brackets, schema owner etc).
94 --
95 -- Post Success:
96 -- Development dependant.
97 --
98 -- Post Failure:
99 -- Developement dependant.
100 --
101 -- Developer Implementation Notes:
102 -- For each constraint being checked the hr system package failure message
103 -- has been generated as a template only. These system error messages should
104 -- be modified as required (i.e. change the system failure message to a user
105 -- friendly defined error message).
106 --
107 -- Access Status:
108 -- Internal Development Use Only.
109 --
110 -- {End Of Comments}
111 -- ----------------------------------------------------------------------------
112 Procedure constraint_error
113 (p_constraint_name in all_constraints.constraint_name%TYPE);
114 --
115 -- ----------------------------------------------------------------------------
116 -- |-----------------------------< api_updating >-----------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 -- This function is used to populate the g_old_rec record with the
122 -- current row from the database for the specified primary key
123 -- provided that the primary key exists and is valid and does not
124 -- already match the current g_old_rec. The function will always return
125 -- a TRUE value if the g_old_rec is populated with the current row.
126 -- A FALSE value will be returned if all of the primary key arguments
127 -- are null.
128 --
129 -- Prerequisites:
130 -- None.
131 --
132 -- In Parameters:
133 --
134 -- Post Success:
135 -- A value of TRUE will be returned indiciating that the g_old_rec
136 -- is current.
137 -- A value of FALSE will be returned if all of the primary key arguments
138 -- have a null value (this indicates that the row has not be inserted into
139 -- the Schema), and therefore could never have a corresponding row.
140 --
141 -- Post Failure:
142 -- A failure can only occur under two circumstances:
143 -- 1) The primary key is invalid (i.e. a row does not exist for the
144 -- specified primary key values).
145 -- 2) If an object_version_number exists but is NOT the same as the current
146 -- g_old_rec value.
147 --
148 -- Developer Implementation Notes:
149 -- None.
150 --
151 -- Access Status:
152 -- Internal Development Use Only.
153 --
154 -- {End Of Comments}
155 -- ----------------------------------------------------------------------------
156 Function api_updating
157 (p_pil_assignment_id in number
158 ,p_object_version_number in number
159 ) Return Boolean;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |---------------------------------< lck >----------------------------------|
163 -- ----------------------------------------------------------------------------
164 -- {Start of comments}
165 --
166 -- Description:
167 -- The Lck process has two main functions to perform. Firstly, the row to be
168 -- updated or deleted must be locked. The locking of the row will only be
169 -- successful if the row is not currently locked by another user.
170 -- Secondly, during the locking of the row, the row is selected into
171 -- the g_old_rec data structure which enables the current row values from
172 -- the server to be available to the api.
173 --
174 -- Prerequisites:
175 -- When attempting to call the lock the object version number (if defined)
176 -- is mandatory.
177 --
178 -- In Parameters:
179 -- The arguments to the Lck process are the primary key(s) which uniquely
180 -- identify the row and the object version number of row.
181 --
182 -- Post Success:
183 -- On successful completion of the Lck process the row to be updated or
184 -- deleted will be locked and selected into the global data structure
185 -- g_old_rec.
186 --
187 -- Post Failure:
188 -- The Lck process can fail for three reasons:
189 -- 1) When attempting to lock the row the row could already be locked by
190 -- another user. This will raise the HR_Api.Object_Locked exception.
191 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
192 -- This error is trapped and reported using the message name
193 -- 'HR_7220_INVALID_PRIMARY_KEY'.
194 -- 3) The row although existing in the HR Schema has a different object
195 -- version number than the object version number specified.
196 -- This error is trapped and reported using the message name
197 -- 'HR_7155_OBJECT_INVALID'.
198 --
199 -- Developer Implementation Notes:
200 -- For each primary key and the object version number arguments add a
201 -- call to hr_api.mandatory_arg_error procedure to ensure that these
202 -- argument values are not null.
203 --
204 -- Access Status:
205 -- Internal Development Use Only.
206 --
207 -- {End of comments}
208 -- ----------------------------------------------------------------------------
209 Procedure lck
210 (p_pil_assignment_id in number
211 ,p_object_version_number in number
212 );
213 --
214 -- ----------------------------------------------------------------------------
215 -- |-----------------------------< convert_args >-----------------------------|
216 -- ----------------------------------------------------------------------------
217 -- {Start Of Comments}
218 --
219 -- Description:
220 -- This function is used to turn attribute parameters into the record
221 -- structure parameter g_rec_type.
222 --
223 -- Prerequisites:
224 -- This is a private function and can only be called from the ins or upd
225 -- attribute processes.
226 --
227 -- In Parameters:
228 --
229 -- Post Success:
230 -- A returning record structure will be returned.
231 --
232 -- Post Failure:
233 -- No direct error handling is required within this function. Any possible
234 -- errors within this function will be a PL/SQL value error due to
235 -- conversion of datatypes or data lengths.
236 --
237 -- Developer Implementation Notes:
238 -- None.
239 --
240 -- Access Status:
241 -- Internal Row Handler Use Only.
242 --
243 -- {End Of Comments}
244 -- ----------------------------------------------------------------------------
245 Function convert_args
246 (p_pil_assignment_id in number
247 ,p_per_in_ler_id in number
248 ,p_applicant_assignment_id in number
249 ,p_offer_assignment_id in number
250 ,p_object_version_number in number
251 )
252 Return g_rec_type;
253 --
254 end ben_psg_shd;