1 16 package org.apache.cocoon.components.flow; 17 18 import org.mozilla.javascript.Undefined; 19 import org.mozilla.javascript.Wrapper; 20 21 import java.util.Map ; 22 23 28 public class FlowHelper { 29 30 39 42 private static final String CONTEXT_OBJECT = "cocoon.flow.context"; 43 44 47 private static final String CONTINUATION_OBJECT = "cocoon.flow.continuation"; 48 49 55 public final static Object getContextObject(Map objectModel) { 56 return objectModel.get(CONTEXT_OBJECT); 57 } 58 59 65 public final static WebContinuation getWebContinuation(Map objectModel) { 66 return (WebContinuation)objectModel.get(CONTINUATION_OBJECT); 67 } 68 69 75 public final static void setWebContinuation(Map objectModel, 76 WebContinuation kont) { 77 objectModel.put(CONTINUATION_OBJECT, kont); 78 } 79 80 86 public final static void setContextObject(Map objectModel, Object obj) { 87 objectModel.put(CONTEXT_OBJECT, obj); 88 } 89 90 93 public static Object unwrap(Object obj) { 94 if (obj instanceof Wrapper) { 95 obj = ((Wrapper)obj).unwrap(); 96 } else if (obj == Undefined.instance) { 97 obj = null; 98 } 99 return obj; 100 } 101 } 102 | Popular Tags |