1 package nl.hippo.cms.workflows.multiplesitesdocument; 2 3 import com.opensymphony.module.propertyset.PropertySet; 4 import com.opensymphony.workflow.WorkflowException; 5 import java.util.Map ; 6 import nl.hippo.cms.repositorylocation.CommonRepositoryLocationRoles; 7 import nl.hippo.cms.repositorylocation.RepositoryLocation; 8 import nl.hippo.cms.workflows.shared.FunctionProviderComponent; 9 import org.apache.avalon.framework.service.ServiceException; 10 11 public class StoreLocationFunction extends FunctionProviderComponent { 12 13 public StoreLocationFunction() { 14 super(); 15 } 16 17 public void executeImpl(Map transientVars, Map args, PropertySet ps) 18 throws WorkflowException { 19 try 20 { 21 RepositoryLocation editorRepo = (RepositoryLocation) m_manager 22 .lookup(CommonRepositoryLocationRoles.EDITOR_REPOSITORY_LOCATION_ROLE); 23 try 24 { 25 String location = (String ) transientVars.get("location"); 26 if (location.startsWith("webdav")) 27 { 28 location = "http" + location.substring(6); 29 } 30 31 String baseUri = editorRepo.getRepositoryInformation().getAbsoluteBaseUri(); 32 if (location.startsWith(baseUri)) 33 { 34 location = location.substring(baseUri.length()); 35 } 36 ps.setString("location", location); 37 } 38 finally 39 { 40 m_manager.release(editorRepo); 41 } 42 } 43 catch (ServiceException e) 44 { 45 throw new WorkflowException(e); 46 } 47 } 48 49 } 50 | Popular Tags |