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