A situation has come up in testing our SAP ECC -> Hybris Data Hub -> Hybris Commerce integration:
I have found this is because a CompanyAddress publication is dependent on the CanonicalParty existing already in DataHub with a type of "COMPANY" due to this OOTB Java in CompanyAddressPublicationHandler:
@Override public <T extends CanonicalItem> boolean isApplicable(final T item, final TargetItemCreationContext context) { if ("CompanyAddress".equals(context.getTargetItemTypeCode())) { final String canonicalPartyId = (String) item.getField("partyId"); final CanonicalItem canonicalParty = this.canonicalItemService.findLatestValidItem("CanonicalParty", canonicalPartyId, item.getDataPool()); if (canonicalParty == null) { return true; } final String canonicalPartyType = (String) canonicalParty.getField("type"); if (!"COMPANY".equals(canonicalPartyType)) { return true; }
As we haven't yet seen a DEBMAS, it will not be the case a CanonicalParty with a type of "COMPANY" can exist as it needs to see a DEBMAS-KTOKD:
<attribute> <name>type</name> <transformations> <transformation> <rawSource>RawDEBMAS</rawSource> <expression spel="true">#root.getField('E1KNA1M-KTOKD') eq null or #root.getField('E1KNA1M-KTOKD') eq '' ? 'PERSON' : 'COMPANY'</expression> </transformation>
My questions are: