@Override public RerunnableObjectInfo value(RerunnableObjectInfo rerunnableObjectInfo1, ChangePair changePair) { // TODO make this a bit more OO, e.g. avoid the instanceof all over the place Change source = changePair.getSourceChange(); Change deployed = changePair.getDeployedChange(); if (source == null && deployed == null) { // this branch and exception throwing here is to avoid null deference warnings in findbugs for the next else branch throw new IllegalStateException("This code branch should never happen; either of source or deployed should exist"); } if (source == null && deployed != null) { // In this case - the change exists in the target DB but was removed from the source rerunnableObjectInfo1.addDroppedObject(deployed); } else if (source != null && deployed == null) { rerunnableObjectInfo1.addChangedObject(source); } else if (ObjectUtils.equals(source.getContentHash(), deployed.getContentHash()) || source.getAcceptableHashes().contains(deployed.getContentHash())) { // In this case - the change exists in both the source and target db. // We need to check if anything has changed, using the hash LOG.trace("Nothing to do here; source [{}] and target [{}] match in hash", source, deployed); } else { rerunnableObjectInfo1.addChangedObject(source); } return rerunnableObjectInfo1; } });
@Override public RerunnableObjectInfo value(RerunnableObjectInfo rerunnableObjectInfo1, ChangePair changePair) { // TODO make this a bit more OO, e.g. avoid the instanceof all over the place Change source = changePair.getSourceChange(); Change deployed = changePair.getDeployedChange(); if (source == null && deployed == null) { // this branch and exception throwing here is to avoid null deference warnings in findbugs for the next else branch throw new IllegalStateException("This code branch should never happen; either of source or deployed should exist"); } if (source == null && deployed != null) { // In this case - the change exists in the target DB but was removed from the source rerunnableObjectInfo1.addDroppedObject(deployed); } else if (source != null && deployed == null) { rerunnableObjectInfo1.addChangedObject(source); } else if (ObjectUtils.equals(source.getContentHash(), deployed.getContentHash()) || source.getAcceptableHashes().contains(deployed.getContentHash())) { // In this case - the change exists in both the source and target db. // We need to check if anything has changed, using the hash LOG.trace("Nothing to do here; source [{}] and target [{}] match in hash", source, deployed); } else { rerunnableObjectInfo1.addChangedObject(source); } return rerunnableObjectInfo1; } });