Version 3.22.0

New and Noteworthy in version 3.22.0

Model Definition

@Since

When a version or a VersionProvider is set in the .ipsproject file, the version they were introduced in can be configured for elements like attributes and relationships in the model. These values are also included in the generated code as a @Since-Javadoc tag. With the introduction of the m2e-plugin these mechanisms have been redesigned, so that only unqualified version numbers are used in the model. Both OSGI and Maven allow qualifiers in their respective version numbers, for example a development version (.qualifier or -SNAPSHOT) or an integration build number. For the @Since marker, however, the final released version without qualifier is used.

Different Settings in Maven Dependencies to Generate Interfaces between Model Projects

If Maven is used to maintain dependencies between Faktor-IPS model projects and if not all projects are included in the workspace, Faktor-IPS can’t access the settings of the referenced projects. Therefor Faktor-IPS will use the settings of the referencing projects, for example to determine the name of the super class from the referenced project. If the settings (generatePublishedInterfaces/generatorLocale/changesInTimeNamingConvention) are set differently, then it is now possible to specify them in the MANIFEST.MF file. More information can be found in the document Using Faktor-IPS Projects with Maven-Dependencies.

Static Product-Defined Validation Rules

As it has been possible to maintain the attributes, relationships, and tables in both generations as well as “static” product configuration, it is now also possible to configure “static” validation rules. When these can be de-/activated via the product configuration, you can now also choose whether this setting should be changeable over time or not. Note that if no generations are used then in that case the validation rules could not be made configurable by product previously.

Product Definition

Sorting Product Modules

For product components, it sometimes makes sense in some cases to sort them non-alphabetically. This sorting can improve the overview of the components and helps in situations like configuring associations by drag&drop to get a uniform order. The sorting takes place via the context menu in the model or product definition explorer via the “Edit Sort Order…” entry.

The dialog has been simplified and cleaned up in order to be able to sort the large number of objects in a meaningful way. Instead of the tree view, only the content of the currently selected package will be displayed. With multi-select several entries can be moved at the same time, additionally there is also drag&drop support.

The copy wizard and refactoring support have been enhanced to preserve sort order when copying or renaming products. These now take into consideration any existing sorting.

Expansion Option for the “Smart Mode” of the Product Copy Wizard

When copying bulky products, it can be helpful to work with knowledge about the model, when deciding which elements to copy and which to reference. For this purpose an implementation of the IDeepCopySmartModeBehavior can be installed in a separate plug-in, as a Faktor-IPS extension, via the Extension Point org.faktorips.devtools.core.ui.deepCopyWizard.

Runtime

Improvement of the IpsModel for Associations

The IpsModel-class PolicyAssociation received new methods add/removeTargetObjects that can be used to edit the associations:
IpsModel.getPolicyCmptType(vertrag).getAssociation("coverages").addTargetObjects(contract, baseCoverage, additionalCoverage);

The new documentation page Faktor-IPS Metamodel: Model information at Runtime offers a summary of what can be accessed via the meta-model. Details of the calls can be found in the Javadoc.

Note that the method getDeclaredAssociation(String) now throws an IllegalArgumentException if there is no method with the given name. This was already documented in the java doc but instead of throwing the exception the method returned null.

Generated Code

Custom Base Classes

Previously, the contract and product classes generated by Faktor-IPS were always derived directly from AbstractModelObject or ProductComponent, so it was difficult to accommodate custom code uniformly for all classes. Now you can use the code generator properties “Base class of policy components” or “Base class for product components” to set your own base class, which in turn must be derived from AbstractModelObject or ProductComponent.

New Base Class for JAXB Annotated Policy Classes

In the course of introducing the possibility to define custom base classes (see above), the JAXB annotations have been removed from AbstractModelObject and moved to the new derived class AbstractJaxbModelObject, used by the standard builder as the base class if “JAXB-Support generation” is selected and no custom base class is specified for policy components. During this refactoring, the previous field id was renamed to jaxbId in order to avoid conflicts with other IDs (eg for JPA). The XML attribute remains unchanged as object.id.

Copy-Support

The generation of copies of contract instances is now using to covariant return types. This affects the methods newCopy() and newCopyInternal() in the generated policy classes.

public IModelObject newCopy() {...} is changed to e.g.

public Contract newCopy() {...}

If published interfaces are used, the method declaration newCopy() with an appropriate return type is added.

A clean build of all projects is required for consistency.

Retaining Manually Inserted Annotations

In the Faktor-IPS code generator there is a new option which allows to keep manually added annotations in the generated code. Like additional annotations, annotations to be retained can be configured which will not be removed from the generated code by the code generator. For example, @Override can be written to methods that are overwritten from their own non-generated interfaces. Multiple annotations can be provided by separating them with semicolons.

ITable Receives Generics and getAllRows()

The interface ITable is the base interface for all generated tables. Now it contains (analogous to the already generated base class Table) a type parameter, which defines the class in a single row of the table. Thus, the method List getAllRows() can be directly defined in the interface ITable and implemented in Table. Previously it was defined in all generated table classes.

