DBA Data[Home] [Help]

PACKAGE: APPS.JDR_UTILS

Source


1 PACKAGE jdr_utils AUTHID CURRENT_USER AS
2 /* $Header: JDRUTEXS.pls 120.3 2005/10/26 06:16:00 akbansal noship $ */
3 
4   -----------------------------------------------------------------------------
5   ---------------------------- PUBLIC VARIABLES -------------------------------
6   -----------------------------------------------------------------------------
7   MAX_LINE_SIZE CONSTANT NUMBER := 255;
8 
9   -----------------------------------------------------------------------------
10   ------------------------------ PUBLIC TYPES ---------------------------------
11   -----------------------------------------------------------------------------
12   TYPE translation IS RECORD
13   (
14     lang      jdr_attributes_trans.atl_lang%TYPE,
15     compref   jdr_attributes_trans.atl_comp_ref%TYPE,
16     name      jdr_attributes_trans.atl_name%TYPE,
17     value     jdr_attributes_trans.atl_value%TYPE
18   );
19 
20   TYPE translationList IS TABLE OF translation;
21 
22   -- Exception raised when document does not exist
23   no_such_document EXCEPTION;
24 
25   -----------------------------------------------------------------------------
26   ---------------------------- PUBLIC FUNCTIONS -------------------------------
27   -----------------------------------------------------------------------------
28 
29   -- Deletes the document from the repository.
30   --
31   -- Parameters:
32   --  p_document    - the fully qualified document name, which can represent
33   --                  either a document or package file.
34   --                  (i.e.  '/oracle/apps/ak/attributeSets')
35   --
36   PROCEDURE deleteDocument(p_document VARCHAR2);
37 
38   -- Deletes all empty customization documents from the repository. An empty
39   -- customization document is a customization document that does not specify
40   -- any modifications to the base metadata.
41   --
42   -- Example 1: /oracle/apps/hr/customizations/localization/US/page1
43   -- <customization customizes="/oracle/apps/hr/page1"
44   --                xmlns="http://xmlns.oracle.com/jrad"
45   --                xmlns:ui="http://xmlns.oracle.com/uix/ui"
46   --                xmlns:oa="http://xmlns.oracle.com/oa"
47   --                xmlns:user="http://xmlns.oracle.com/jrad/user"
48   --                file-version="$Header: JDRUTEXS.pls 120.3 2005/10/26 06:16:00 akbansal noship $" version="9.0.3.6.6_557"
49   --                xml:lang="en-US">
50   --    <modifications/>
51   -- </customization>
52   --
53   -- Example 2: /oracle/apps/hr/customizations/user/100/page1
54   -- <customization customizes="/oracle/apps/hr/page1"
55   --                xmlns="http://xmlns.oracle.com/jrad"
56   --                xmlns:ui="http://xmlns.oracle.com/uix/ui"
57   --                xmlns:oa="http://xmlns.oracle.com/oa"
58   --                xmlns:user="http://xmlns.oracle.com/jrad/user"
59   --                file-version="$Header: JDRUTEXS.pls 120.3 2005/10/26 06:16:00 akbansal noship $" version="9.0.3.6.6_557"
60   --                xml:lang="en-US">
61   --   <views>
62   --     <view name="MyTest10" description="my view"
63   --           id="view1" element="Region1">
64   --       <modifications/>
65   --     </view>
66   --   <views/>
67   -- <customization/>
68   --
69   PROCEDURE deleteEmptyCustomizations;
70 
71 
72   -- Deletes the package from the repository if the package is empty.  If the
73   -- package is not empty (i.e. it contains either documents or packages), then
74   -- an error will be issued indicated that non-empty packages can not be
75   -- deleted.
76   --
77   -- Parameters:
78   --  p_package    - the fully qualified package name
79   --                 (i.e.  '/oracle/apps')
80   --
81   PROCEDURE deletePackage(p_package VARCHAR2);
82 
83   --
84   -- Export the XML for a document and pass it back in 32k chunks.  This
85   -- function will return XML chunks, with a maximum size of 32k.
86   --
87   -- Specifying a document name will initiate the export.  Thereafter, a NULL
88   -- document name should be passed in until the export is complete.
89   -- That is, to export an entire document, you should do:
90   --
91   -- firstChunk := jdr_utils.exportDocument('/oracle/apps/fnd/mydoc', isDone);
92   -- WHILE (NOT isDone) LOOP
93   --   nextChunk := jdr_utils.exportDocument(NULL, isDone);
94   -- END LOOP;
95   --
96   -- Parameters:
97   --   p_document       - the fully qualified name of the document.  However,
98   --                      after the first chunk of text is exported, a NULL
99   --                      value must be passed in to retrieve the next
100   --                      chunks.
101   --
102   --   p_exportFinished - OUT parameter which indicates whether or not the export
103   --                      is complete.  TRUE indicates the entire document is
104   --                      exported, FALSE indicates that there are more chunks
105   --                      remaining.
106   --
107   --   p_formatted      - TRUE indicates that the XML is formatted nicely
108   --                      (i.e. whether or not the elements are indented).
109   --                      This is defaulted to TRUE.
110   --
111   --
112   -- Returns:
113   --   The exported XML, in 32k chunks.
114   --
115   -- Notes:
116   --   As this function relies on package state, it is not possible to export
117   --   multiple documents at the same time.  A document must be finished
118   --   exporting before a new document can be exported.
119   --
120   FUNCTION exportDocument(
121     p_document           VARCHAR2,
122     p_exportFinished OUT NOCOPY /* file.sql.39 change */ BOOLEAN,
123     p_formatted          BOOLEAN DEFAULT TRUE) RETURN VARCHAR2;
124 
125 
126   -- Gets the fully qualified name of the component.
127   --
128   -- Parameters:
129   --  p_docid       - the ID of the document which contains the component
130   --
131   --  p_compid      - the ID of the component (from comp_id in the
132   --                  jdr_components table
133   --
134   FUNCTION getComponentName(
135     p_docid  jdr_paths.path_docid%TYPE,
136     p_compid jdr_components.comp_id%TYPE) RETURN VARCHAR2;
137 
138 
139   -- Gets the fully qualified name of the document.
140   --
141   -- Parameters:
142   --  p_docid       - the ID of the document
143   FUNCTION getDocumentName(
144     p_docid  jdr_paths.path_docid%TYPE) RETURN VARCHAR2;
145 
146 
147   -- Gets all of the translations of the specified document.
148   --
149   -- Parameters:
150   --  p_document    - the fully qualified document name
151   --
152   -- Raises NO_SUCH_DOCUMENT exception if the document does not exist.
153   --
154   FUNCTION getTranslations(
155     p_document VARCHAR2) RETURN translationList;
156 
157 
158   -- Prints the contents of a package.
159   --
160   -- For the non-recursive case, this will list the documents,
161   -- package files and package directories.
162   --
163   -- For the recursive case, this will list the document, package files
164   -- and empty package directories (i.e. packages which contain no documents
165   -- or child packages).
166   --
167   -- In order to diferentiate documents from package directories, package
168   -- directories will end with a '/'.
169   --
170   -- Parameters:
171   --  p_path       - The path in which to list the documents.  To specify
172   --                 the root directory, use '/'.
173   --
174   --  p_recursive  - If TRUE, recursively lists the contents of
175   --                 sub-directories.  Defaults to FALSE.
176   --
177   -- To use this from SQL*Plus, do:
178   --
179   -- (1) set serveroutput on
180   --     execute jdr_utils.listContents('/oracle/apps/ak');
181   --     This will list the contents of the ak directory, without showing
182   --     the contents of the sub-directories.
183   --
184   -- (2) set serveroutput on
185   --     execute jdr_utils.listContents('/', TRUE);
186   --     This will list the contents of the entire repository.
187   --     sub-directories.
188   --
189   PROCEDURE listContents(p_path VARCHAR2, p_recursive BOOLEAN DEFAULT FALSE);
190 
191 
192   -- List the customizations for the specified document.
193   --
194   -- Parameters:
195   --  p_document    - the fully qualified document name, which can represent
196   --                  either a document or package file.
197   --                  (i.e.  '/oracle/apps/ak/attributeSets')
198   --
199   PROCEDURE listCustomizations(p_document VARCHAR2);
200 
201 
202   -- List the contents of a package.
203   -- DEPRECATED: This has been replaced by listContents
204   PROCEDURE listDocuments(p_path VARCHAR2, p_recursive BOOLEAN DEFAULT FALSE);
205 
206 
207   -- Lists the supported languages for the specified document.
208   --
209   -- Parameters:
210   --  p_document    - the fully qualified document name, which can represent
211   --                  either a document or package file.
212   --                  (i.e.  '/oracle/apps/ak/attributeSets')
213   --
214   PROCEDURE listLanguages(p_document VARCHAR2);
215 
216 
217   -- Prints the contents of a JRAD document to the console.
218   --
219   -- Parameters:
220   --  p_document    - the fully qualified document name, which can represent
221   --                  either a document or package file.
222   --                  (i.e.  '/oracle/apps/ak/attributeSets')
223   --
224   --  p_maxLineSize - the maximum size of line.  This defaults to 255 which is
225   --                  the maximim allowable size of a line (the 255 limit is
226   --                  a limitation of the DBMS_OUPUT package).
227   --
228   -- Limitations:
229   --  Documents larger than 1000000 bytes will fail as DBMS_OUPUT's maximim
230   --  buffer is 1000000 bytes.
231   --
232   -- To use this from SQL*Plus, do:
233   --   set serveroutput on format wrapped (this is needed for leading spaces)
234   --   set linesize 100
235   --   execute jdr_utils.printDocument('/oracle/apps/ak/attributeSets', 100);
236   --
237   -- To create an XML file, you can create the following SQL file:
238   --   set feedback off
239   --   set serveroutput on format wrapped
240   --   set linesize 100
241   --   spool (parameter 1)
242   --   execute jdr_utils.printDocument('(parameter 2)', 100);
243   --   spool off
244   --
245   -- and call the file with:
246   --   sqlplus scott/tiger @export.sql myxml.xml /oracle/apps/ak/attributeSets
247   PROCEDURE printDocument(p_document    VARCHAR2,
248                           p_maxLineSize NUMBER DEFAULT MAX_LINE_SIZE);
249 
250 
251   -- Prints the translations for the document in XLIFF format.
252   --
253   -- Parameters:
254   --  p_document    - the fully qualified document name, which can represent
255   --                  either a document or package file.
256   --                  (i.e.  '/oracle/apps/ak/attributeSets')
257   --
258   --  p_language    - the language to use for the translations
259   --
260   --  p_maxLineSize - the maximum size of line.  This defaults to 255 which is
261   --                  the maximim allowable size of a line (the 255 limit is
262   --                  a limitation of the DBMS_OUPUT package).
263   --
264   -- To use this from SQL*Plus, do:
265   --   set serveroutput on format wrapped (this is needed for leading spaces)
266   --   set linesize 100
267   --   execute jdr_utils.printTranslations('/oracle/apps/ak/attributeSets',
268   --                                       'mylanguage', 100);
269   --
270   PROCEDURE printTranslations(p_document    VARCHAR2,
271                               p_language    VARCHAR2,
272                               p_maxLineSize NUMBER DEFAULT MAX_LINE_SIZE);
273 
274 
275   -- Saves the specified translations for the specified document.
276   --
277   -- This procedure will do the following:
278   --  (1) Lock the document so as to prevent multiple users attempting
279   --      to modify translations at the same time
280   --  (2) Delete all of the translations for the specified document
281   --  (3) Insert the new translations
282   --  (4) Commit the data unless p_commit set to FALSE
283   --
284   -- Please use this with care as it will delete all of the
285   -- translations for the specified document.
286   --
287   -- Parameters:
288   --  p_document     - the fully qualified document name
289   --
290   --  p_translations - the list of translations to insert
291   --
292   --  p_commit       - if TRUE, the data is committed.  Default is TRUE
293   --
294   -- NOTE: If p_commit is set to FALSE, then the document will remain locked
295   -- after the call to saveTranslations.  In order to prevent a deadlock, a
296   -- commit (or rollback) must occur to unlock the document.
297   --
298   -- Raises NO_SUCH_DOCUMENT exception if the document does not exist.
299   --
300   PROCEDURE saveTranslations(
301     p_document     VARCHAR2,
302     p_translations translationList,
303     p_commit       BOOLEAN := TRUE);
304 
305 
306   -----------------------------------------------------------------------------
307   ---------------------------- TO BE IMPLEMENTED ------------------------------
308   -----------------------------------------------------------------------------
309 
310   -- Moves the document to a different location
311   --
312   -- Parameters:
313   --  p_src         - the fully qualified 'old' document name
314   --
315   --  p_dest        - the fully qualified 'new' document name
316   --
317   -- PROCEDURE moveDocument(p_src VARCHAR2, p_dest);
318 
319   -- Imports the document
320   --
321   -- Parameters:
322   --  p_file        - the name of the XML file to import
323   --
324   -- Issues:
325   --   There are a couple of issues with this.  One, the 'brains' of the
326   --   importer currently reside in Java (i.e. Java does the parsing of the
327   --   XML) and I don't think we want to have a different parser for Java and
328   --   a different parser for PL/SQL.  Two, I am not aware of a way to acccess
329   --   files which reside on the client machine (UTL_FILE works on files on
330   --   the database server).
331   -- PROCEDURE importDocument(p_file VARCHAR2);
332 
333   -- Imports the document
334   --
335   -- Parameters:
336   --  p_file        - the name of the XLIFF file to import
337   --
338   -- Issues:
339   --   See issues for importDocument
340   -- PROCEDURE importTranslations(p_file VARCHAR2);
341 
342 END;