Version 19.12

New and Noteworthy in Version 19.12

Ant Task for HTML Export

Now it is also possible to call the HTML export through an Ant task. We can configure the task in XML, as shown in the example below:

<faktorips.exportHtml ipsProjectName="org.faktorips.integrationtest.java5" showValidationErrors="true" showInheritedObjectPartsInTable="true" locale="de"
destination="C:\faktorips.integrationtest\target\html\org.faktorips.integrationtest.java5" ipsObjectTypes="ALL" />

Exception when retrieving enum values if the referenced value does not exist

Faktor-IPS tries to retrieve enum values internally from the runtime repository on multiple occasions, e.g. when loading a product component in a formula. If a referenced enum value does not exist, a IllegalArgumentException is now thrown. This change leads to slight changes in generated code, but no manual code changes are required.

With this change, errors in product configuration concerning enum values should now be detected as soon as possible. Thus, any new exception at runtime indicates that the previously configured enum value has been invalid, the exception message will contain the details. This does not change the behavior of a correctly configured application. Errors may now occur especially in tests with handwritten enum contents where the value was not relevant for the test case but set to an illegal value like “ignored” – it should be set to null in that case.

New enum methods getExistingValueBy...

New methods getExistingValueBy... are now generated for enum types. These methods provide the same functionality as the existing getValueBy... methods, but throw an IllegalArgumentException if no matching enum value could be found. The new methods can be used instead of the existing ones to detect invalid arguments as soon as possible.

Renaming of setter parameters in builders

In the generated builder classes, a method is generated for each attribute to set the attribute value. The method arguments of these methods are now prefixed with “new”.

This change is necessary to avoid compile errors in generated code if a policy has an attribute that has the same name as the policy itself. Given an example policy component type “Nummernkreis” with an attribute “Nummernkreis”, the following invalid code was generated:

public NummernkreisBuilder nummernkreis(String nummernkreis) {
    nummernkreis.setNummernkreis(nummernkreis);
    return this;
}

With the new version, the following code will be generated instead:

public NummernkreisBuilder nummernkreis(String newNummernkreis) {
    nummernkreis.setNummernkreis(newNummernkreis);
    return this;
}

New annotations in generated code

New annotations have been introduced to expand the runtime model. These annotations are added to the generated code for a PolicyCmptType which has at least one rule.

Annotation Description Generated For
@IpsValidationRules Contains a list of names of all rules in their configured order. For example:
@IpsValidationRules({ "rule1", "rule2" })
Policy component type class or the respective published interface
@IpsValidationRule Contains information about a rule. For example:
@IpsValidationRule(name = "ruleName", msgCode = MSG_CODE_RULE, severity = Severity.ERROR)
All rule methods
@IpsConfiguredValidationRule Contains information about a rule that is configured by a product. For example:
@IpsConfiguredValidationRule(changingOverTime = true, defaultActivated = true)
Method of all rules that are configured by a product

 

In the runtime model, the ValidationRule class has been introduced to allow for a runtime representation of design time rules in a PolicyCmptType. Validation rules can be retrieved from a PolicyCmptType through the following new methods:

Method Description
getDeclaredValidationRule(String) Returns the validation rule with the given name. Only the class of the PolicyCmptType is searched; rules declared in the super type are ignored.
getDeclaredValidationRule(int) Returns the validation rule at the given index. Only the class of the PolicyCmptType is searched; rules declared in the super type are ignored.
getDeclaredValidationRules() Returns all the validation rules declared in the PolicyCmptClass. Validation rules defined in the super class are not returned.
getValidationRule(String) Returns the validation rule with the given name. Both the class of the PolicyCmptType and the super type are searched.
getValidationRules() Returns a list of all validation rules, including those defined in the super types.

Faktor-IPS Design Time Tools updated to Java 8

The minimum requirement for the use of the Faktor-IPS-Plugins is now Java 8. Runtime as well as generated code is still Java 6 compatible. Custom functional interfaces like Function in the plugin code have been replaced by corresponding Java 8 functional interfaces. Custom Plugins may have to be adapted.

Copying Runtime IDs

It is now possible to copy runtime IDs of product components through an explorer context menu. This saves some clicks opening the product components and navigating to the Settings tab, especially when handling multiple product components.

Generic Datatypes with CharSequence instead of String

When defining datatypes in the .ipsproject file, the classes used as datatypes need methods for “valueOf” and, optionally, “isParsable”. Instead of demanding those methods to have String parameters, Faktor-IPS 19.12 now allows the superclass CharSequence, thus making it possible to use for example java.time.Year as a Faktor-IPS datatype:

<Datatype id=”Year” javaClass=”java.time.Year” valueOfMethod=”parse” />

