Modifying data models in Rational Reporting for Document Generation

Technote (troubleshooting)


Problem(Abstract)

The core report engine of Rational Publishing Engine, called Rational Reporting for Document Generation (RRDG), is structured to organize data through the use of data models. Data models can help you plan and control how your data is used. In Rational Reporting for Document Generation, some of the API classes might expose details of their internal structure.

Symptom

The exposure of this internal representation produces two issues:

  • When consumers of the class try to operate directly on the structure of the class, the class invariants might break.
  • The classes cannot be redesigned and the implementation cannot be modified (to improve performance, for example).

Environment

Affected classes:

com.ibm.rational.rpe.common.data.Description
com.ibm.rational.rpe.common.data.Feature
com.ibm.rational.rpe.common.data.Value
com.ibm.rational.rpe.engine.data.model.Entity
com.ibm.rational.rpe.common.data.expression.ExpressionContext
com.ibm.rational.rpe.common.data.expression.ScriptExpression
com.ibm.rational.rpe.common.template.model.Assignments
com.ibm.rational.rpe.common.template.model.Element
com.ibm.rational.rpe.api.docspec.RPEDocumentElement

Resolving the problem

When the methods from the classes listed below return a collection of child objects, the collection that is returned cannot be modified. An exception is thrown and you can modify these collections only by adding and removing methods that are defined in the class itself. This ensures that the class invariant holds true and the Rational Reporting for Document Generation client code is also correct.



Example
Feature.getProperties() method returns a collection all the properties of the feature. That collection can be used only to iterate the properties, but not add or remove properties to the feature. To add or remove properties, the accessor methods defined in the Feature class, such as addProperty, addProperties, or removeProperty, must be used. Note that only the collection cannot be modified; the properties themselves can be changed.


Rate this page:

(0 users)Average rating

Document information


More support for:

Rational Publishing Engine
General Information

Software version:

1.2

Operating system(s):

Linux, Windows

Reference #:

1627968

Modified date:

2013-04-08

Translate my page

Machine Translation

Content navigation