11-04-2016 2:11 PM - edited 02-04-2024 4:47 AM
After extending the item from out of the box jars given by Hybris, Can we extend the existing column attribute and make it as a primary key?
The easiest way to approach this would be to create your own implementation of IntegrationKeyGenerationStrategy (specifically this method String generateKeyValue(final String type, final Map<String, ?> keyValues)
)that appends the enddate only to the type you’re interested in.
<!-- key generation strategy -->
<alias name="alphabeticalIntegrationKeyGenerationStrategy" alias="integrationKeyGenerationStrategy" />
<bean name="alphabeticalIntegrationKeyGenerationStrategy"
class="com.hybris.datahub.composition.key.AlphabeticalIntegrationKeyGenerationStrategy">
</bean>
and just override this bean with your implementation in an extension.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rafal, I tried doing what you suggested also created my own implementation but the class(implementing "integrationKeyGenerationStrategy") I wrote is not getting triggered, I put some Sysout and I cannot see them getting executed on Command prompt. So can you please guide me about where and how to put this logic which you suggested.
If I were to create a new bean named AppendEndDateIntKeyGenerationStrategy
:
<alias name="appendIntegrationKeyGenerationStrategy" alias="integrationKeyGenerationStrategy" />
<bean name="alphabeticalIntegrationKeyGenerationStrategy"
class="com.hybris.datahub.composition.key.AppendEndDateIntKeyGenerationStrategy">
</bean>
if you drop an extension containing this file in a correctly named extension jar with
enddate-datahub-extension.xml
(can be empty)
and **enddate-datahub-extension-spring.xm*l containing the bean definition above it should do the trick. Having the correctly named -extension.xml file will force this bean to be loaded after the original implementation, thus overwriting the original implementation. Having the alias is important.
User | Count |
---|---|
6 | |
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.