Reputation: 63
I am trying to understand custom properties in hybris data modeling; Could anyone share useful links or information about it?
Upvotes: 1
Views: 3641
Reputation: 635
Item attributes define the state of an item. They are actually the columns of the the db table that is created (except the dynamic attributes) as a result of platform build and update process.
Custom attributes are certain defined attributes which are used in the type system definition to defined certain properties of a type. In general, if you interpret the metadata of the type system you may read the attributes to achieve the desired behaviour. They could be defined at various levels
<custom-properties>
<property name="catalogItemType">
<value>java.lang.Boolean.TRUE</value>
</property>
<property name="catalogVersionAttributeQualifier">
<value>"catalogVersion"</value></property>
<property name="uniqueKeyAttributeQualifier">
<value>"id"</value>
</property>
</custom-properties>
these properties are defined at a type level - These attributes provide catalog awareness at a type level. These attributes could be retrieved these item type properties at runtime via the getProperty( String propertyName ) methodThere are other examples as well.
<relation code="User2Addresses" generate="true" localized="false" autocreate="true">
<sourceElement type="User" cardinality="one" qualifier="owner">
<modifiers read="true" write="true" search="true" optional="true" initial="false"/>
</sourceElement>
<targetElement type="Address" cardinality="many" qualifier="addresses">
<modifiers read="true" write="true" search="true" optional="true" partof="true"/>
<custom-properties>
<property name="condition.query">
<value>"{original} is null"</value>
</property>
</custom-properties>
</targetElement>
</relation>
The property holds a string that is later added to the 'where' part of the select query generated for a one-to-many or many-to-one relation.
<relation code="AbstractOrder2AbstractOrderEntry" localized="false" generate="true" autocreate="true">
<sourceElement type="AbstractOrder" qualifier="order" cardinality="one">
<modifiers read="true" write="true" search="true" optional="true" />
<custom-properties>
<property name="ordering.attribute">
<value>"entryNumber"</value>
</property>
</custom-properties>
</sourceElement>
<targetElement type="AbstractOrderEntry" qualifier="entries" cardinality="many" collectiontype="list" ordered="false" >
<modifiers read="true" write="true" search="true" optional="true" partof="true" />
</targetElement>
</relation>
<property name="readOnlyForUI">
<value>Boolean.TRUE</value>
</property>
<property name="hiddenForUI">
<value>Boolean.TRUE</value>
</property>
Hope this helps!
Upvotes: 3
Reputation: 5810
I hope you want to know about
<custom-properties>
<property name="catalogItemType">
<value>java.lang.Boolean.TRUE</value>
</property>
<property name="catalogVersionAttributeQualifier">
<value>"catalogVersion"</value>
</property>
<property name="uniqueKeyAttributeQualifier">
<value>"code"</value>
</property>
</custom-properties>
These <custom-properties>
are used to define ItemType as catalog aware. Like Product Type.
Upvotes: 0
Reputation: 301
Have a look at The Type System in Hybris Help, as well as Data Models in the Hybris123 section.
Models are defined per extension in extensionname-items.xml, and generated during the build process.
In order for model updates to be reflected in the type system of your instance, run a system update in HAC > Platform > Update. For more information, see also Initializing and Updating SAP Hybris Commerce.
Upvotes: -1