Furthermore, the return types of the “valueOf” and “isParsable” methods are checked upon initialization of the .ipsproject instead of waiting for errors in the code generation.

Generic Parameter Type in ValueSet#contains

To increase type safety, ValueSet#contains(Object value) now uses the specified type parameter: ValueSet#contains(T value). This change also affects implementations of this interface. It is possible that this requires adjustments to code calling the method.

Using the Product Release Extension with Snapshot Versions

The newly added fieldversionMustChangemakes it possible for product release extensions to define whether the previous version may be reused during a release. This allows the extension to be used with non-changing snapshot versions.

Delta-Computation for Associations

Until now only compositions were taken into account when computing differences between policy objects. Changes to associations have previously been ignored. Faktor-IPS now reports changed associations as delta as well. Because all objects included in associations should also be included in a composition, child changes are still only included in the composition’s delta. Should associations be ignored as previously, the new method IDeltaComputationOptions#ignoreAssociations() can be implemented to configure the old behavior.

The IModelObjectDelta can now return the association kind from the new method IModelObjectDelta#getAssociationKind() as either Association or Composition.

Improved ValueSets

The generated code for value sets and the methods for generic access to them have been improved, so that now:

  • for unrestricted value sets without null a constant and getSetOfAllowedValuesFor<property> method are generated
  • the getValueSet methods in the runtime PolicyAttribute always return a value set. If none is defined in the model, an UnrestrictedValueSet including null is returned.
  • the PolicyAttribute also offers getValue methods without IValidationContext, creating a default ValidationContext as the generated valuset methods ignore that parameter anyways
  • the getValue methods find and call @IpsAllowedValues annotated methods that are written/changed by hand to have no IValidationContext parameter

Additionally, for PolicyCmptType attributes with an unrestricted value set without null, a validation method can be generated now.

Bugs

  • XML Deserialising ignores not found enum types (FIPS-589)
  • Codegenerator Compiler-Error with static Attributes and ToXML-Support (FIPS-1458)
  • Copying a Testcase doesn’t clean up after aborting (FIPS-1501)
  • Import Enumeration Values – Radio Button selection not unique (FIPS-4318)
  • Default-ValidationRule for an attribute can’t handle unrestricted ValueSet (FIPS-4707)
  • No abstract method for Derived-Union in non-abstract Type generated (FIPS-5651)
  • New Product Component Wizard shows descriptions of templates only in tooltips (FIPS-5679)
  • Access to tableUsages must be case-insensitive (FIPS-5739)
  • EnumContentType don’t open in parent project (FIPS-5962)
  • Deltacalculation ignores associations (FIPS-5998)
  • Debugging of IPS-Test in Eclipse 4.9 not possible (FIPS-6021)
  • Generated doInitFoo-methods don’t throw an Exception, if the EnumValue is not found in the repository (FIPS-6032)
  • Erroneous generated Builder if a model attribute has the same name as the model object (FIPS-6195)
  • Generated XML is no longer indented with Java 11 (FIPS-6349)
  • Removing a type from the model leads to an InvocationTargetException in templates (FIPS-6363)
  • Ips…Types in read-only-mode (parent project) display with errors (FIPS-6371)
  • “Add Faktor-IPS Nature” works only once (FIPS-6418)
  • NPE when creating new associations (FIPS-6441)
  • NPE from multiselect vof correspondence types in an editing type (FIPS-6452)
  • Test class InferTemplateProcessorTest2 contains failing tests and is not run by Jenkins (FIPS-6533)
  • For derived attributes (with every getter call) no “getRange”-methode is generated (FIPS-6535)

New Features

  • Copying of Runtime IDs in the context menu (FIPS-2367)
  • Ant-Target for HTML-Export (FIPS-5965)
  • New default for new table structures – Multiple instead of Single (FIPS-6283)
  • Improved value sets (FIPS-6492)
  • RangeValueSet should be able to check whether an EnumValueSet is contained (FIPS-6565)

Tasks

Improvements

  • Create getExistingValueByXYZ(…) for Enums (FIPS-4220)
  • Calling contains on UnrestrictedValueSet with wrong type returns true true (FIPS-5811)
  • Access validation rules from the IpsModel (FIPS-5894)
  • Javadoc for ProductCmptType.getDeclaredTableUsage(String) (FIPS-6145)
  • Switch Design Time code to Java 8 (FIPS-6320)
  • mavenVersionProvider should write versions without qualifier to TOCs (FIPS-6436)
  • Build-Release: make validation of the version number optional (FIPS-6475)
  • valueOfMethod should support methods with a CharSequence parameter (FIPS-6493)