Languages: ImpEx - epam/sap-commerce-intellij-idea-plugin GitHub Wiki
Official documentation on ImpEx | Data Management with ImpEx.
Thanks to the custom language model support enabled by the Plugin it is possible to use core and rich features of the IntelliJ IDEA.
Official documentation on Scratch files | File templates.
The Plugin adds new file type ImpEx
with the .impex
file extension.
Thanks to that it is possible to create new blank ImpEx file at any moment, just start typing ImpEx
in the Scratches popup and click enter. Created ImpEx scratch file will not have any content.

On other hand, when ImpEx file is created via context menu File
-> New
-> ImpEx File
it will be created from the internal template.
UPDATE GenericItem[processor = de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor]; pk[unique = true]

It is an ultimate goal to replicate ImpEx language with all its capabilities as it's seen by SAP Commerce.
At this stage the Plugin supports most, if not all, capabilities of the Language, such as:
- Macros (variables).
- Header lines with modes, types, parameters, nested parameters, modifiers, abbreviations.
- Value lines with subtypes, values.
- Multiline values and multiline header parameters separated with
\
character. - Document id.
- Comments.
- Scripting.
Interaction with the Type System depends on a project index and will be available once it's completed.
Thanks to pre-parsed, cached and always up-to-date representation of the Type System the Plugin enables its support in ImpEx files via rich code completion, navigation and reference resolution.
Official documentation Color Scheme.
The Plugin ships color schemes for both Default (light) and Darkula (dark) color schemes.
It is possible to customise representation of the various elements of an ImpEx file.
- Macro and variables
- Header elements
- Modes
- Type
- Parameters
- Parameter modifiers
- Separators
- Value line elements
- Sub type
- Value of specific type - int, string, etc.
- Special values
- Collection prefixes
- Delimiters
- Separators
- Comment blocks
- Brackets
- Bad characters
- User Rights
- etc.
The Plugin will color odd / even value lines and, in addition to that, unique=true
parameters will be styled with the bold font.

ImpEx Color scheme can be customised via IntelliJ IDEA application Color Scheme
settings.

The Plugin adds syntax highlighting for several places to simplify understanding of the current context.
When user places a cursor on a value line element the Plugin will highlight corresponding header parameter.

When user places a cursor on a header parameter the Plugin will highlight all related value groups. It does not matter if cursor is placed on a parameter itself or one of its nested modifiers.

When user places a cursor on a macro declaration the Plugin will highlight its usages and vice-versa.

According to specification of the ImpEx language lines starting with the #
character represent comments.
Custom Lexer ensures that such lines will be considered as comments by IntelliJ IDEA.
As a result lines starting with the #
will be "greyed-out" and excluded from the processing by IDE.

Official documentation Code Style
The Plugin ships with predefined code style for ImpEx files which supports different code formatting options.
ImpEx Code style can be customised via IntelliJ IDEA application Code Style
settings.

Details of the Type System completion is covered in another wiki Systems: Type System - Code Completion.
Code Completion settings can be adjusted via project specific Settings.
Code completion will be available for multiple places and in various circumstances.
Configuration properties - after $config-
prefix.
This feature depends on a Properties plugin.

Macros - almost anywhere, ensure order correctness of the macro declaration and its usage.

Header modes - when cursor is placed on a new line.

All types - when cursor is placed after the header mode.

