| 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.HashSet ; 7 import java.util.Map ; 8 import java.util.Set ; 9 import nl.hippo.cms.Constants; 10 import nl.hippo.cms.workflows.shared.FunctionProviderComponent; 11 import nl.hippo.cocoon.webdav.Property; 12 import nl.hippo.cocoon.webdav.WebDAVHelper; 13 import org.apache.commons.httpclient.HttpState; 14 15 public class StoreDisapprovalReasonFunction extends FunctionProviderComponent 16 { 17 18 public StoreDisapprovalReasonFunction() 19 { 20 super(); 21 } 22 23 public void executeImpl(final Map transientVars, Map args, PropertySet ps) throws WorkflowException 24 { 25 try 26 { 27 String location = (String ) transientVars.get("location"); 28 HttpState httpState = (HttpState) transientVars.get("httpstate"); 29 Set propertiesToSet = new HashSet (); 30 Set propertiesToRemove = new HashSet (); 31 String reason = (String ) transientVars.get("reason"); 32 if (reason == null || reason.equals("")) 33 { 34 propertiesToRemove.add(new Property("H", Constants.CMS_1_0_NAMESPACE, Constants.DISAPPROVAL_REASON_PROPERTY_NAME)); 35 } 36 else 37 { 38 propertiesToSet.add(new Property("H", Constants.CMS_1_0_NAMESPACE, Constants.DISAPPROVAL_REASON_PROPERTY_NAME, reason)); 39 } 40 WebDAVHelper.proppatch(location, propertiesToSet, propertiesToRemove, httpState); 41 } 42 catch (IOException e) 43 { 44 throw new WorkflowException(e); 45 } 46 } 47 48 } | Popular Tags |