Skip to content

Business Modernization

This page will guide you through the modernization of the business layer of your COBOL modernization project.

This reference guide does not explain the logic of data description in COBOL environment. We assume that readers have enough knowledge in COBOL to understand the equivalents between legacy behaviors and the ones computed by the bean modernization process.

Business Location

In your COBOL legacy inputs, the business layer you will be able to modernize is located into the DATA division of your cblmf files, and more precisely in the FILE, WORKING-STORAGE and LINKAGE sections.

BeanModernization1

The Outline view can be helpful to describe the hierarchy of these sections.

BeanModernization2

Bean Modernization

The following steps allow you to modernize the business layer of a cblmf file :

  1. Open an UML model;
  2. Open the cblmf file containing the beans you want to modernize with the Cobol Annotation Editor;
  3. The Bean Modernization can be triggered via multiple actions :

    1. The first way is to use the Segment View. Open this view by using the Window -> Show View -> Other... entry (left) or via the Quick Access menu (right) :

    BeanModernization8 BeanModernization7

    Then, you can then select a record in your Cobol Annotation Editor by clicking somewhere in its definition and its corresponding hierarchy will be displayed in the Segment View. Right-click on the root element and select the Legacy Object Modernization entry;

    BeanModernization9 BeanModernization10

    1. If you want to handle multiple records at a time, you can also select the Legacy Objects Modernization menu entry in the Reverse menu. A window appears showing the list of all records found in the opened file. Select the ones you want to modernize, then click on OK;

    BeanModernization3 BeanModernization4

  4. The following screen appears :

    BeanModernization5

    1. The beans you have selected in the previous window are shown in (1).

      • The type of each element is described by the following table :
        Icon Description
        Class
        Redefines/Redefined By Class
        Property

        Redefines/Redefined By Property

        Duplicated bean

        Getter operation

        Setter operation

      • The names of all entities and their properties are changed to be in accordance with the target language naming conventions.

        Java : The naming convention is camel case for properties and operations, capitalized camel case for classes and upper snake case for constants.
        .NET : The naming convention is capitalized camel case for properties, operations and classes and upper snake case for constants.

    2. If you click on an element, the panel shown in (2) provides useful information such as :

      • Name : The modernized name of the element;
      • Legacy Mapping : The full path to the corresponding element in the legacy environment;
      • Type : The modernized type of the element (for properties);
      • Cardinality : Whether or not the element will be modernized as a list (for properties);
      • Default Value : The default value of the element if it has successfully been computed from the legacy one (for properties);
      • Legacy Type : The legacy type of the element (for properties);
      • Legacy Occurs : The occurs count of the element in the legacy layer (for properties);
      • Redefines : The modernized property redefined by the element (for properties);
      • Redefined by : The modernized property the element is redefined by (for properties);
      • Return Type : The modernized return type of the element (for operations);
      • Kind : The kind of the element : getter or setter (for operations);
      • Body : The modernized logic of the element (for operations).
    3. The Use local mappings checkbox shown in (3) allows, when enabled, to file-scope the relationship between the modernized element and the legacy one. Default behavior is global-scope, meaning that same hierarchies in multiple cblmf files will result in binding to the same modernized element.

    4. The Class options panel shown in (4) allows you to select the kind of modernized class which will be generated by the wizard. For more information about the kind of entities present in the UML layer, please refer to the business modeling page.

      • is transient object : Allows, when enabled, to generate the beans as not persisted elements, for beans with no database relationship purpose;
      • generate "AsString" attributes : Allows, when enabled, to generate AsString utilitarian methods for Value Objects.
    5. The Generation target panel shown in (5) allows to to select the modernization behavior of the wizard :

      • Generate beans : The beans will be completely added to the UML model;
      • Store beans : The beans will be stored in an EMF catalog;
      • Merge beans : The beans will be merged into a previously created bean. You can then select the target merging class using the Select button shown in (6).
  5. You can also modify elements shown in (1) for more advanced generation use cases. The section Bean modification covers the tools provided by the Legacy Objects Modernization.

  6. When the modernization is ready to be started, click on Finish. The resulting elements will appear under the generatedModel folder of your UML model, or in the merging class for a Merge beans behavior.

Bean Refactoring

Refactoring Operations

The wizard provides several refactoring operations, available when right-clicking on an element in the panel shown in (1).

  • Rename... : Allows to rename the element;
  • Add Root Class : Allows to create an other class to be generated;
  • Delete : Allows to delete the element (for classes and properties);
  • Move To... : Allows to move the element into an other class (for properties);
  • Change Type... : Allows to modify the computed modernized type of the element (for properties);
  • To synthetic stubs : Allows to transform the element to a getter/setter combination (for properties).
    Note that the body of these methods will be generated as TODO.
  • Remove duplicate beans : Allows to search for duplicated beans (same name and same attribute number/name/type). If such duplicates are found, only one instance will be generated, bearing all mappings.

Mass Property Renaming

You can also use a substitution file to automatically rename existing patterns in your COBOL element names.

  1. Add a file called dictionary.properties under the mappings/ folder of your COBOL Reverse Project;
  2. For each pattern you want to replace, add an entry key=value;
  3. In the next bean modernization process, all matching patterns in your COBOL elements names will be replaced by the value you specified.

Example
mappings/dictionary.properties : TX=Tax
INV-TX-CODE -> invTaxCd

Bean Redefinition

Modernizing redefinitions can be done using the wizard. Let's take an example :

BeanModernization11

The Bean Modernization Wizard on these two structures gives the following result :

BeanModernization12

Both TestRedefines2 and TestRedefines2R have a red icon to indicate the redefinition between them. The properties panel on the right gives the information about which structures redefines/are redefined by others.

To resolve the redefinition, choose the structure you want to keep, then right-click on it and select the Use as master redefinition entry.

BeanModernization13

The redefined element is deleted as well as its properties. Instead, getters and setters are used to recreate redefined properties based on master properties. In the above example, the result is as follow :

BeanModernization14

NOTE : For the time being, this operation is only available between structures whose sizes match.

Global Preferences

Global preferences regarding bean modernization behaviors can be found in the Window -> Preferences Eclipse menu, in the Blu Age -> Blu Age Reverse -> Bean Modernization entry menu.

The following table describes each bean modernization preference :

Preference Description Default value
Transform attribute/class name containing underscore '_' into camelcase Classes and properties names with underscores in the legacy layer are converted into camelcase naming convention. False
Generate "AsString" attributes in VOs Whether or not to generate AsString utilitarian methods for Value Objects. True
Generate attributes default values Whether or not to generate default values for properties.
These default values are either computed from the legacy elements or computed from the standard default values of the modernized type of the property. The Empty default values choice allows to generate empty strings as default values, whereas the fixed-sized default values allows to generate a string filled with spaces, at the size of its legacy equivalent.


True / Empty default values
Initialize collection attributes Whether or not to apply appropriate configuration to collection attributes and associations in order to further automatically generate their initialization / fill.
False
Generate getters/setters operations Whether or not to generate getters/setters process operations for each modernized attrbute.
False