The XML schema file
ReportWeaver uses Java's reflection to analyze the classes for reporting. It
uses the schema file for directions which classes must be analyzed.
The schema file is optional, without it ReportWeaver reads the schema from
the database, and turns all normal classes into root extents. (A root
extent is the equivalent of a table in a relational database. It contains
all instances of one class)
However the number of classes and attributes found may be very large. To
many users this is confusing, because there are many more classes/attributes
than needed. To reduce the set of classes/attributes the schema generation
process can be controlled by the XML configuration file. In this case the
configuration file can specify views for the classes, which hide or rename
members. Because the physical class can be hidden completely this layer is
called the curtain definition.
Use the schema file if you want to be more specific in what and how you
access your data. You can provide directions for packages,
roots, classes and their
members.
This is a minimal schema definition file:
<com.qintsoft.joria.datasources.cachegeneric hideAutomaticExtentRoots="false">
<package name="topPackage.businessclasses" hidePackageName="yes"/>
</com.qintsoft.joria.datasources.cachegeneric>
The first line make it as an xml file that contains a schema definition for
Caché generic access (Language independent). The top level element is
com.qintsoft.joria.datasources.cachegeneric. It specifies
a configuration parameter, which is explained in the reference section. It
contains one package elements which declares that only classes
from this package (and its subpackages) are visible.
Schema File Basics
Writing the shema file is simple, and the file is usually short. You only
need to specify the special cases.
Per default, ReportWeaver displays all public properties, of all classes in
the specified namespace.
The things you can modify with the schema file are:
- packages: Restrict visibility of classes to certain packages
- classes: Restrict visibility to certain members, enable server side
methods, add extenstion methods.
- roots: Limit which extents are shown as roots and add special roots.
Element/Attribute Reference
Top level element com.qintsoft.joria.datasources.cachegeneric
Top level element of a schema defnition. It contains the package elements.
Attributes:
- hideAutomaticExtentRoots
- Whether all classes shall appear as root-extents. Set to true if you want
to enable each extent on a case by case basis.
Element package
Defines the visibility of classes in a package. If one package element
appears, all packages that are not specified are not included. If you specify a
package all sub-packages are included as well, unless they are excluded with
thei own package specification.
Attributes:
- name
- The name of the package.
- hidePackageName
- Whether the package name shall be omitted from classes in this package.
This makes class names much more readable. Please be aware, that if a class
name appears in different packages, ReportWeaver detects a name clash. You can
prevent this by with a class element, that specifies a different name for one
of the clashing classes.
- hide
- Hides a sub-packages that would otherwise be included, because its parent
package has been included.
Element root
Defines a special root. Special roots use the results of a class-method of
Caché.
Attributes:
- name
- The name of the root.
- displayname
- Specifies a different name that is shown to the user.
- method
- The method to be called to get the root object(s) for the report. The
return type does not have to be persistent. It can also be a dynamically
allocated object.
- cacheclass
- The cache class where the method is defined that shall be used.
- returnscollection
- Whether the method returns a collection or a single object.
- returntype
- The type (cache class) returned by the method. In the case of a collection,
please specify the element type.
- parameter
- A string parameter, that is passed to the method. If this is not specified,
the method may not have a parameter.
Element class
Defines how a class shall be accessed. The attributes specify what shall be
done with the class as a whole. The sub elements specify the behaviour of the
members.
Attributes:
- name
- The name of the class.
- displayname
- Specifies a different name that is shown to the user.
- hidden
- Hides the class. Use this if other classes in the package shall be shown,
but this one shall not be displayed. If hidden is specified all other
attributes are ignored.
- showExtent
- Whether to show an extent for this class. use this if you have turned of
automatic extents (in the element com.qintsoft.joria.datasources.cachegeneric).
- transient
- Specify this if the class does not appear in the database. This can be
useful to create a class that serves as a container for methods.
- showOnlySpecifiedMembers
- Whether all members or only the members listed as subelements shall be
shown.
- baseClasses
- Specifies which base classes shall be searched for inherited members. If
this is not specified all base classes are searched.
Element field
Specifies extra information about a field. This element must appear as a
sub-element of class
Attributes:
- name
- The name of the field.
- displayname
- Specifies a different name that is shown to the user.
- type
- The type of the field. Specify it if the type information in the database
is to general.
- picture
- Treat this field as a picture. The field must be a String or a byte array, that is
either a gif, png or jpeg image. If it is a string it will be interpreted as a file name, that is loaded when run. The file name is subjected to the defined
file mapping.
Element method
Specifies that the return value of a cache object method shall appear as a
member. This element must appear as a sub-element of class
Attributes:
- name
- The name of the member.
- displayname
- Specifies a different name that is shown to the user.
- returnscollection
- Whether the method returns a collection or a single object.
- returntype
- The type (cache class) returned by the method. In the case of a collection,
please specify the element type.
- parameter
- A string parameter, that is passed to the method. If this is not specified,
the method may not have a parameter.
- expensive
- Specifies a hint, that the results of theis method should be cached if
possible.
- picture
- Treat this member as a picture. The member must be a byte array, that is
either a gif, png or jpeg image.