-
Notifications
You must be signed in to change notification settings - Fork 41
Languages: Java
This feature is based on IntelliJ IDEA Custom Type Renderers.
SAP Commerce Models are not easy to debug due fact that they have only single field ctx
which is available in the Debug preview.
This means that every time there is a need to get a value from the SAP Commerce Model’s attribute or relation, one must execute Code Evaluation.
But with the Plugin it is possible to preview all attributes
/ relations
/ collections
/ maps
in the Debugger preview for SAP Commerce Models thanks to created on-the-fly custom Java Type Renderers.
For model Item fields which require additional evaluation (such as relations), the Plugin adds lazy evaluation of the values, handled by On-demand
flag of the configured custom expression.
Take a note that the Java Type Renderers are not Project specific.
It means that if multiple SAP Commerce projects sharing the same model
Item
one has to refresh the Type Renderer beforehand to grab current Project item type details.
Icon is added every time when the Plugin identifies model Item.
During the debug session if the Plugin identifies SAP Commerce model Item, it adds new action [y] Create Type Renderer
in the corresponding node.
When clicked new Type Renderer will be created name of [y] <Class_Name>
and available via Application Settings Java Type Renderers
.
If custom Type Renderer is already defined for a model Item, the Plugin will add different action [y] Refresh Type Renderer
.
This Action will re-read Item definition in the current Project and re-create custom Type Renderer.
Detailed FlexibleSearch language injection covered in the corresponding section of the FlexibleSearch: Language Injection - Java wiki.
If FlexibleSearch specific elements identified in the Java string literals, FlexibleSearch language will be injected accordingly.
Injection is supported for different string literals declared as constants or variables. Injection is NOT supported for method parameters.
- Simple string:
"SELECT {PK} FROM {Product}"
- Multiline string:
"""SELECT {PK} FROM {Product}"""
- Complex string with concatenation:
"SELECT {PK} FROM {" + ProductModel._TYPECODE + "}"
Gutter pane icon which copies complete & auto-formatted FlexibleSearch to the clipboard and placed on a same line as FlexibleSearch string literal.
Official documentation for Dynamic Attributes.
Spring Bean reference resolution covered in the corresponding wiki section Spring.
The Plugin supports both declarations of the dynamic handler.
- via
<persistence attributeHandler="..."/>
- via Spring Bean id of
<ItemtypeCode>_<attributeQualifier>AttributeHandler
Dynamic handlers and logic behind may cause unexpected performance degradation. To ensure that Model's dynamic attribute is used on purpose the Plugin adds inline hint for getter
and setter
methods.
There are two possible types of the hint.
-
dynamic
- just an indicator that corresponding method is using dynamic handler behind the scene. -
dynamic⌝
- indicates that the Spring Bean declared viapersistence
tag has been resolved,command + click
on the hint will open corresponding Spring Bean class.
Official JetBrains documentation on Using Live Template.
ysri - injects template code for Spring dependency injection via @Resource
annotation.
@Resource(name = "<bean_id>")
private <Bean_Class> <field_name>;
log4j2 - injects template code for Log4j2 Logger and takes current class name as an argument for Logger factory.
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
...
private static final Logger LOG = LogManager.getLogger(<Class_Name>.class);
...
slf4j - injects template code for SLF4J Logger and takes current class name as an argument for Logger factory.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
private static final Logger LOG = LoggerFactory.getLogger(<Class_Name>.class);
...
This feature depends on IntelliJ IDEA Project Index completion, only once Index is ready corresponding references will be resolved and available as navigable icons in the Gutter pane.
Navigate to the Enum or Item declaration in the items.xml
from every generated Model class, which resides in the models.jar
file or located in the bin/platform/bootstrap/gensrc
directory.
If target Type identified new icon will be added to the Gutter pane and will navigate to the declaration on user click.
In case of multiple declarations of the same Type the Plugin will show list of all declarations on corresponding icon click.
SAP Commerce supports two types of Enums and both are supported by the Plugin.
- non-dynamic - generates of the Java Enum
- dynamic - generates special Java Class
If there are multiple declarations click on a Type Gutter Icon will list all of them.
Gutter pane icon leads to Enum declaration and placed on a same line as Enum class.
Gutter pane icon leads to Enum - value declaration and placed on a same line as Enum class.
If there are multiple declarations click on a Type Gutter Icon will list all of them.
Gutter pane icon which leads to Item declaration and placed on a same line as Item class.
Gutter pane icon which evaluates Item's interceptors and placed on a same line as field constant name of _TYPECODE
.
This feature relies on IntelliJ IDEA Ultimate edition and Spring plugin.
Gutter pane icon leads to Relation declaration and placed on a same line as a field constant of the relation used by the Item.
Value of the constant is taken to identify the Relation by its case-insensitive name.
Gutter pane icon leads to Item - ordering attribute declaration.
It is placed on a same line as a field constant of the ordering attribute used by the Item, its value is taken to identify the ordering attribute by its case-insensitive name.
Ordering attribute is a result of the ordered one-2-many
relation with ordered flag set to true
for many
side of the Relation.
Gutter pane icon leads to Item - attribute declaration. There are two places in the file where this icon is added.
First of all, it is placed on a same line as a field constant of the attribute used by the Item, its value is taken to identify the attribute by its case-insensitive name.
Secondly, it is placed on a same line as a method annotation @Accessor
, its parameter's qualifier
value is taken to identify the attribute by its case-insensitive name. Both getter and setter methods are supported.
Gutter pane icon leads to Relation - source declaration.
Gutter pane icon leads to Relation - target declaration.
Both icons will be added in a same way as Item attribute (at constant field and method levels), the Plugin will distinguish attribute declaration from the relation qualifier on its own.
Project
Systems
Languages
Integrations
Diagrams