How does Hybris get the label of the attributes in Backoffice? - sap-commerce-cloud

label (java.lang.String): Key for the localized column name. The value is looked up in the localization bundles. If this string is blank, the column is named according to #qualifier.
For example type="AbstractOrder" in *-backoffice-config.xml:
<editorArea:tab name="hmc.properties">
...
<editorArea:section name="hmc.common">
<editorArea:attribute qualifier="name"/>
<editorArea:attribute qualifier="description"/>
<editorArea:attribute qualifier="expirationTime"/>
</editorArea:section>
...
</editorArea:tab>
So, How do label attributes get from the database? I don't undestand. I tried reviewing two tables
ATTRIBUTEDESCRIPTORS
and
ATTRIBUTEDESCRIPTORSLP
But still not clear about it?
For example the label for the Product's code attribute can be found and modified for English language in core-locales_en.properties
As you noted above. However, I still see the config value stored in the Database when you change the value. When I delete this value in the config file.Then ant clean all -> start server ->[ hac -> Platform -> Update. (check only "Localize types")]. Although the value in the config file was deleted but the label did not change (It is similar to the value in the database).So can say: Label value is configured in the config file. But if not found in the config file it will look in the Database. I think so.But I still do not understand the mechanism of its implementation...

This question has same answer with your last question. Labels are provided by properties files. Check resource folder in your backoffice extension.

Related

How to remove Required field from an entity in Jhipster

I am new to Jhipster and I want to remove required field from column without changing anything else like
table name in h2 db or the names of the columns in that table. I tried to remove #NotNull annotation from entity name and set field in database to null but when i run integration test using
mvnw verify i get this error
EmployeeResourceIT.checkCompanyIsRequired:124 Status expected:<400> but was:<201>
Thank you in advance!
You must modify the EmployeeResourceIT test also so that it does not verify company requirement anymore.
It would be simpler to modify your JDL file to change the constraint on this field and import it.
And if you did not use JDL, you should learn it, it's more powerful than answering questions (see https://www.jhipster.tech/jdl/getting-started)
You can create your JDL file from your existing project using jhipster export-jdl

Ignore ID in Attribute Selection

I have a dataset with an unique id for each instance. Now I am running some Attribute Selection on that dataset. Concrete I use the CfsSubsetEval for selecting the relevant attributes.
The problem is that I don't want to include the id in this attribute selection, but I need it later to write out a .arff File (which should contain the id and the selected attributes).
I found some posts which used the FilteredClassifier. But in my case I want to have something like a FilteredAttributeSelection. Something like an exklusive view on the data for the AttributeSelection Algorithm.
Is there a way solving this problem?
Thanks in advance!
I solved the problem by copying the attribute vector (the ids) before the filter. After selecting the attributes I restore it.

How to change persistence property of cq:inplaceEditing

