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