1 package nl.hippo.cms.workflows.reviewedactions; 2 3 import com.opensymphony.module.propertyset.PropertySet; 4 import com.opensymphony.workflow.WorkflowException; 5 import java.io.IOException ; 6 import java.util.Map ; 7 import nl.hippo.cms.Constants; 8 import nl.hippo.cms.workflows.shared.URIUtil; 9 import nl.hippo.cocoon.webdav.WebDAVHelper; 10 import org.apache.commons.httpclient.HttpState; 11 12 public class SaveDraftFunction extends VersionCreatingComponent 13 { 14 15 public SaveDraftFunction() 16 { 17 super(); 18 } 19 20 public void executeImpl(final Map transientVars, Map args, PropertySet ps) 21 throws WorkflowException 22 { 23 String action = "save draft"; 24 String comment = (String ) transientVars.get("versionComment"); 25 if (comment == null) 26 { 27 comment = ""; 28 } 29 String location = URIUtil.getHTTPURI((String ) transientVars.get("location")); 30 HttpState httpState = (HttpState) transientVars.get("httpstate"); 31 String user = ""; 32 try 33 { 34 user = WebDAVHelper.propfindAsString(location, Constants.CMS_1_0_NAMESPACE, 35 Constants.LAST_WORKFLOW_USER_PROPERTY_NAME, httpState); 36 } 37 catch (IOException e) 38 { 39 } 41 createVersion(transientVars, user, action, comment); 42 } 43 44 } | Popular Tags |