public class PXMLUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PXMLUtil.Role |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
legalCopyright |
Constructor and Description |
---|
PXMLUtil() |
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Element |
createField(org.w3c.dom.Element parentElement,
com.fourjs.report.designtime.trigger.Field field,
boolean isLayouted,
PXMLUtil.Role role)
Creates a PXML document fragment representing a variable.
|
static org.w3c.dom.Element |
createField(org.w3c.dom.Element parentElement,
java.lang.String fullName,
com.fourjs.report.designtime.trigger.Field.Type type,
int size,
java.lang.String title,
boolean isLayouted,
PXMLUtil.Role role)
Creates a PXML document fragment representing a variable.
|
static void |
generateDesignFromTemplate(java.lang.String templateFileName,
java.lang.String rootElementName,
java.lang.String schemaFileName,
java.util.HashMap<java.lang.String,java.lang.String> triggerMapping,
java.util.HashMap<java.lang.String,java.lang.Object> placeholderMapping,
java.util.HashMap<java.lang.String,java.lang.String[]> fieldNamePatternLists,
java.lang.String outputFileName)
Creates a simple list report from a prototype 4rp or 4rt template file.
|
public static final java.lang.String legalCopyright
public static void generateDesignFromTemplate(java.lang.String templateFileName, java.lang.String rootElementName, java.lang.String schemaFileName, java.util.HashMap<java.lang.String,java.lang.String> triggerMapping, java.util.HashMap<java.lang.String,java.lang.Object> placeholderMapping, java.util.HashMap<java.lang.String,java.lang.String[]> fieldNamePatternLists, java.lang.String outputFileName) throws DesignFileException
templateFileName
- The name of the template file to use as a basis.
The file can be an arbitray ".4rp" file meeting the requirements stated above.
Passing a null value causes the default list template to be used.
The default template is designed against the schema of the SimpleListModel class
(Call "schemagen com.fourjs.report.standardpipe.designtimeapi.SimpleListModel" to obtain the corresponding .xsd file).schemaFileName
- Specifies an XML schema file
(.xsd) describing the data source of the report.rootElementName
- Specifies the expected document root
in the XML schema file (e.g. if the schema specifies
the elements "invoice" and "invoice-batch" then
rootElementName would be set to "invoice" if the report
will be run against a source that produces documents
whose root element is of type "invoice".triggerMapping
- Specifies the mapping between element
names in the XML schema file and
one of the trigger names "outerGroups", "innerGroups" and "rows" from the template design file.
As an example consider an input schema with the elements "ProductGroups", "Areas", "Orders" and "Items" then the following a valid maps:
{ProductGroups,outerGroups},{Areas,innerGroups},{Items,rows} {ProductGroups,outerGroups},{Orders,innerGroups},{Items,rows} {ProductGroups,outerGroups},{Orders,rows} {ProductGroups,rows} {Orders,rows}The following example mappings are invalid because they violate the ancestry.
{ProductGroups,innerGroup},{Areas,outerGroups},{Items,rows} {Orders,outerGroups},{ProductGroups,rows}
placeholderMapping
- Specifies the mapping between fields
names in the design template and expressions of the same type
that may be composed using fields from the XML schema file.
Specifying this value is mandatory if the template contains fields.
As an example consider a report template that contains the string field "groupTitle" which is mapped to the
RTL expression "Customer: "+orderline.orders.product_id+" "+orderline.orders.product_description.fieldNamePatternLists
- Specifies named lists of patterns for the purpose of selecting fields from the XML schema file
that are to be printed in the resulting report.
The special name "*" denotes to select the fields from any field list contained in the schema.
Individual field name patterns may the wildcard characters "*" and "?".
If null is passed then no fields are selected.outputFileName
- Specifies the name of the resulting .4rp file.DesignFileException
- if the parse fails due to a IO error, a syntactic issue or the document does not meet the requirements.public static org.w3c.dom.Element createField(org.w3c.dom.Element parentElement, java.lang.String fullName, com.fourjs.report.designtime.trigger.Field.Type type, int size, java.lang.String title, boolean isLayouted, PXMLUtil.Role role)
parentElement
- The element that will contain the resulting object
Please note that the returned element is not actually inserted into this element. This has to be done in a separate step.fullName
- The full name of the data object (e.g. "orderline.orders.unitprice")type
- A type specifiersize
- The size of the field (e.g. 20 for CHAR(20))title
- The title of the object (e.g. "Customer Number")isLayouted
- A boolean indicating that the resulting object will not be placed at an absolute positionrole
- Specifies the role in which the returned object will be used.public static org.w3c.dom.Element createField(org.w3c.dom.Element parentElement, com.fourjs.report.designtime.trigger.Field field, boolean isLayouted, PXMLUtil.Role role)
parentElement
- The element that will contain the resulting object
Please note that the returned element is not actually inserted into this element. This has to be done in a separate step.field
- The fieldisLayouted
- A boolean indicating that the resulting object will not be placed at an absolute positionrole
- Specifies the role in which the returned object will be used.