1 PACKAGE jdr_mds_internal AS
2 /* $Header: JDRMDINS.pls 120.3 2005/10/26 06:15:35 akbansal noship $ */
3 -----------------------------------------------------------------------------
4 ---------------------------- PRIVATE VARIABLES ------------------------------
5 -----------------------------------------------------------------------------
6 -- Maximum # of attempts to try when locking
7 MAX_SECONDS_TO_WAIT_FOR_LOCK CONSTANT INTEGER := 10;
8
9 --
10 -- Creates an entry in the jdr_paths table for the document or package.
11 -- The full name of the document/package must be specified. Any packages
12 -- which do not already exist will be created as well.
13 --
14 -- Parameters:
15 -- username - user who is creating the document
16 -- fullPathName - the complete path name of the document or package
17 -- docType - either 'PACKAGE' or 'DOCUMENT'
18 -- xmlversion - xml version
19 -- xmlencoding - xml encoding
20 --
21 -- Returns:
22 -- the ID of the created path
23 --
24 FUNCTION createPath(
25 username VARCHAR2,
26 fullPathName VARCHAR2,
27 docType VARCHAR2,
28 xmlversion VARCHAR2,
29 xmlencoding VARCHAR2) RETURN NUMBER;
30
31
32 --
33 -- Creates an entry in the jdr_paths document.
34 --
35 -- Parameters:
36 -- username - user who is creating the document
37 -- pathname - the name of the document/package (not fully qualified)
38 -- ownerID - the ID of the owning package
39 -- pathSeq - sequence of the path
40 -- docType - either 'DOCUMENT' or 'PACKAGE'
41 -- xmlversion - xml version, which can be null for "child" documents
42 -- xmlencoding - xml encoding, which can be null for "child" documents
43 --
44 -- Returns:
45 -- the ID of the created path
46
47 --
48 FUNCTION createPath(
49 username VARCHAR2,
50 pathname VARCHAR2,
51 ownerID JDR_PATHS.PATH_OWNER_DOCID%TYPE,
52 pathSeq JDR_PATHS.PATH_SEQ%TYPE,
53 docType VARCHAR2,
54 xmlversion VARCHAR2 DEFAULT NULL,
55 xmlencoding VARCHAR2 DEFAULT NULL) RETURN NUMBER;
56
57
58 --
59 -- Delete the document.
60 --
61 -- Parameters:
62 -- docID - ID of the document to delete
63 -- isDrop - should the document be dropped as well. If TRUE, then the
64 -- document will be completely removed. If FALSE, then only
65 -- the contents of the document will be deleted, and the entry
66 -- in the jdr_paths table will remain.
67 --
68 -- Notes:
69 -- If the document is a package document, then the "child" documents will
70 -- be deleted as well.
71 --
72 PROCEDURE deleteDocument(
73 docID JDR_PATHS.PATH_DOCID%TYPE,
74 isDrop BOOLEAN DEFAULT FALSE);
75
76 --
77 -- Drops the document and the document's contents from the repository.
78 -- If the document is a package document, the "child" documents of the
79 -- package document will be dropped as well.
80 --
81 PROCEDURE dropDocument(
82 docID JDR_PATHS.PATH_DOCID%TYPE);
83
84
85 --
86 -- This method has been deprecated. Please use the function which
87 -- has a return value which indicates whether or not the export is
88 -- complete.
89 --
90 -- Export the XML for a document and pass it back in 32k chunks. This
91 -- function will return XML chunks, with a maximum size of 32k. When
92 -- the entire document has been exported, this function will return NULL.
93 --
94 -- Specifying a document name will initiate the export. Thereafter, a NULL
95 -- document name should be passed in until the export is complete.
96 -- That is, to export an entire document, you should do:
97 --
98 -- firstChunk := jdr_mds_internal.exportDocumentAsXML('/oracle/apps/fnd/mydoc');
99 -- LOOP
100 -- nextChunk := jdr_mds_internal.exportDocumentAsXML(NULL);
101 -- EXIT WHEN nextChunk IS NULL;
102 -- END LOOP;
103 --
104 -- Parameters:
105 -- fullName - the fully qualifued name of the document. however,
106 -- after the first chunk of text is exported, a NULL value
107 -- should be passed in.
108 --
109 -- formatted - a non-zero value indicates that the XML is formatted nicely
110 -- (i.e. whether or not the elements are indented)
111 --
112 -- allowChildDoc - a non-zero value indicates that "child" documents
113 -- can be exported, where child documents are documents
114 -- which exist as part of a package document
115 --
116 -- includePackage - a non-zero value indicates that, if this is a "child"
117 -- document and it allowChildDoc is TRUE, then the entire
118 -- package document should be exported; otherwise, only
119 -- the XML for the child document will be exported.
120 --
121 -- Returns:
122 -- The exported XML, in 32k chunks.
123 --
124 FUNCTION exportDocumentAsXML(
125 fullName VARCHAR2,
126 formatted INTEGER DEFAULT 1,
127 allowChildDoc INTEGER DEFAULT 0,
128 includePackage INTEGER DEFAULT 0) RETURN VARCHAR2;
129
130
131 --
132 -- Export the XML for a document and pass it back in 32k chunks. This
133 -- function will return XML chunks, with a maximum size of 32k.
134 --
135 -- Specifying a document name will initiate the export. Thereafter, a NULL
136 -- document name should be passed in until the export is complete.
137 -- That is, to export an entire document, you should do:
138 --
139 -- firstChunk := jdr_mds_internal.exportDocumentAsXML(isDone,
140 -- '/oracle/apps/fnd/mydoc');
141 -- WHILE (isDone = 0)
142 -- nextChunk := jdr_mds_internal.exportDocumentAsXML(isDone, NULL);
143 -- END LOOP;
144 --
145 -- Parameters:
146 -- exportFinished - OUT parameter which indicates whether or not the export
147 -- is complete. 1 indicates the entire document is
148 -- exported, 0 indicates that there are more chunks
149 -- remaining.
150 --
151 -- fullName - the fully qualifued name of the document. however,
152 -- after the first chunk of text is exported, a NULL value
153 -- should be passed in.
154 --
155 -- formatted - a non-zero value indicates that the XML is formatted nicely
156 -- (i.e. whether or not the elements are indented)
157 --
158 -- allowChildDoc - a non-zero value indicates that "child" documents
159 -- can be exported, where child documents are documents
160 -- which exist as part of a package document
161 --
162 -- includePackage - a non-zero value indicates that, if this is a "child"
163 -- document and it allowChildDoc is TRUE, then the entire
164 -- package document should be exported; otherwise, only
165 -- the XML for the child document will be exported.
166 --
167 -- Returns:
168 -- The exported XML, in 32k chunks.
169 --
170 FUNCTION exportDocumentAsXML(
171 exportFinished OUT NOCOPY /* file.sql.39 change */ INTEGER,
172 fullName VARCHAR2,
173 formatted INTEGER DEFAULT 1,
174 allowChildDoc INTEGER DEFAULT 0,
175 includePackage INTEGER DEFAULT 0) RETURN VARCHAR2;
176
177
178 --
179 -- Export the translations in XLIFF format. The document will be
180 -- exported in 32k chunks.
181 --
182 -- Specifying a document name will initiate the export. Thereafter, a NULL
183 -- document name should be passed in until the export is complete.
184 -- That is, to export an entire document, you should do:
185 --
186 -- firstChunk := jdr_mds_internal.exportXLIFFDocument(isDone,
187 -- '/oracle/apps/mydoc',
188 -- 'mylanguage');
189 --
190 -- WHILE (isDone = 0) LOOP
191 -- nextChunk := jdr_mds_internal.exportXLIFFDocument(isDone, NULL, NULL);
192 -- END LOOP;
193 --
194 FUNCTION exportXLIFFDocument(
195 exportFinished OUT NOCOPY /* file.sql.39 change */ INTEGER,
196 document VARCHAR2,
197 language VARCHAR2) RETURN VARCHAR2;
198
199 --
200 -- Retrieves the document id for the specified fully qualified path name.
201 -- The pathname must begin with a '/' and should look something like:
202 -- /oracle/apps/AK/mydocument
203 --
204 -- Parameters:
205 -- fullPathName - the fully qualified name of the document
206 -- pathType - the type of the document, either 'DOCUMENT' or 'PACKAGE'
207 -- if no type is specified, and there happens to be a path
208 -- of both 'DOCUMENT' and 'PACKAGE' (which is unlikely),
209 -- then the id of the DOCUMENT will be returned
210 --
211 -- Returns:
212 -- Returns the ID of the path or -1 if no such path exists
213 --
214 FUNCTION getDocumentID(
215 fullPathName VARCHAR2,
216 pathType VARCHAR2 DEFAULT NULL) RETURN NUMBER;
217
218
219 --
220 -- Retrieves the document id for the specified attributes. This is
221 -- typically used when attempting to find the id of a path which is
222 -- owned by a package document.
223 --
224 -- Note that this will return the docID which matches the specified
225 -- name, ownerID and docType (not pathSeq). For the pathSeq, it will
226 -- update the database path_seq to the value specified in pathSeq.
227 --
228 -- Parameters:
229 -- name - the name of the document (not fully qualified)
230 -- ownerID - the ID of the owning package
231 -- pathSeq - the path sequence
232 -- docType - either 'DOCUMENT' or 'PACKAGE'
233 --
234 -- Returns:
235 -- Returns the ID of the path or -1 if no such path exists
236 --
237 FUNCTION getDocumentID(
238 name VARCHAR2,
239 ownerID JDR_PATHS.PATH_OWNER_DOCID%TYPE,
240 pathSeq JDR_PATHS.PATH_SEQ%TYPE,
241 docType JDR_PATHS.PATH_TYPE%TYPE) RETURN NUMBER;
242
243
244 --
245 -- For each document name, retrieve the corresponding document ID.
246 -- The document ID for docs[i] is in docIDs[i]
247 --
248 PROCEDURE getDocumentIDs(docs IN jdr_stringArray,
249 docIDs OUT NOCOPY /* file.sql.39 change */ jdr_numArray);
250
251
252 --
253 -- Given the document id, find the fully qualified document name
254 --
255 -- Parameters:
256 -- docID - the ID of the document
257 --
258 -- Returns:
259 -- the fully qualified document name
260 --
261 FUNCTION getDocumentName(
262 docID NUMBER) RETURN VARCHAR2;
263
264 --
265 -- Given the document id of a child document, find the id for the
266 -- owning package document.
267 --
268 -- Parameters:
269 -- docID - the ID of the child document
270 --
271 -- Returns:
272 -- Returns the ID of the package document or -1 if not found
273 --
274 FUNCTION getPackageDocument(
275 docID NUMBER) RETURN NUMBER;
276
277
278 --
279 -- Gets the minimun version of JRAD with which the repository API is
280 -- compatible. That is, the actual JRAD version must be >= to the
281 -- minimum version of JRAD in order for the repositroy API and java code to
282 -- be compatible.
283 --
284 -- Returns:
285 -- Returns the mimumum version of JRAD
286 --
287 FUNCTION getMinJRADVersion RETURN VARCHAR2;
288
289
290 --
291 -- Gets the version of the repository API. This API version must >= to the
292 -- java constant CompatibleVersions.MIN_REPOS_VERSION.
293 --
294 -- Returns:
295 -- Returns the version of the repository
296 --
297 FUNCTION getRepositoryVersion RETURN VARCHAR2;
298
299
300 --
301 -- Lock the document. Before updating/saving a document, the document needs
302 -- to be locked to insure that it is not updated simultaneously by multiple
303 -- users. If the document is already locked, we will continue to attempt to
304 -- lock the document for a user-specified number of seconds, or
305 -- MAX_SECONDS_TO_WAIT_FOR_LOCK by default, before giving up.
306 -- If, after that time, we have still not locked the document, a
307 -- "RESOURCEBUSY" exception will be raised.
308 --
309 -- Parameters:
310 -- docID - ID of the document to lock
311 -- attempts - number of seconds to wait for a lock
312 --
313 PROCEDURE lockDocument(
314 docID JDR_PATHS.PATH_DOCID%TYPE,
315 attempts INTEGER DEFAULT MAX_SECONDS_TO_WAIT_FOR_LOCK);
316
317
318 --
319 -- Performs all steps that are necessary before a top-level document is
320 -- saved/updated which includes:
321 -- (1) If the document already exists, updates the "who" columns in
322 -- JDR_PATHS and deletes the contents of the document
323 -- (2) If the document does not exist yet, creates a new entry in the
324 -- JDR_PATHS table
325 --
326 -- Parameters:
327 -- username - user who is updating/inserting the document
328 -- fullPathName - fully qualified name of the document/package file
329 -- pathType - 'DOCUMENT' for document or 'PACKAGE' for package
330 -- file
331 -- xmlversion - xml version
332 -- xmlencoding - xml encoding
333 --
334 -- Returns:
335 -- Returns the ID of the document or -1 if an error occurred
336 --
337 FUNCTION prepareDocumentForInsert(
338 username VARCHAR2,
339 fullPathName VARCHAR2,
340 pathType VARCHAR2,
341 xmlversion VARCHAR2,
342 xmlencoding VARCHAR2) RETURN NUMBER;
343
344
345 --
346 -- Performs all steps that are necessary before a package document is
347 -- saved/updated which includes:
348 -- (1) If the document already exists, updates the "who" columns in
349 -- JDR_PATHS
350 -- (2) If the document does not exist yet, creates a new entry in the
351 -- JDR_PATHS table
352 --
353 -- Parameters:
354 -- username - user who is updating/inserting the document
355 -- pathname - name of the document/package
356 -- ownerID - ID of the owning package
357 -- pathSeq - path sequence
358 -- pathType - 'DOCUMENT' or 'PACKAGE'
359 --
360 -- Returns:
361 -- Returns the ID of the document or -1 if an error occurred
362 --
363 FUNCTION prepareDocumentForInsert(
364 username VARCHAR2,
365 pathname VARCHAR2,
366 ownerID JDR_PATHS.PATH_OWNER_DOCID%TYPE,
367 pathSeq JDR_PATHS.PATH_SEQ%TYPE,
368 pathType JDR_PATHS.PATH_TYPE%TYPE) RETURN NUMBER;
369
370
371 --
372 -- Refactors the specified component/document by making the necessary
373 -- changes to any customized documents which customized the "old" document;
374 -- and by making the necessary changes (if p_translations is
375 -- TRUE) to translations as well.
376 --
377 -- For more information on the type of changes which are necessary, please
378 -- refer to the refactoring document.
379 --
380 -- Parameters:
381 -- p_oldName - the original name of the component/document
382 -- p_newName - the new name of the component/document
383 -- p_translations - make necessary changes to translations if TRUE
384 --
385 -- Returns:
386 -- Returns the number of changes which were made, and 0 if no changes
387 -- were necessary
388 --
389 FUNCTION refactor(
390 p_oldName VARCHAR2,
391 p_newName VARCHAR2,
392 p_translations INTEGER DEFAULT 1) RETURN INTEGER;
396 -- Remove any dangling references of the document. This is only necessary
393
394
395 --
397 -- for package documents. Here's a scenario where this is relevant.
398 -- Suppose you have a package document FOO which has child documents A, B and
399 -- C. Now suppose you are updating FOO, this time removing document C.
400 -- In order make sure that all references to C are destroyed, this needs to
401 -- be called after saving FOO.
402 --
403 PROCEDURE removeDanglingReferences(
404 docID JDR_PATHS.PATH_DOCID%TYPE);
405
406 END;