Part III. SAP Commerce Developers Toolset (v.2023.2.7 Intellij IDEA plugin)


This article is brought by
Mykhailo Lytvyn
Software Engineering Team Leader, Solution Architect, Development/Performance/Open-Source Lead

Contributors & Editors:
Rauf Aliev, Chief Software Engineer, Solution Architect

 

Welcome back!

Hard to image how fast time flies, how the Plugin gained power, features and new happy users.

It’s been almost nine months since my first commit to the Plugin repository on a late night on the 9th of October 2022.

With every new day and every new line of code, experience transforms into realization of crazy ideas you thought were impossible a day before.

Instead of thousand of words, let’s start and dig into new features introduced between 2023.1.1 and 2023.2.7 versions of the Plugin.


As always, if you would like to contribute or share any ideas, the Plugin‘s GitHub repository is open.

To begin with, check out the official Intellij Platform Plugin SDK documentation.


Everything about the Project

New light and dark custom icons

Common icon for various activities
OOTB features or additional OOTB extensions
Core features and extensions
external_dependencies.xml
unmanaged_dependencies.xml
Cloud-only extension
Custom extension
Core extension
OOTB extension
Platform extension

Let’s call it Project Import 2.0… You may ask: why? The answer is clear – new structure, new facets, new compilation, new modules and new features.

  • Import will create new IDEA modules for each sub-module of the extension: backoffice, acceleratoraddon, web, commonweb, hmc, hac
  • Project view Module-type specific icons in the Project View
  • Automatic configuration of the Database integration based on project settings during project import/refresh
  • Show mandatory Ext and Platform extensions at the end of the Import Project Wizard
  • Enabled Wizard-based Project Import from the Welcome Screen
  • Register groovysrc directory as a source directory
  • Changed default location for IDEA modules, from now on they will be stored in the /.idea/idea-modules
  • Enhance you project with custom Project Icon, if not selected default one will be used
  • Refresh project from Gutter pane if extension is not yet imported as a module, available for both extensioninfo.xml and localextensions.xml
  • Respect extensions registered via path with autoload=”true”, read more at SAP Help Portal – Configuration Options in localextensions.xml
  • Migrated all project settings to Kotlin DSL 2
  • Added possibility to import Gradle KTS projects as modules
  • Added configurable possibility to hide full Module name in the Project View

Kotlin

SAP CX supports multiple languages, latest release of the Plugin adds support of the Kotlin language via tight integration with kotlinnature extension.

  • Auto-register kotlinsrc / kotlintestsrc as a source directory
  • Auto-register Kotlin Facet
  • Auto-adjust Kotlin Compiler based on kotlinnature settings and project JDK
  • Inject FlexibleSearch language into not concatenated Strings and String Templates without params

CCv2

New light and dark custom icons

New icon for CCv2 module
New icon for CCv2 module group
  • Added possibility to import CCv2 folders as modules, such as: core-customize, datahub, js-storefront
  • If detected, select CCv2 modules during project import
  • Added Node.js 18 as an option to the CCv2 js-storefront manifest file

Hybris administration console (hac)

  • Enhanced Cluster support, support node routing, especially for CCv2
  • Allow blank port for connection settings
  • Respect JSESSIONID and cookies per HAC connection settings
  • Improved handling of the Set-Cookie header during login
  • Automatically re-login in case of 405 response code
  • Show connection URL in the tooltip for connection switcher
  • Use HAC project properties during first project import for remote connections

Omni Commerce Connect (OCC)

  • Added code completion and references of Bean properties in the Level Mapping tags
  • Display a flatten type for an item in the code completion menu for Level Mapping tags

Groovy Script

  • Introduced actions toolbar for .groovy files
  • Added Groovy settings pane and possibility to toggle actions toolbar visibility

Extension Info

  • Added possibility to identify if extension is an addon (project refresh required)
  • Navigation to Extension declaration via Gutter icon
  • Generate module dependencies diagram from the Gutter pane with a single click

