1 16 package nl.hippo.cms.workflows.multiplesitessite; 17 18 import com.opensymphony.module.propertyset.PropertySet; 19 import com.opensymphony.workflow.WorkflowException; 20 import java.io.IOException ; 21 import java.util.Map ; 22 import nl.hippo.cms.repositorylocation.CommonRepositoryLocationRoles; 23 import nl.hippo.cms.repositorylocation.RepositoryLocation; 24 import org.apache.avalon.framework.service.ServiceException; 25 import org.apache.commons.httpclient.HttpState; 26 27 public class StoreDraftVersionFunction extends VersioningHelperComponent 28 { 29 30 public StoreDraftVersionFunction() 31 { 32 super(); 33 } 34 35 public void executeImpl(Map transientVars, Map args, PropertySet ps) throws WorkflowException 36 { 37 try 38 { 39 RepositoryLocation editorRepo = (RepositoryLocation) m_manager 40 .lookup(CommonRepositoryLocationRoles.EDITOR_REPOSITORY_LOCATION_ROLE); 41 try 42 { 43 String relativeLocation = ps.getString("location"); 44 String location = editorRepo.getRepositoryInformation().getAbsoluteUri( 45 relativeLocation); 46 HttpState httpState = (HttpState) transientVars.get("httpstate"); 47 48 int version = getCurrentVersion(location, httpState); 49 50 ps.setInt("publishedVersion", version); 51 } 52 finally 53 { 54 m_manager.release(editorRepo); 55 } 56 } 57 catch (IOException e) 58 { 59 throw new WorkflowException(e); 60 } 61 catch (ServiceException e) 62 { 63 throw new WorkflowException(e); 64 } 65 } 66 67 } 68 | Popular Tags |