I wish to use cq:inplaceEditing to modify a property on my JCR whenever it is used by the AEM authors. Unfortunately, I do not know how to modify the name of the property that it actually modifies in the JCR. It appears that it only modifies the value of the property "text" by default.
For my purposes, I want to use its rich-text-editing for properties that have names I define, not just the default name "text."
The image at this link shows the tree which contains the cq:inplaceEditing (courtesy of CRXDE):
These are the attributes of cq:editConfig:
These are the attributes of cq:inplaceEditing:
...and this is what a content node of my JCR looks like when I use the inplaceEditor. I've blotted out the names of some properties for potential security reasons. Note that the "text" property below was changed when I used the inplaceEditor. Also note that I want to be able to define the property name that the inplaceEditor changes, rather than just the "text" property:
Is there a way to use a different property name instead of "text"?
-----------EDIT----------
After changing the property "textPropertyName" to the property that I am searching for, it still doesn't appear to actually modify the behavior of the inplaceEditor. It still only modifies the "text" property of my JCR nodes instead of the one that I put in the "textPropertyName" attribute.
This picture contains the attributes of my cq:InplaceEditingConfig:
The picture below contains the attributes of the JCR node at the path specified in the "configPath" variable in the picture above. Note that I set the textPropertyName attribute in this node and the text component still modifies the default attribute "text" instead of the one specified:
Finally, the picture below shows the contents of my JCR tree inside of the text component.
-----------ANOTHER EDIT----------
I discovered that the inline text editor was persisting the correct property after I had switched to the classic UI. For some reason, it doesn't work correctly with the touch UI.
How to find it
The inplace editing capability is defined by subclasses of CQ.ipe.InplaceEditing function. You can find it easily by just searching for editorType through the CRXDE tool.
Searching for the CQ.ipe.InplaceEditing returns multiple results such as CQ.ipe.TextEditor that at the very end of the script registers desired editorType i.e.: CQ.ipe.InplaceEditing.register("text", CQ.ipe.TextEditor);
The answer
Reading through the editor code you can find the first configurable property called textPropertyName which according to it's documentation is just what you are looking for. Combining it with the inplace configuration node (see Adobe's documentation) it is the solution for your case.
An example
You can try it by yourself on an instance of Geometrixx component.
First go to CRXDE and find Geometrixx Text component: /apps/geometrixx-gov/components/text.
Notice /apps/geometrixx-gov/components/text/cq:editConfig/cq:inplaceEditing#configPath property value.
Find /apps/geometrixx-gov/components/text/dialog/items/tab1/items/text resource and add new property: textPropertyName=myPropertyName.
Then just open the Geometrixx Gov page add Geometrixx Text component, edit it inplace and look into the Network console. You'll notice POST request with the altered parameter name
edit after TouchUI clarification
TouchUI case
If you want to achieve the same for TouchUI interface it doesn't go so easy, unfortunately. The text inplace editor for TouchUI is defined by /libs/cq/gui/components/authoring/clientlibs/editor/js/editors/InlineTextEditor.js.
Searching for "text" gives you an overview how hardcoded is this property. For AEM 6.1 (on which I'm testing it) you can find it's occurence in the ns.persistence.readParagraphContent function where the initialContent is extracted from the resource JSON map. Another occurence can be found in finishInlineEdit and addHistoryStep methods. Changing all three occurences of "text" to your value brings expected outcome.
This is obviously non-acceptable - it's a platform-wide change and will affect other (incl. ootb) components where it might no be expected. The simplest would be to just copy-paste whole editor into your clientlib and register the editor into a new name - see last couple of lines: ns.editor.register. If you feel comfortable in JS, it might be worth to extend this editor and alter just three methods that are affected.
As of AEM 6.3, the textPropertyName works correctly with the out-of-the-box PlainTextEditor.js
The property needs to be set on a config node under the cq:InplaceEditingConfig
Note – the source of the editor can now be found at:
/libs/cq/gui/components/authoring/editors/clientlibs/core/inlineediting/js/PlainTextEditor.js

Which table or columns store the changes made to a Hybris Type?

Does anyone have an idea which table or columns store the changes made to a
hybris Type?
suppose I changed the value of 'name' attribute for Client type in hmc, hybris logs this as a change (under changes field) and I can see it in HMC. However if I want to seee it in the database where I can see this? Please suggest.
savedvalues, savedvalueentry, props
A SavedValue object contains one or more SavedValueEntries which contains the old and new value (props)

How to specify the type of Primary Key as String in jhipster?

By default, jhipster create entity with id as long/int. I would like to use "String" for id. How to do that?
There are two steps:
Of course the property type in the Java class must be changed to String (and also update the getter and setter for that property).
Then create a Liquibase changeset that modifies the data type to String. See: http://www.liquibase.org/documentation/changes/modify_data_type.html
If there are foreign keys that depend on this id, then makes it a bit more complicated because the fk's will need to be dropped and recreated after the columns have been changed to String.
Take a look at src/main/resources/config/liquibase/changelog to see how to set up a changeset consistent with the jhipster. I usually copy an existing changeset, give it a new file name so that it is the last file in the directory (so you can see a chronological sequence of changes), and update the changeset id.
Then, the changeset must also be added to src/main/resources/config/liquibase/master.xml so that it is activated on the next app start.

Resources