DBA Data[Home] [Help]

PACKAGE: APPS.QA_DEVICE_PUB

Source


1 PACKAGE qa_device_pub AUTHID CURRENT_USER AS
2 /* $Header: qadvpubs.pls 120.1.12010000.1 2008/07/25 09:19:19 appldev ship $ */
3 /*#
4  * This package is the public interface for Device info setup and saving
5  * of device data values. It allows for creation/removal of devices from Oracle Quality.
6  * This is handled as a bulk operation. The package also has APIs to capture device data
7  * values which can be later read from the Quality Collection Results UI.
8  * The device data values can be set for a single device or for multiple devices in bulk.
9  * @rep:scope public
10  * @rep:product QA
11  * @rep:displayname Device Integration Public APIs
12  * @rep:lifecycle active
13  * @rep:category BUSINESS_ENTITY QA_PLAN
14  */
15 
16 --
17 -- Global type definitions
18 --
19 
20 TYPE VARCHAR2000_TABLE IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;
21 TYPE VARCHAR2_TABLE    IS TABLE OF VARCHAR2(256)  INDEX BY BINARY_INTEGER;
22 TYPE NUMBER_TABLE      IS TABLE OF NUMBER         INDEX BY BINARY_INTEGER;
23 TYPE DATE_TABLE        IS TABLE OF DATE           INDEX BY BINARY_INTEGER;
24 
25 --
26 -- API name        : set_device_data
27 -- Type            : Public
28 -- Pre-reqs        : None
29 --
30 -- API to set device data value for a single device.
31 -- Version 1.0
32 --
33 -- This API is used to set the data value from a single device.
34 -- It updates the corresponding row for the device and inserts
35 -- a new row in case a row for the device doesn't exist in qa_device_data_values.
36 --
37 --
38 -- Parameters:
39 --
40 --  p_api_version                                           NUMBER
41 --     Should be 1.0
42 --
43 --  p_init_msg_list                                         VARCHAR2
44 --     Standard api parameter.  Indicates whether to
45 --     re-initialize the message list.
46 --     Default is fnd_api.g_false.
47 --
48 --  p_validation_level                                      NUMBER
49 --     Standard api parameter.  Indicates validation level.
50 --     Use the default fnd_api.g_valid_level_full.
51 --
52 --  p_user_name                                             VARCHAR2(100)
53 --     The user's name, as defined in fnd_user table.
54 --     This is used to record audit info in the WHO columns.
55 --     If the user accepts the default, then the API will
56 --     use fnd_global.user_id.
57 --
58 --  p_device_source                                         VARCHAR2(256)
59 --     The device source as defined during device setup.
60 --
61 --  p_device_name                                           VARCHAR2(256)
62 --     Unique device name.
63 --
64 --  p_device_data                                           VARCHAR2(256)
65 --     Data read from the device.
66 --
67 --  p_device_event_time                                     DATE
68 --     The time of generation of data from the device.
69 --
70 --  p_quality_code                                          NUMBER
71 --     The Quality of data. Only data with quality
72 --     192(0xC0) or 216(0xD8) will be accepted
73 --
74 --  p_commit                                                VARCHAR2
75 --     Indicates whether the API shall perform a
76 --     database commit.  Specify fnd_api.g_true or
77 --     fnd_api.g_false.
78 --     Default is fnd_api.g_true.
79 --
80 --  x_msg_count                                             OUT NUMBER
81 --     Standard api parameter.  Indicates no. of messages
82 --     put into the message stack.
83 --
84 --  x_msg_data                                              OUT VARCHAR2
85 --     Standard api parameter.  Messages returned.
86 --
87 --  x_return_status                                         OUT VARCHAR2
88 --     Standard api return status parameter.
89 --     Values: fnd_api.g_ret_sts_success,
90 --             fnd_api.g_ret_sts_error,
91 --             fnd_api.g_ret_sts_unexp_error.
92 --
93 /*#
94  * API to set device data value for a single device.
95  * @param p_api_version Current version is 1.0
96  * @param p_init_msg_list Indicates whether to re-initialize the message list
97  * @param p_validation_level Indicates validation level
98  * @param p_user_name The user's name, as defined in fnd_user table
99  * @param p_device_source An identifier indicating the source, generally use 'OPC'
100  * @param p_device_name Full qualifying identifier of a device I/O, max 256
101  * @param p_device_data Device data, max 256
102  * @param p_device_event_time The timestamp when value was generated by device
103  * @param p_quality_code A numeric code indicating the quality of the reading
104  * @param p_commit Indicate if database commit should be performed
105  * @param x_msg_count Count of messages in message stack
106  * @param x_msg_data Messages returned if any
107  * @param x_return_status API return status
108  * @rep:displayname Set device value
109  */
110 PROCEDURE set_device_data(
111     p_api_version               IN  NUMBER,
112     p_init_msg_list             IN  VARCHAR2 := fnd_api.g_false,
113     p_validation_level          IN  NUMBER   := fnd_api.g_valid_level_full,
114     p_user_name                 IN  VARCHAR2 := NULL,
115     p_device_source             IN  VARCHAR2,
116     p_device_name               IN  VARCHAR2,
117     p_device_data               IN  VARCHAR2,
118     p_device_event_time         IN  DATE,
119     p_quality_code              IN  NUMBER,
120     p_commit                    IN  VARCHAR2 := fnd_api.g_true,
121     x_msg_count                 OUT NOCOPY NUMBER,
122     x_msg_data                  OUT NOCOPY VARCHAR2,
123     x_return_status             OUT NOCOPY VARCHAR2);
124 
125 
126 --
127 -- API name        : set_device_data_bulk
128 -- Type            : Public
129 -- Pre-reqs        : None
130 --
131 -- API to set device data values for multiple devices.
132 -- Version 1.0
133 --
134 -- This API is used to set the data values from multiple devices.
135 -- It updates the corresponding rows for each device and inserts
136 -- a new row in case a row for the device doesn't exist in qa_device_data_values.
137 --
138 --
139 -- Parameters:
140 --
141 --  p_api_version                                           NUMBER
142 --     Should be 1.0
143 --
144 --  p_init_msg_list                                         VARCHAR2
145 --     Standard api parameter.  Indicates whether to
146 --     re-initialize the message list.
147 --     Default is fnd_api.g_false.
148 --
149 --  p_validation_level                                      NUMBER
150 --     Standard api parameter.  Indicates validation level.
151 --     Use the default fnd_api.g_valid_level_full.
152 --
153 --  p_user_name                                             VARCHAR2(100)
154 --     The user's name, as defined in fnd_user table.
155 --     This is used to record audit info in the WHO columns.
156 --     If the user accepts the default, then the API will
157 --     use fnd_global.user_id.
158 --
159 --  p_device_source                                         VARCHAR2(256)
160 --     The device source as defined during device setup.
161 --
162 --  p_device_name                                           VARCHAR2_TABLE
163 --     Unique device name.
164 --
165 --  p_device_data                                           VARCHAR2_TABLE
166 --     Data read from the device.
167 --
168 --  p_device_event_time                                     DATE_TABLE
169 --     The time of generation of data from the device.
170 --
171 --  p_quality_code                                          NUMBER_TABLE
172 --     The Quality of data. Only data with quality
173 --     192(0xC0) or 216(0xD8) will be accepted.
174 --
175 --  p_commit                                                VARCHAR2
176 --     Indicates whether the API shall perform a
177 --     database commit.  Specify fnd_api.g_true or
178 --     fnd_api.g_false.
179 --     Default is fnd_api.g_true.
180 --
181 --  x_msg_count                                             OUT NUMBER
182 --     Standard api parameter.  Indicates no. of messages
183 --     put into the message stack.
184 --
185 --  x_msg_data                                              OUT VARCHAR2
186 --     Standard api parameter.  Messages returned.
187 --
188 --  x_return_status                                         OUT VARCHAR2
189 --     Standard api return status parameter.
190 --     Values: fnd_api.g_ret_sts_success,
191 --             fnd_api.g_ret_sts_error,
192 --             fnd_api.g_ret_sts_unexp_error.
193 --
194 /*#
195  * API to set device data values for multiple devices.
196  * @param p_api_version Current version is 1.0
197  * @param p_init_msg_list Indicates whether to re-initialize the message list
198  * @param p_validation_level Indicates validation level
199  * @param p_user_name The user's name, as defined in fnd_user table
200  * @param p_device_source An identifier indicating the source, generally use 'OPC'
201  * @param p_device_name An array of full qualifying identifiers, each max 256
202  * @param p_device_data An array of device data, each max 256
203  * @param p_device_event_time An array of timestamp when values were generated by devices
204  * @param p_quality_code An array of numeric codes indicating the quality of the readings
205  * @param p_commit Indicate if database commit should be performed
206  * @param x_msg_count Count of messages in message stack
207  * @param x_msg_data Messages returned if any
208  * @param x_return_status API return status
209  * @rep:displayname Set multiple device values by bulk operation
210  */
211 PROCEDURE set_device_data_bulk(
212     p_api_version               IN  NUMBER,
213     p_init_msg_list             IN  VARCHAR2 := fnd_api.g_false,
214     p_validation_level          IN  NUMBER   := fnd_api.g_valid_level_full,
215     p_user_name                 IN  VARCHAR2 := NULL,
216     p_device_source             IN  VARCHAR2,
217     p_device_name               IN  VARCHAR2_TABLE,
218     p_device_data               IN  VARCHAR2_TABLE,
219     p_device_event_time         IN  DATE_TABLE,
220     p_quality_code              IN  NUMBER_TABLE,
221     p_commit                    IN  VARCHAR2 := fnd_api.g_true,
222     x_msg_count                 OUT NOCOPY NUMBER,
223     x_msg_data                  OUT NOCOPY VARCHAR2,
224     x_return_status             OUT NOCOPY VARCHAR2);
225 
226 --
227 -- API name        : add_device_info_bulk
228 -- Type            : Public
229 -- Pre-reqs        : None
230 --
231 -- API to add device setup info in bulk in Oracle Quality.
232 -- Version 1.0
233 --
234 -- This API is used to add one or more new devices to Oracle.
235 -- It adds rows to the qa_device_info internal table that stores
236 -- device meta data, one row per device name.  It also adds rows to
237 -- the qa_device_data_values internal table to prepare for updates by
238 -- the set_device_data APIs used during actual data pushing
239 --
240 --
241 -- Parameters:
242 --
243 --  p_api_version                                           NUMBER
244 --     Should be 1.0
245 --
246 --  p_init_msg_list                                         VARCHAR2
247 --     Standard api parameter.  Indicates whether to
248 --     re-initialize the message list.
249 --     Default is fnd_api.g_false.
250 --
251 --  p_validation_level                                      NUMBER
252 --     Standard api parameter.  Indicates validation level.
253 --     Use the default fnd_api.g_valid_level_full.
254 --
255 --  p_user_name                                             VARCHAR2(100)
256 --     The user's name, as defined in fnd_user table.
257 --     This is used to record audit info in the WHO columns.
258 --     If the user accepts the default, then the API will
259 --     use fnd_global.user_id.
260 --
261 --  p_device_source                                         VARCHAR2(256)
262 --     The device source.  Always pass in 'OPC'
263 --
264 --  p_device_name                                           VARCHAR2_TABLE
265 --     Unique device name.
266 --
267 --  p_device_desc                                           VARCHAR2000_TABLE
268 --     Meaningful description for the device
269 --
270 --  p_expiration                                            NUMBER_TABLE
271 --     The maximum time in ms to check the validity
272 --     of data from the device. Data older than this
273 --     will be rejected.
274 --
275 --  p_commit                                                VARCHAR2
276 --     Indicates whether the API shall perform a
277 --     database commit.  Specify fnd_api.g_true or
278 --     fnd_api.g_false.
279 --     Default is fnd_api.g_true.
280 --
281 --  x_msg_count                                             OUT NUMBER
282 --     Standard api parameter.  Indicates no. of messages
283 --     put into the message stack.
284 --
285 --  x_msg_data                                              OUT VARCHAR2
286 --     Standard api parameter.  Messages returned.
287 --
288 --  x_return_status                                         OUT VARCHAR2
289 --     Standard api return status parameter.
290 --     Values: fnd_api.g_ret_sts_success,
291 --             fnd_api.g_ret_sts_error,
295  * API to add device setup info in bulk to Oracle Quality internal table.
292 --             fnd_api.g_ret_sts_unexp_error.
293 --
294 /*#
296  * @param p_api_version Current version is 1.0
297  * @param p_init_msg_list Indicates whether to re-initialize the message list
298  * @param p_validation_level Indicates validation level
299  * @param p_user_name The user's name, as defined in fnd_user table
303  * @param p_expiration An array of numbers, each in milliseconds; if data in device data table is older than this, it will be considered expired
300  * @param p_device_source An identifier indicating the source, generally use 'OPC'
301  * @param p_device_name An array of full qualifying identifiers, each max 256
302  * @param p_device_desc An array of device description, any one element be null, each max 2000
304  * @param p_commit Indicate if database commit should be performed
305  * @param x_msg_count Count of messages in message stack
306  * @param x_msg_data Messages returned if any
307  * @param x_return_status API return status
308  * @rep:displayname Add multiple devices by bulk operation
309  */
310 PROCEDURE add_device_info_bulk(
311     p_api_version               IN  NUMBER,
312     p_init_msg_list             IN  VARCHAR2 := fnd_api.g_false,
313     p_validation_level          IN  NUMBER   := fnd_api.g_valid_level_full,
314     p_user_name                 IN  VARCHAR2 := NULL,
315     p_device_source             IN  VARCHAR2,
316     p_device_name               IN  VARCHAR2_TABLE,
317     p_device_desc               IN  VARCHAR2000_TABLE,
318     p_expiration                IN  NUMBER_TABLE,
319     p_commit                    IN  VARCHAR2 := fnd_api.g_true,
320     x_msg_count                 OUT NOCOPY NUMBER,
321     x_msg_data                  OUT NOCOPY VARCHAR2,
325 --
322     x_return_status             OUT NOCOPY VARCHAR2);
323 
324 
326 -- API name        : delete_device_info_bulk
327 -- Type            : Public
328 -- Pre-reqs        : None
329 --
330 -- API to delete device setup info in bulk from Oracle Quality.
331 -- Version 1.0
332 --
333 -- This API is used to delete one or more devices from Oracle Quality's
334 -- internal table - qa_device_info. Changes will be Committed by default.
335 --
336 --
337 -- Parameters:
338 --
339 --  p_api_version                                           NUMBER
340 --     Should be 1.0
341 --
342 --  p_init_msg_list                                         VARCHAR2
343 --     Standard api parameter.  Indicates whether to
344 --     re-initialize the message list.
345 --     Default is fnd_api.g_false.
346 --
347 --  p_validation_level                                      NUMBER
348 --     Standard api parameter.  Indicates validation level.
349 --     Use the default fnd_api.g_valid_level_full.
350 --
351 --  p_user_name                                             VARCHAR2(100)
352 --     The user's name, as defined in fnd_user table.
353 --     This is used to record audit info in the WHO columns.
354 --     If the user accepts the default, then the API will
355 --     use fnd_global.user_id.
356 --
357 --  p_device_source                                         VARCHAR2(256)
358 --     The device source as setup for the
359 --     corresponding device name.
360 --
361 --  p_device_name                                           VARCHAR2_TABLE
362 --     Name of device to be deleted.
363 --
364 --  p_commit                                                VARCHAR2
365 --     Indicates whether the API shall perform a
366 --     database commit.  Specify fnd_api.g_true or
367 --     fnd_api.g_false.
368 --     Default is fnd_api.g_true.
369 --
370 --  x_msg_count                                             OUT NUMBER
371 --     Standard api parameter.  Indicates no. of messages
372 --     put into the message stack.
373 --
374 --  x_msg_data                                              OUT VARCHAR2
375 --     Standard api parameter.  Messages returned.
376 --
377 --  x_return_status                                         OUT VARCHAR2
378 --     Standard api return status parameter.
379 --     Values: fnd_api.g_ret_sts_success,
380 --             fnd_api.g_ret_sts_error,
381 --             fnd_api.g_ret_sts_unexp_error.
382 --
383 /*#
384  * API to delete one or more devices from Oracle Quality's
385  * internal table - qa_device_info.
386  * @param p_api_version Current version is 1.0
387  * @param p_init_msg_list Indicates whether to re-initialize the message list
388  * @param p_validation_level Indicates validation level
389  * @param p_user_name The user's name, as defined in fnd_user table
390  * @param p_device_source An identifier indicating the source, generally use 'OPC'
391  * @param p_device_name An array of full qualifying identifiers to be deleted, each max 256
392  * @param p_commit Indicate if database commit should be performed
393  * @param x_msg_count Count of messages in message stack
394  * @param x_msg_data Messages returned if any
395  * @param x_return_status API return status
396  * @rep:displayname Delete multiple devices by bulk operation
397  */
398 PROCEDURE delete_device_info_bulk(
399     p_api_version               IN  NUMBER,
400     p_init_msg_list             IN  VARCHAR2 := fnd_api.g_false,
401     p_validation_level          IN  NUMBER   := fnd_api.g_valid_level_full,
402     p_user_name                 IN  VARCHAR2 := NULL,
403     p_device_source             IN  VARCHAR2,
404     p_device_name               IN  VARCHAR2_TABLE,
405     p_commit                    IN  VARCHAR2 := fnd_api.g_true,
406     x_msg_count                 OUT NOCOPY NUMBER,
407     x_msg_data                  OUT NOCOPY VARCHAR2,
408     x_return_status             OUT NOCOPY VARCHAR2);
409 
410 END qa_device_pub;