Code-Generator

Previously Xpand was used to generate the code. Since this framework is no longer maintained, the code generator has switched to the successor project Xtend.
Also, this makes debugging the code generator easier. If you have implemented your own code generator, we can assist you with the migration to Xtend.

Migration

The migration to version 3.22 updates setting in the code generator and inserts all default values and descriptions into the .ipsproject file. After that, the whole project is built. Due to the configurable base classes, the base class for policy classes is switched to AbstractJaxbModelObject if JAXB support is enabled.

As a part of the migration, the unused property javaProjectContainsClassesForDynamicDatatypes is also removed from the .ipsproject file.

New Add-On

Many Faktor-IPS users also manage their Faktor-IPS projects with Maven. There were two problems so far:

  1. When importing Maven projects into Eclipse, the IPS-nature was missing, so the .project file had to be checked in or the nature had to be added manually after the import.
  2. The project version had to be maintained both in pom.xml and .ipsproject.

Both problems can be resolved with the Faktor-IPS-m2e-Plugin:

  1. The IPS-Nature is automatically added if the .ipsproject file is present.
  2. If the maven version provider is set in the .ipsproject(<Version versionProvider="org.faktorips.maven.mavenVersionProvider"/>), Faktor-IPS uses the version from the pom.xml directly.

The new add-on can be installed via the p2 update site https://update.faktorzehn.org/faktorips/m2e.

Release Notes – Faktor-IPS – Version 3.22.0

Bugs

  • Allow multiple Extension Properties in the same definition (FIPS-824)
  • Strange comment in generated code (FIPS-4104)
  • “Clean up – fix differences” does not work in Instance Explorer (FIPS-4701)
  • Cannot define custom data types with Maven (FIPS-4800)
  • Recognize necessary @Override annotations in generated code (FIPS-5341)
  • Default value null reacts to “null” in the value set (FIPS-5626)
  • Message.createCopy does not copy MessageMarker (FIPS-5660)
  • Getter for relationships with lowercase name does not become CamelCase (FIPS-5673)
  • Synchronize Modifier in AbstractRuntimeRepositoryManager (FIPS-5694)
  • After creating a new association with inverse associtaion, an error is incorrectly displayed in the editor (FIPS-5705)
  • Root of a newCopy is not placed in copyMap (FIPS-5726)
  • Faktor-IPS caches external resources too long (FIPS-5747)
  • JavaDoc is missing in generated abstract enum classes (FIPS-5773)
  • Error in IPS Builder (FIPS-5780)
  • New product without template gets template icon (FIPS-5784)
  • Fix differences crashes (FIPS-5788)
  • Different settings for generating interfaces for Maven dependencies between model projects (FIPS-5804)
  • Copy wizard throws NPE if package is not found (FIPS-5805)
  • Nullpointer during search with condition (FIPS-5812)
  • Fix Differences Problems with template (FIPS-5825)
  • Code generation with JDK 9 not possible (FIPS-5832)
  • TestCase(Type)builder uses Builder-Settings only from own project (FIPS-5839)
  • Product module template: misleading marking in the template for attribute of a product (FIPS-5867)
  • PolicyAttribute.getValueSet should not return null (FIPS-5990)
  • SPIKE – Different settings for generating interfaces for Maven dependencies between model projects (FIPS-6027)
  • Comparison of two elements with the same enum shows differences (FIPS-6038)
  • Fix for FIPS-5867: NPE while opening editor without a template (FIPS-6040)
  • Type.getDeclaredAssociation(String) should throw an IllegalArgumentException if no association is found (FIPS-5744)

New Features

  • Department wishes sorting sequence for product components (FIPS-2823)
  • Automatically read project version from pom.xml: MavenVersionProvider (FIPS-3985)

Tasks

Improvements

  • As a user, I want to see if the “Fix differences” operation has started (FIPS-3747)
  • Enable overwriting of associations only on product (FIPS-4966)
  • Specify base classes for ModelObjects and ProductComponents. (FIPS-5280)
  • Validation Rules Without Changes Over Time (Adjustment Stages) (FIPS-5361)
  • Use covariant return types in generated code (FIPS-5385)
  • Extension of IpsModel by various methods (FIPS-5470)
  • Improved Smart Mode when copying products (Deep Copy Wizard) (FIPS-5480)
  • Improve error message for missing data types (FIPS-5622)
  • Error in Javadoc for qualified relationships (FIPS-5755)
  • org.faktorips.runtime.model.type.Attribute.getDatatype() should not throw ClassNotFoundException (FIPS-5795)
  • Strengthening Copy-Wizard (“Copy Product…”) (FIPS-5863)
  • From ITable object you cannot read the table rows without reflection (FIPS-5877)
  • Faktor-IPS Codegenerator with Xtend (FIPS-5933)
  • IpsProjectProperty javaProjectContainsClassesForDynamicDatatypes would not be used any more (FIPS-5957)
  • Message Builder takes message as parameter (FIPS-6061)
  • Dependencies clean up (FIPS-6086)