1 16 package org.springframework.webflow.engine.support; 17 18 import java.io.Serializable ; 19 20 import org.springframework.binding.mapping.AttributeMapper; 21 import org.springframework.binding.mapping.MappingContext; 22 import org.springframework.webflow.core.collection.AttributeMap; 23 import org.springframework.webflow.core.collection.LocalAttributeMap; 24 import org.springframework.webflow.core.collection.MutableAttributeMap; 25 import org.springframework.webflow.engine.FlowAttributeMapper; 26 import org.springframework.webflow.execution.RequestContext; 27 28 36 public abstract class AbstractFlowAttributeMapper implements FlowAttributeMapper, Serializable { 37 38 44 protected abstract AttributeMapper getInputMapper(); 45 46 52 protected abstract AttributeMapper getOutputMapper(); 53 54 public MutableAttributeMap createFlowInput(RequestContext context) { 55 if (getInputMapper() != null) { 56 LocalAttributeMap input = new LocalAttributeMap(); 57 getInputMapper().map(context, input, getMappingContext(context)); 59 return input; 60 } 61 else { 62 return new LocalAttributeMap(); 64 } 65 } 66 67 public void mapFlowOutput(AttributeMap subflowOutput, RequestContext context) { 68 if (getOutputMapper() != null && subflowOutput != null) { 69 getOutputMapper().map(subflowOutput, context, getMappingContext(context)); 71 } 72 } 73 74 78 protected MappingContext getMappingContext(RequestContext context) { 79 return null; 80 } 81 } | Popular Tags |