Local Extensions

  • Navigation to Extension declaration via Gutter icon
  • Refresh project from Gutter pane if extension is not yet imported as a module

Spring Framework

  • Added code completion and navigation for typeCode Interceptor property within the Spring XML file

FlexibleSearch

It is not just FlexibleSearch, it can be called FlexibleSearch 2.0 because of total rewriting of almost everything related to it.
New language JFlex Parser model and Lexer implementation support much-much-much more complex queries.

Brand-new icons:

Column alias
Table alias
Outer join
Parens
Separator
Star
  • Folding support
  • Support both . and : as separator character
  • Brand-new possibility to Unify case of the reserved words, change to upper or lowercase with a single click
  • Added support of the multiline comment block /**/
  • Added table & column aliases find usages
  • Added support of the localized attributes
  • Added documentation for type name in the FROM statement
  • Added possibility to copy query from the Java 15 text block “””SELECT * FROM {Product}”””
  • Automatically inject default alias separator on code completion, “myAlias + ENTER” wil result into “myAlias.”
  • Improved inspection and validation of the FlexibleSearch
  • Improved code completion and reference resolution for Enum attributes
  • Improved formatting, better table based formatting for multiline entities (eg, several joins)
  • Improved Color Scheme, added support of table aliases, localized attributes, outer join, function names, complex parameters (?session.user.currency), etc.
  • Improved code completion
    • support Enum and Relation types
    • list suitable aliases
    • allowed languages taken from the lang.packs property
    • added table alias suggestion based on the Table name (Product2Category -> p2c, p_c, pc)
    • subqueries {{ }}
    • joins .. JOIN
    • parens, brackets, braces ( ), { }, [ ]
    • table postfixes ! & *
  • Rename table & column alias via inline refactoring
  • Project specific Settings pane based on Kotlin DSL 2
  • FlexibleSearch copied from the Java classes will be properly formatted
  • Introduced actions toolbar for .fxs files
  • Dozens of other improvements…

Inspection rules:

  • Item Type is not defined
  • Attribute is not defined
  • Validate usage of the : in non SAP CX column as a separator, only . is allowed for such cases
  • Usage of the true / false, use 1 / 0 instead, see SAP Help Portal – Boolean parameters in queries

Polyglot Query Language

Take a note, that it is available only from SAP Commerce 1905+.

Welcome new custom language! Actually, it is a sub-version of the FlexibleSearch language with limited capabilities and different purpose.

It allows you to get your data from an alternative storage, such as a document-type storage, read more at SAP Help Portal – Polyglot Persistence Query Language.

  • File icon (most probably, will be changed later)
  • New file extension .pgq
  • Support of the Syntax highlighting
  • Custom configurable Color Schema
  • Custom Code formatting
  • Complex code completion and reference validation, similar, but not equal to FlexibleSearch
  • With single and multi-line comments
  • Braces matcher – when opening and closing braces will be highlighted
  • Support of the folding
  • Custom validation and possibility to Unify case of the keywords
  • Introduced new Console to enable execution of the Polyglot queries on a remote server
  • Introduced actions toolbar for .pgq files
  • New context menu action to Create new Polyglot Query file
  • Copy your .pgq file to console via new context menu action

