1 25 26 package org.snipsnap.versioning; 27 28 import org.snipsnap.snip.Snip; 29 30 import java.util.List ; 31 32 38 39 public class DefaultVersionManager implements VersionManager { 40 private VersionStorage storage; 41 private DifferenceService service; 42 43 public DefaultVersionManager(VersionStorage storage, DifferenceService service) { 44 this.storage = storage; 45 this.service = service; 46 } 47 48 public void storeVersion(Snip snip) { 49 storage.storeVersion(snip); 51 }; 52 53 public Snip loadVersion(Snip snip, int version) { 54 return storage.loadVersion(snip, version); 55 }; 56 57 public List diff(Snip snip, int version1, int version2) { 58 return service.diff(loadVersion(snip, version1).getContent(), loadVersion(snip, version2).getContent()); 61 } 62 63 public List getHistory(Snip snip) { 64 return storage.getVersionHistory(snip); 65 } 66 } 67 | Popular Tags |