1 PACKAGE jdr_docbuilder AUTHID CURRENT_USER AS
2 /* $Header: JDRDBEXS.pls 115.6 2004/07/23 05:16:20 nigoel noship $ */
3
4 -----------------------------------------------------------------------------
5 ---------------------------- PUBLIC VARIABLES -------------------------------
6 -----------------------------------------------------------------------------
7 -- Valid Namespaces
8 JRAD_NS CONSTANT VARCHAR2(5) := 'jrad:';
9 OA_NS CONSTANT VARCHAR2(5) := 'oa:';
10 UI_NS CONSTANT VARCHAR2(5) := 'ui:';
11 USER_NS CONSTANT VARCHAR2(5) := 'user:';
12
13 -- Save Constants
14 SUCCESS CONSTANT PLS_INTEGER := 1;
15 FAILURE CONSTANT PLS_INTEGER := 0;
16
17 -- Types
18 TYPE ELEMENT IS RECORD ( id PLS_INTEGER );
19 TYPE DOCUMENT IS RECORD ( id PLS_INTEGER );
20
21 -- User-defined Exceptions
22
23 -- INVALID_NAMESPACE exception is thrown when an invalid namespace is
24 -- provided as a parameter. The namespace must be JRAD_NS, OA_NS, UI_NS,
25 -- or USER_NS. These constants are defined as part of the jdr_docbuilder
26 -- package
27 INVALID_NAMESPACE EXCEPTION;
28
29 -- REF_NOT_FOUND exception is thrown when the given reference does not
30 -- exist in the MDS repository.
31 REF_NOT_FOUND EXCEPTION;
32
33 -- NOT_DOCUMENT_REF exception is thrown when the given reference exists
34 -- in the MDS repository, however it is not a MDS document. For example,
35 -- the reference could correspond to a MDS package.
36 NOT_DOCUMENT_REF EXCEPTION;
37
38 -----------------------------------------------------------------------------
39 ---------------------------- PUBLIC FUNCTIONS -------------------------------
40 -----------------------------------------------------------------------------
41
42
43 -- Add a child to the element, into the specified grouping.
44 --
45 -- Parameters:
46 -- p_parent - The parent element
47 -- p_groupingNS - The namespace of the grouping. This value should be one of
48 -- the following constants: JRAD_NS, OA_NS, UI_NS, USER_NS.
49 -- p_groupingTagName - The name of the grouping.
50 -- p_child - The child element
51 --
52 -- Exceptions:
53 -- Raises INVALID_NAMESPACE exception if an invalid namespace is specified.
54 --
55 PROCEDURE addChild(
56 p_parent ELEMENT,
57 p_groupingNS VARCHAR2,
58 p_groupingTagName VARCHAR2,
59 p_child ELEMENT);
60
61
62 -- Add a child directly to the element, without a grouping.
63 --
64 -- Parameters:
65 -- p_parent - The parent element
66 -- p_child - The child element
67 --
68 --
69 PROCEDURE addChild(
70 p_parent ELEMENT,
71 p_child ELEMENT);
72
73
74 --
75 -- Creates an MDS Document object. The full name of the document must be
76 -- specified, as well as the base language of the document. If no base
77 -- language is provided, the default language is English-US.
78 --
79 -- Parameters:
80 -- p_fullPathName - the complete path name of the document
81 -- p_language - the language of the document
82 --
83 -- Returns:
84 -- the document object
85 --
86 FUNCTION createDocument(
87 p_fullPathName VARCHAR2,
88 p_language VARCHAR2 DEFAULT 'en-US') RETURN DOCUMENT;
89
90
91 --
92 -- Creates an MDS Document object that is a child document within an
93 -- existing package file. The full name of the document must be specified.
94 -- The base language of the document will be the same as its package file.
95 --
96 -- ex. If the p_fullPathName is /oracle/apps/hr/regionMap/region1, then
97 -- the package file name is /oracle/apps/hr/regionMap
98 -- and the document name is region1.
99 --
100 -- Parameters:
101 -- p_fullPathName - the complete path name of the document
102 --
103 -- Returns:
104 -- the document object
105 --
106 -- Exception:
107 -- Raises REF_NOT_FOUND exception if the package file reference does not
108 -- exist in the repository, or the reference corresponds to a document
109 -- rather than a package file.
110 --
111 FUNCTION createChildDocument(
112 p_fullPathName VARCHAR2) RETURN DOCUMENT;
113
114
115 --
116 -- Creates an MDS Element object. The full name of the document must be
117 -- specified, as well as the base language of the document.
118 --
119 -- Parameters:
120 -- p_namespace - the namespace of the element. This value should be one of
121 -- the following constants: JRAD_NS, OA_NS, UI_NS, USER_NS.
122 -- p_tagName - the type of element, i.e. table, messageTextInput
123 --
124 -- Returns:
125 -- the element object
126 --
127 -- Exceptions:
128 -- Raises INVALID_NAMESPACE exception if an invalid namespace is specified.
129 --
130 FUNCTION createElement(
131 p_namespace VARCHAR2,
132 p_tagName VARCHAR2) RETURN ELEMENT;
133
134
135 -- Delete a document from the repository. If the provided path name is not
136 -- associated with a document (i.e. the path refers to a package),
137 -- an exception will be raised.
138 --
139 -- Parameters:
140 -- p_fullPathName - the full document reference
141 --
142 -- Exception:
143 -- Raises REF_NOT_FOUND exception if the reference does not exist in the
144 -- MDS repository.
145 -- Raises NOT_DOCUMENT_REF exception if the reference does exist in the
146 -- repository, but does not refer to a document (i.e. the reference
147 -- is a package).
148 --
149 PROCEDURE deleteDocument(
150 p_fullPathName VARCHAR2);
151
152
153 -- Determine if a document exists in the MDS Repository. The document is
154 -- identified by its full reference path.
155 --
156 -- Parameters:
157 -- p_fullPathName - the full document reference
158 --
159 -- Returns:
160 -- TRUE if the document exists in the repository, FALSE otherwise.
161 --
162 FUNCTION documentExists(
163 p_fullPathName VARCHAR2) RETURN BOOLEAN;
164
165
166 -- Refreshes the document builder utility. Deletes all documents and elements
167 -- which have been created in this package.
168 --
169 PROCEDURE refresh;
170
171
172 -- Save all documents which have been created since the last save. If a
173 -- document already exists in the repository with the same full reference,
174 -- it will be replaced. Any new child documents will be added to the end of
175 -- the package file. Any dangling references (i.e. elements created but
176 -- never associated with a document) will be lost. At the end of the save,
177 -- a refresh is performed.
178 --
179 -- Returns: SUCCESS or FAILURE
180 --
181 FUNCTION save RETURN PLS_INTEGER;
182
183
184 --
185 -- Sets the value of the attribute for this element.
186 --
187 -- Parameters:
188 -- p_elem - The element
189 -- p_attName - The name of the attribute
190 -- p_attValue - The attribute value
191 --
192 PROCEDURE setAttribute(
193 p_elem ELEMENT,
194 p_attName VARCHAR2,
195 p_attValue VARCHAR2);
196
197
198 --
199 -- Set the top-level element in the document.
200 --
201 -- Parameters:
202 -- p_doc - The document
203 -- p_elem - The top-level element
204 --
205 PROCEDURE setTopLevelElement(
206 p_doc DOCUMENT,
207 p_elem ELEMENT);
208
209 END;