Type modifiers - after [
character and right after the type declaration in the header or after ,
character within the <Type>[ ... ]
block.

Type modifier values - after =
character in the type modifier block.
There are several modifiers and each may have different values according to official documentation. Depends on the modifier and its type the Plugin may provide different completion.
-
boolean type -
true
/false
. - disable.UniqueAttributesValidator.for.types - completion will contain all Item types, Enum types and Relation types.
-
disable.interceptor.beans - completion will contain all Spring beans implementing
de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping
. This functionality depends on readiness of the project index and enabled only for IntelliJ IDEA Ultimate. -
disable.interceptor.types - completion will contain all available Interceptor types, such as
validate
. -
processor - completion will contain all classes implementing
de.hybris.platform.impex.jalo.imp.ImportProcessor
interface. This functionality depends on readiness of the project index.

Header parameters - after ;
character in the header line. Also known as attributes
.
When type set in a header is resolved all its attributes will be listed.

Attribute parameter modifiers - after [
character and right after the attribute declaration in the header or after ,
character within the <attribute>[ ... ]
block.

Attribute parameter modifier values - after =
character in the attribute parameter modifier block.
There are several modifiers and each may have different values according to official documentation. Depends on the modifier and its type the Plugin may provide different completion.
-
boolean type -
true
/false
. -
string type - any string wrapped in the single quote
'
or plain text. -
mode -
append
(+) /remove
(-) /merge
(+?). -
cellDecorator - completion will contain all classes implementing
de.hybris.platform.util.CSVCellDecorator
interface. This functionality depends on readiness of the project index. -
translator - completion will contain all classes implementing
de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
interface. This functionality depends on readiness of the project index.

Header abbreviations - as an addition to the previous completion, the Plugin also adds configuration based aliases, read more in official documentation Header Abbreviations
This feature depends on a Properties plugin.
Nested header parameters - after (
character in the header parameter.
This completion will include attributes of the header parameter type as well as its child types.
Resolved child types usually shown at the top of the completion list.
To distinguish child type from an attribute proper type icon is used in combination with the child of <Type>
greyed-out typed text.


Alternative patterns in nested header parameter - after |
character in the header parameter.
Look for
Alternative Pattern
in the official docs Header.

Sub-types - when cursor is placed at the beginning of a value line. All child types of the type set in header line will be listed in the completion.

Navigate to the configuration property declaration.
This feature depends on a Properties plugin.

Navigate to the Item Type declaration (s).
There are various places with injected reference to the Item Type declaration.
- Item type in the header line.
- Sub-type set as a first value in the value line.
- Value of the
disable.UniqueAttributesValidator.for.types
. - Item type in the nested types of the parameter.
- Value of the
Type
column in the User Rights block. - Value of the
Target
column in the User Rights block.






Navigate to the Item Attribute declaration.
Attributes enhanced with references for few places.
- Column parameter,
code[unique = true]
. - Nested attributes,
catalogVersion(catalog(id), version)
. - Value of the
Target
column in the User Rights block.



Navigate to the class declaration.
Class specific reference will be injected in various places.
- Value of the type modifier
processor
. - Value of the parameter attribute modifiers
translator
andcellDecorator
.


Navigate to the InterceptorType enum value.

Navigate to the Spring Bean declaration.

Code Folding settings can be adjusted via project specific Settings.
To improve readability of the ImpEx files the Plugin adds folding feature for multiple elements.
- Resolved configuration property values.
- Values of the declared macros.
- Nested header parameters.
- Header type modifiers.
- Header attribute parameter modifiers.
- Value lines.
- Permission value of the User Rights block.


TODO
TODO
TODO
To minimise need to return back to official SAP documentation the Plugin adds in-place documentation for attribute modifiers.

In addition to SAP's documentation the Plugin generates one on a fly for Item Types.

Custom structure view is available for each ImpEx file and can be accessed at any moment.

Official documentation Breadcrumbs
To simplify navigation through ImpEx the Plugin adds support of the breadcrumb for header and value lines.
The Plugin enables macro renaming support via IDEA refactoring capabilities.

Official documentation Live Templates
deleteAll - injects template code for deleting all objects by type.
#PLEASE BE CAREFUL with this and add catalog version to the parameters if needed to avoid removing configuration from all sites
REMOVE [batchmode=true];itemtype(code)[unique=true]
;

userrights - injects User Rights template code for an object.
$START_USERRIGHTS
Type;UID;MemberOfGroups;Password;Target;read;change;create;remove;change_perm
UserGroup;;;;;;;;;
$END_USERRIGHTS

Groovy language injection Groovy - ImpEx
JavaScript language injection JavaScript - ImpEx
FlexibleSearch language injection FlexibleSearch - ImpEx
It is possible to show default values set via default
modifier.

Each ImpEx file is enhanced with an action toolbar and set of quickly accessible actions.
Execute ImpEx
Copies content of the current ImpEx file into the ImpEx Console and executes it.

Copies content of the current ImpEx file into the ImpEx Console.

Copies content of the current ImpEx file into the ImpEx Console and executes import in the validation mode.

Select ImpEx statement under the cursor.

Moves column to the left when cursor is placed in a value group or header parameter. Action will be disabled if it is already the first column.

Moves column to the right when cursor is placed in a value group or header parameter. Action will be disabled if it is already the last column.

Injects new blank column on a left, places cursor to the header parameter and triggers code completion.

Injects new blank column on a right, places cursor to the header parameter and triggers code completion.

Removes the column under the cursor.

Removes ImpEx statement under the cursor. Also can remove User Rights block.

Splits ImpEx statement under the cursor, all unique columns will be also available in both split statements.

Opens the Plugin specific IDEA settings pane for ImpEx.


Grants access to remote connections settings, as well as shows information about current active remote connection.
This feature depends on Copyright plugin and expects that corresponding configuration has been made.
The Plugin adds possibility to add copyright block to an ImpEx file.

TODO
User Rights details is out of the scope and are covered in a separate wiki User Rights.
The Plugin's ImpEx settings are Project specific and can be found under [y] SAP Commerce
-> Project Settings
-> ImpEx
.