Inspection rules:

  • Type should exist
  • Attribute should exist for a Type
  • Only localized attribute can have language, e.g. {code[en}

Cockpit NG System (Backoffice)

  • Added merge-by dependant complex contribution & inspections for parent
  • Added merge-by dependant contribution for parent
  • Added folding for -backoffice-config.xml files
  • Added code completion for AdvancedSearch operator parameter
  • Added code completion and reference resolution for Enum attributes
  • Improved qualifier reference handling in case of set spring-bean for lv:column
  • Improved code completion for context tag by boosting most suitable types

Inspection rules:

  • Validate parent value according to type value of the context tag in case of merge-by=”type” mode
  • Adjusted DOM inspection fpr AbstractActionType tag
  • Adjusted DOM inspection for Essentials tag
  • Adjusted CngContextParentIsNotValid inspection to ignore merge-by=”type”

Type System

Welcome new light and dark icons for Type System:

Group By (used in Preview)

Atomic type
Enum type
Collection type
Item type
Map type
Relation type

Types

Atomic
Enum
Collection
Item
Map
Relation

Type characteristics

Enum value
Relation source
Relation target
Attribute
Ordering attribute
Custom property
Index
Index (remove)
Index (replace)
Index (unique)

Besides icons, few more features introduced to simplify coding and support missed SAP Commerce Type System attributes:

  • Navigate to Dynamic Attribute Handler directly from the inlay hint
  • Added ordering attributes support for 1-to-m relations (those ending with POS), read more at SAP Help Portal – Relations

Type System – Diagram

Prerequisites: Intellij IDEA Ultimate edition

Long waiting feature is finally here – feel full power of the Plugin in combination with Intellij IDEA Ultimate Diagram capabilities. Legend can be found here – Type System Legend.

To generate Type System Diagram for current project you can:

  • Open Tools > [y] SAP Commerce > Show Type System Diagram
  • Right click > Diagrams > Show Diagram > [y] Type System
  • Click on a Diagram icon at the top of the items.xml file

Just take a look on those cool features available for Type System Diagram!

  • Gutter pane action to quickly generate Diagram
  • Remove any node at any time
  • Not only remove, but also restore previously removed nodes
  • Exclude creation of any node based on Name, just add to exclusion list and that’s all
  • Transitive dependencies
  • Edges which will show PartOf relations
  • Edges to show all dependencies between types
  • Possibility to “collapse” and “expand” details of selected nodes
  • Show non-transitive, non-Item custom types, like Map, Relation, Enum, Collection or Atomic
  • Enhanced tooltip of the Node, describing all crucial details of the Type
  • Support of the stop Types by names, after which nodes will not be processed further
  • Different header background color for custom Type Nodes
  • Limit rendered nodes according to the Scope
    • All – use with caution as it will render all types used in the project
    • Custom with Extends – used by default as most accurate representation of the Type System
    • Only Custom – same as above, just without extends
    • Only OOTB – simple as it is, only out-of-the box types and only if there is a need

Type System – Preview

Preview of the Type System provides overview of all Types used in your SAP Commerce solution. With intention to provide alternative way to manipulate Type System, by not touching items.xml files.
The Plugin provides detailed and accumulated information for each Type with new edit and navigation capabilities.

Go-to declaration icon
  • Added collapse all / expand all actions for Type System Preview
  • Enabled possibility to delete custom Enum values, Item attributes/custom properties/indexes
  • Go to declaration of the type/field from the tree or details pane
  • Show modifiers and persistence information for Items

Type System – items.xml

Updated interceptor icon

  • Added completion and navigation for items.xml – metatype attribute
  • Added folding
  • Added navigation to generated Item & Enum classes and Enum values fields from the items.xml
  • New flag to disable/enable validation of the generated files based on the items.xml
  • Improved folding for Relation tags in the items.xml

Inspection rules:

  • Validate usage of the metatype attribute
  • Deployment tag must not be declared for one-to-many relation
  • Deployment table name must not exceed max length deployment.tablename.maxlength
  • Relation qualifier and modifiers must not be declared for navigable=’false’ end
  • Only one side of many-to-many relation must be navigable=’false’
  • Qualifier must exist for navigable=’true’ part in many-to-many relation

Bean System

Beans are everywhere, when they are brewed properly it may be a great beverage. And the Plugin is here once again to master the recipes, the tools and help you to become an outstanding Barista!

Some thoughts for the future:

What comes to my mind is possibility to convert Bean <-> WsBean <-> Event.
Plain conversion may not be too helpful, on other hand, condition-based conversion will require much more efforts.
One of such conditional Inspection to convert Bean into WsBean may be usage of the Bean in the OCC xml level mapping.


If you can imagine any other cases suitable for conversion feel free to create a new GitHub issue or drop a message in the Slack!

Brand-new light and dark icons

Group By (used in Preview)

DTO
Enum
Event
Web-service DTO

Types

Bean
Enum

Type characteristics

Enum value
Property
Primitive
Boxed
Collection
Map
Object

With latest release beans.xml enhanced with un/common features such as:

  • Navigation to Bean siblings in the beans.xml
  • Improved support of the Bean System extends and generics for beans
  • Bean System enhanced with support of the properties defined in parent beans
  • Code completion for:
    • Bean’s class and extends attribute
    • Enum’s class attribute
    • Bean Generics used in the class, extends and type attributes
    • Hint name attribute
    • Bean type property attribute
  • Reference resolution for:
    • Bean property name attrbiute
    • Bean extends attribute
  • Folding for beans.xml files
  • Find usages for bean properties
  • Navigation from a declared bean and bean property to the generated java property

Bean System – Preview

Preview of the Bean System received its first write capabilities and few new actions.

Go-to declaration icon
  • Added collapse all / expand all actions for Bean System Preview
  • Enabled possibility to delete custom Enum values, Bean properties/annotations/hints/imports
  • Go to declaration of the bean/field from the tree or details pane
  • Property type will be properly flattened in the properties table

Inspection rules for beans.xml:

With new inspection you will do more by doing less!

  • Java keywords and reserved words cannot be used as Bean property name
  • Unescaped < sign usage is not allowed in the Bean property type
  • Escape > sign in the Bean property type
  • Escape > and < sign in the Bean attribute class
  • Common java.lang package can be omitted in the Bean property type
  • Validate DOM structure and references

ImpEx

Oh.. ImpEx, so many tears, so many hours, it’s hard to count, even harder to measure how much each Developer put into it.

That’s why I tried my best to make every Developer at least slightly happier, when they are dealing with an ImpEx.

Through various improvements and uncovered hidden features I hope that new and existing SAP Commerce developers will enhance their ImpEx files and will understand better capabilities they provide.

Besides list below, there are still few more thoughts on what I can do for ImpEx:

  • Added sld.enabled modifier support for Type declaration, read more at SAP help portal – ServiceLayer Direct
  • Added support of the item reference attributes, enabled code completion, validation and references support, read more at SAP Help Portal – ImpEx Header
  • Added folding of the boolean false modifier and Type modifiers
  • Added code completion of all available languages for lang modifier
  • Enabled inline macro renaming
  • Improved folding support of the nested attributes
  • Improved highlighting and evaluation of macros, as well as “$config-” macros
  • Improved code completion and reference resolution for Enum attributes
  • Adjusted color schema for sub-types
  • Navigate to lang.packs property declaration from the lang modifier
  • Omit package name of the Class in case of the jar: property prefix
  • Type attribute validation, code completion and navigation for complex header, sample: catalogVersion(catalog(id, wrongAttribute))
  • Show documentation for sub-type, Header type name, line attribute and type modifiers
  • Inject Groovy language into Script.content if scriptType set to Groovy
  • Inject Javascript language into Script.content if scriptType set to Javascript
  • Inject FlexibleSearch language into SearchRestriction.query
  • Ignore case for type in the reference type (e.g. groups(customer.uid))
  • Boost child types code completion for inline header parameter
  • Introduced actions toolbar for .impex files
    • Execute and Validate current ImpEx file
    • Select ImpEx table statement
    • Remove table and Remove column actions
    • Move Column Left & Move Column Right actions
    • Insert Column Left & Insert Column Right actions, after insertion code completion popup will be shown automatically
  • Added support of the Header Abbreviations
    • Code completion
    • Reference resolution
    • Color scheme
    • Show documentation for Header Abbreviation parameters
    • Adjusted Lexer to enable support of the @ character for Header Parameter
    • Automatically preselect special part of the Header Abbreviation starting with @ character

ImpEx – User Rights 2.0

As you may now, User Rights != ImpEx, they are processed differently and have strict rules.
It may be worth refreshing the knowledge and, “thanks SAP!, we do have it well-documented at SAP Help Portal – User Rights.

To be able to support all User Rights features I had to rewrite from the scratch all logic related to it.
As an outcome each developer will have better view, understanding and simplified usage of the User Rights defined in the ImpEx file.

  • Brand-new formatting model
  • Type System related code completion and reference support for Type and Target column
  • Possibility to skip Password column
  • Support of the attribute level “.” permission identifier
  • Validate references to Type System
  • Validate header parameter order and name

Inspection rules

  • Type modifier is unknown
  • Attribute modifier is unknown
  • Unique document id rule will report both DocId and reference qualifier
  • lang modifier is used only for localized attributes
  • lang modifier value is present in the lang.packs
  • Inline type for reference parameter should exist
  • Inline type for reference parameter should extend its type
  • Only UPDATE allowed for non-dynamic enum inspection
  • Ensure that all macros required by Header Abbreviation are declared
  • Do not inspect special parameter for uniqueness
  • Ignore case for parameter for unique column without an index inspection
  • Add missing value groups for value lines
  • Delete blank header parameter
  • Delete orphan value group

Business Process

Business process may be simple or complex, to improve its usability this release includes several visual improvements, as well as injections of custom languages.

In the next release it’s planned to enable folding support.

Business Process – Diagram

This functionality is not new, but with new enhancements you may think that you see brand-new Diagram, thanks to:

  • Quick Gutter pane action to generate Diagram
  • Edges and cycle edges coloring
  • Showing Node properties
  • Showing context parameters node
  • Showing start node of the business process

Other

  • Improved cleanup on Project dispose
  • Improved performance of the Global Meta Model and Type System LineMarkers
  • Improved performance via usage of the PSI cache
  • Added registration of the latest Ant targets
  • Migrated Business Process JAXB mapping to Intellij IDEA Api
  • Mass migration from Java to Kotlin
  • Removed custom rt-ant support, it did not work at all
  • Added Line Marker Provider settings and unified API usage
  • Improved default XML values handling
  • Added Project icon for Plugin repository
  • Replaced Caffeine cache with IDEA user data
  • Added possibility to skip non-existing source directories during project import
  • Improved detection of the Gradle modules
  • Adjusted inline documentation for Type System
  • Hide custom module libraries in the Project View

Fixes and Adjustments

  • Updated custom icons for Business Process diagrams
  • Show validation progress of the items.xml
  • Show progress of the Type System Global Meta Model creation
  • Show progress of the Bean System Global Meta Model creation
  • Show progress of the CockpitNG System Global Meta Model creation
  • Console is not releasing Document on Project dispose
  • Fixed “flickering” issue for Bean and Type Systems Preview
  • Fixed code completion for requires-extension within extensioninfo.xml
  • Fixed Type System Item extends identification
  • Fixed Ant targets registration after Project Refresh
  • Non-navigable relation ends will be correctly resolved as source or target
  • Type and Bean System preview is not always displayed
  • Type is not detected for CockpitNG Wizard when there is no initialize section
  • Fixed Compact Middle Packages in the Project View
  • Use main config folder during project import
  • Register Web Facet for commonweb and acceleratoraddon
  • Do not register hmc sub-modules if there is no hmc extension
  • Ensure that Properties Plugin dependant code works only when corresponding Plugin is enabled
  • Compact middle packages not working
  • Bus is already disposed for consoles
  • Multiple other minor and not issues

Plans & Ideas

  • Add FlexibleSearch execution from the gutter bar
  • Improve representation of the FlexibleSearch query results, use SQL-like query results view
  • Allow connection with CCv2 to execute queries from the Consoles

That’s all for now! Stay tuned, submit your ideas and contribute!

Leave a Reply