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