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