Skip to Content
0
Former Member
May 19, 2018 at 09:15 AM

SLD problem working with DefaultItemModificationHistoryService

150 Views

We enabled SLD just recently and most things seemed to work fine except removing things. When removing something from Backoffice it throws an exception in bin\ext-backoffice\backoffice\web\webroot\WEB-INF\classes\com\hybris\backoffice\cockpitng\dataaccess\facades\object\savedvalues\DefaultItemModificationHistoryService.class

in this method:

 protected void logModifications(ItemModel model, ItemModificationInfo modificationInfo) {
         Map<String, Object> originalValues = new HashMap();
         Map<String, Object> modifiedValues = new HashMap();
         Iterator var6 = modificationInfo.getModifiedAttributes().iterator();
 
         while(var6.hasNext()) {
             String attribute = (String)var6.next();
             originalValues.put(attribute, this.toPersistenceLayer(modificationInfo.getOriginalValue(attribute), modificationInfo.isLocalized(attribute)));
             modifiedValues.put(attribute, this.toPersistenceLayer(modificationInfo.getModifiedValue(attribute), modificationInfo.isLocalized(attribute)));
         }
 
         if (!modifiedValues.isEmpty()) {
             if (modificationInfo.isNew()) {
                 JaloConnection.getInstance().logItemCreation(model.getPk(), modifiedValues);
             } else {
                 JaloConnection.getInstance().logItemModification(model.getPk(), modifiedValues, originalValues, false);
             }
         } else if (this.getModelService().isRemoved(model)) {
             Object deletedObject = this.getModelService().getSource(model);
             JaloConnection.getInstance().logItemRemoval((Item)deletedObject, false);
         }
 
     }

Notice the isRemoved call. There it does: Object deletedObject = this.getModelService().getSource(model);

This looks like this:

 public <T> T getSource(Object model) {
         ServicesUtil.validateParameterNotNull(model, "Parameter 'model' is null!");
         T ret = this.getModelConverterByModel(model).getSource(model);
         if (ret == null) {
             throw new IllegalStateException("model " + model + " got no source");
         } else {
             return ret;
         }
     }

Here it throws the IllegalStateException when SLD is enabled. Do we need to enable something more in order to use SLD than just the persistence.legacy.mode=false like it says in the documentation?

There is a method in the modelService which says getPersistenceSource and that seems to work with SLD but getSource does not seem to.