1 25 26 package net.killingar.actions.wiki; 27 28 import com.portalwizard.silo.DocumentVersionPK; 29 import com.portalwizard.silo.Version; 30 31 public class Revert extends WikiAction 32 { 33 String context, dockey, version; 34 35 boolean confirmed = false; 36 37 public String getContext () { return context; } 38 public String getDockey () { return dockey; } 39 public String getVersion () { return version; } 40 41 public void setContext (String in) { context = in; } 42 public void setDockey (String in) { dockey = in; } 43 public void setVersion (String in) { version = in; } 44 45 public void setConfirmed(boolean in) { confirmed = in; } 46 47 protected String doExecute() throws Exception 48 { 49 if (confirmed) 50 { 51 DocumentVersionPK pk = new DocumentVersionPK(context, dockey, version); 52 Version ov = vm.get(pk); 53 54 if (vm.get(getContext(), getWiki()).getContent().equals(ov.getContent())) 55 { 56 addErrorMessage("document unaltered"); 57 return INPUT; 58 } 59 60 Version nv = new Version(getContext(), getWiki()); 61 nv.setTitle(getWiki()); 62 nv.setContent(ov.getContent()); 63 nv.setMimetype(ov.getMimetype()); 64 nv.setAuthor(ov.getAuthor()); 65 vm.store(nv); 66 67 return SUCCESS; 68 } 69 70 return INPUT; 71 } 72 } 73 | Popular Tags |