Une image contenant texte, signe

Description générée automatiquement

CSV Importer Post Processors

 

Overview

This helper extends the functionality of the Rhapsody CSV Importer by running post-processors.

Activating the Post Processor Capability

This is achieved using the Rhapsody property below:

Model.TableLayout.CSVImporterHookPluginMethod

 

A screenshot of a computer

Description automatically generated

At the time of writing this property is not available through stereotypes, the only way to apply it is programmatically or manually. Applying any of the post processors described below automatically sets this property.

Running Post Processors

After specifying post processor(s), run the CSV Import as normal. Rhapsody will import the CSV into the model and the post processor(s) will further manipulate the imported data.

Specifying Post Processors

When a post processor is applied to the CSV Importer, a CSV Import Post Processor is added to it. This indicates that a specific post processor should run and encapsulates any additional required data for that post processor to function. To remove a post processor, delete the CSV Import Post Processor or remove its corresponding column (see below). a CSV Import Post Processor should not be renamed as the name dictates the type of post process. Multiple post processors may be applied:

A group of text on a white background

AI-generated content may be incorrect.

Specifying the Column

Post processors read the column data from the CSV file. To specify which column in the CSV file the post processor should use, add a column to the CSV Importer:

·       Type = Tag

·       Property = the CSV Post Processor

Note that at the time of writing the Rhapsody API call to add a tag to a CSV Importer is broken and so this must be performed manually.

 

For example, the CSV Importer below, the Dependency Post Processor will look in the third column of the CSV file for its model elements:

 

A screenshot of a computer

AI-generated content may be incorrect.

 

Note that during a CSV Import, this column causes Rhapsody to add new tags to the imported data, however the post processor(s) remove these tags after they have completed.

 

Multiple Post Processors may be specified by adding multiple Post Processor tags and multiple columns, these will be processed in column order.

Post Processors

Each post processor is described here:

·       Dependency

·       Owner

·       Stereotype

 

Locating Model Elements

Custom CSV columns will typically refer to other model elements that the Post Processor(s) will try to find (it uses Rhapsody’s’ own search facility to find them unless the model element(s) are specified by full path). There are two parts to such a search: Type and Location.

Type

All post processors have search criteria tags that allow them to find model elements by type:

 

FindMetaclass

This tag is mandatory and is a comma separated list of terms which may be new terms or base terms (refer to the metaclasses.txt file in the Rhapsody installation for base terms).

 

Examples:

·       Metaclass = UseCase,Block

Would return any use case or block that has the name specified in the CSV file cell for this Post Processor.

 

FindStereotype

This tag is optional. The tag is typed by Stereotype and has a multiplicity of *.

The Post processor uses Rhapsody’s own search engine to find element(s) and so if multiple stereotypes are specified then only elements that have ALL of them are returned.

 

Example:

·       Metaclass = A_Lister

·       Stereotypes = <<Employed>> and <<SAG_AFTRA>>

Would return any A_Lister that has the name specified in the custom cell (assuming A_Lister is a new term) AND both specified stereotypes.

Location

Post Processors search for elements in the following order of priority:

1. Full Path

If the cell contains ‘::’ then this is assumed to be the full path to a model element. Only that location is checked.

 

2. Same Package

If the cell does not contain “::” then it is assumed this is simply a named element. The search scope is the same package as the model element imported by the CSV Importer (this will be the ‘target package’ of the CSV Importer unless the element has been moved by a prior post processor).

 

3. Full Search

If no model element is found by (2) then the search scope is extended to the entire project.