cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SLD problem working with DefaultItemModificationHistoryService

Former Member
0 Likes
315

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi,

this is a known issue and it will be (partially) fixed in the next version. In general the remove operation will not be supported in SLD and in case SLD is enabled the removals will not be persisted.

As far as I know there is no due-date to achieve feature parity for enabled SLD in this case.

If you recorded the removals for reporting purposes the new annotation framework for GDPR may be used. If that was used to allow for rollback (re-store of the removed data), unfortunately it will not be possible.

Cheers, Wojtek

Answers (0)