Primary Features and Benefits

Using the annotations and the Excel mapping processor makes it super-easy to generate an Excel workbook for recording all mappings between external data/domain models and the domain model of your xweld based applications.

Key Concepts

Enterprise projects invariably involve data integration with upstream or downstream applications. This means that data must be moved them and it must must be mapped from one system representation to/from your domain model classes. The documentation of how one model is mapped to another is typically maintained in mapping spreadsheets. There is also usually one such workbook for each source or target system.

The mapping project provides the application domain model developer with a set of annotations for marking up their domain classes and a command line processor that uses reflection to build a mapping spreadsheet template for each system from a configurable list of classes.

Packages and Classes

xweld-mapping includes the following packages:

  • *com.xweld.mapping * – a set of annotations used to mark up domain classes and a command line to that creates mapping template workbooks for each target systems for the set of configured classes.

The Mark-Up Annotations

A class may be documented with information that outlines the purpose of the class using the @Documentation annotation. For example, a 'Trade' class may be annotation as follows:

@Documentation(text = { "Represents the economic and other details recorded in the action of buying and selling.",
                        "Multiple counter parties may participate in a trade. "})
public final class Trade

The text provided for the annotation will show up on the top of the 'Trade' workbook tab.

There are several annotations for fields. The fields in the domain module appear as rows in the worksheet, one row for each field. Some examples follow:

The @SimpleMapping annotation is used at the field level to both document the field in the mapping workbook but also define the type of field itself or data element. The following is an example on a field called 'name'.

  @SimpleMapping(description = "The name of the asset.", fieldType = String.class, name = "Name")
  String                    name;

In the example above the type of the field specified in the fieldType parameter is the same as a the JAVA type. This may not always be the case, so although this might look duplicative it really isn't. The fieldType is the type of data element the field maps to in the external system.

The @EnumerationMapping annotation may be used to define how enumerationsare mapped for fields. Below is an example:

  @EnumerationMapping(description = "The issue country of the bond", enumerationType = CountryCode.class, name = "Country Of Origin")
  private CountryCode        countryOfOrigin;

Lastly, fields that are collections may be marked up with the @CollectionMapping> annotation. Below is an example:

 @CollectionMappping(name = "Linked Trades", description = "A list of zero or more trades linked to this trade.",
      elementType = Trade.class, cardinality = CardinalityType.ManyToMany)
  private final Set<Trade> linkedTrades  = new HashSet<Trade>();

Running The Workbook Generator

  1. Create a plain old text file that lists the fully qualified class names you want to process, each on its own line
  2. Save it someplace on the class path as "mapping.txt" for example
  3. Suppose you wanted a worksheet that maps your domain classes for two systems, system Foo and system Bar.
  4. Run the tool as follows, twice
javac com.xweld.mapping.CreateExcel -file mapping.txt -target Foo
javac com.xweld.mapping.CreateExcel -file mapping.txt -target Bar

The result of running the above is two excel workbooks, one for each system that contains a tab for each class, and within each tab a tabular sheet of field values, including blank rows where the mapping information may be entered.

Contact Us

For more information, please contact us at .


Copyright © 1999-2014 Free North Alliance Inc. All Rights Reserved.

The contents of this web site, including all images, text, graphics and software, are the sole property of Free North Alliance Inc. and its agents. Unauthorized use or transmission is strictly forbidden by international copyright law.