/** * Restore the recorded state from the rollback xml. * * @param target the patchable target * @param rollbackPatchId the rollback patch id * @param patchType the the current patch type * @param history the recorded history * @throws PatchingException */ static void restoreFromHistory(final InstallationManager.MutablePatchingTarget target, final String rollbackPatchId, final Patch.PatchType patchType, final PatchableTarget.TargetInfo history) throws PatchingException { if (patchType == Patch.PatchType.CUMULATIVE) { assert history.getCumulativePatchID().equals(rollbackPatchId); target.apply(rollbackPatchId, patchType); // Restore one off state final List<String> oneOffs = new ArrayList<String>(history.getPatchIDs()); Collections.reverse(oneOffs); for (final String oneOff : oneOffs) { target.apply(oneOff, Patch.PatchType.ONE_OFF); } } checkState(history, history); // Just check for tests, that rollback should restore the old state }
/** * Restore the recorded state from the rollback xml. * * @param target the patchable target * @param rollbackPatchId the rollback patch id * @param patchType the the current patch type * @param history the recorded history * @throws PatchingException */ static void restoreFromHistory(final InstallationManager.MutablePatchingTarget target, final String rollbackPatchId, final Patch.PatchType patchType, final PatchableTarget.TargetInfo history) throws PatchingException { if (patchType == Patch.PatchType.CUMULATIVE) { assert history.getCumulativePatchID().equals(rollbackPatchId); target.apply(rollbackPatchId, patchType); // Restore one off state final List<String> oneOffs = new ArrayList<String>(history.getPatchIDs()); Collections.reverse(oneOffs); for (final String oneOff : oneOffs) { target.apply(oneOff, Patch.PatchType.ONE_OFF); } } checkState(history, history); // Just check for tests, that rollback should restore the old state }
@Override public void apply(String patchId, Patch.PatchType patchType) { delegate.apply(patchId, patchType); applyPatchId = patchId; }
@Override public void apply(String patchId, Patch.PatchType patchType) { delegate.apply(patchId, patchType); applyPatchId = patchId; }