on 11-17-2016 11:58 PM - last edited on 02-04-2024 5:07 AM by postmig_api_4
In my custom composition handler, the canonicalItem does not have all fields populated from Raw.xml mapping.
Example: Function in custom composition handler:
public T compose(CanonicalAttributeDefinition CanonicalAttributeDefinition,
CompositionGroup<? extends RawItem> compositionGroup, T canonicalItem)
The composition handler has order property defined > 1000 in spring.xml
The attribute on canonical object is mapping directly from a raw field in raw.xml
for example, this is the value I see on canonicalItem in the composition handler:
CanonicalItem{integrationKey='null', status=SUCCESS, compositionStatusDetail='null'BaseDataItem{id=null, dataPool=SAPORDER_INBOUND_POOL, fields={container=null, country=null, zipCode=null, orderType=null, orderNumber=null, ......
In this case, why is integrationKey='null' and orderNumber=null? A few values on the canonical item is populated, but it's not consistent which are populate each time.
If I look into the raw items in compositionGroup.getItems(), they all have valid value.
I also found the custom composition handler I define with higher order number are executed before lower number custom composition handlers.
Here is the reason. Your composition handler is 1000 which is identical to the base attribute handler. Because of this, the outcome of the sorting is random for identical(1000) order.
datahub-service-*.jar
datahub-service-composition-spring.xml
<bean id="localizedCompositionRuleHandler" class="com.hybris.datahub.composition.impl.LocalizedCompositionRuleHandler"
parent="abstractCompositionRuleHandler">
<property name="order" value="1" />
</bean>
<bean id="collectionCompositionRuleHandler" class="com.hybris.datahub.composition.impl.CollectionCompositionRuleHandler"
parent="abstractCompositionRuleHandler">
<property name="order" value="2" />
</bean>
<bean id="basicAttributeCompositionRuleHandler"
class="com.hybris.datahub.composition.impl.BasicAttributeCompositionRuleHandler"
parent="abstractCompositionRuleHandler">
<property name="order" value="1000" />
</bean>
Use order 1001 and it should be fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This composition handler has order 1029, but it is run before 1028 and 1030. This class is called only once, and all Raws in the composition group has valid order number. I want to format lineItemQuantity.
CanonicalItem{integrationKey='null', status=SUCCESS, compositionStatusDetail='null'BaseDataItem{id=null, dataPool=SAPASN_INBOUND_POOL, fields={sapVendorID=FDE, lineItemQuantityNumber=null, orderNumber=null, serialNumber=null, productID=null, CarrierTrackingCode=null, orderLineItemNumber=null, lineItemQuantity=null, deliveryNumber=null, sapVendorName=null, entryID=null}}}
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.