/** * Used by Smooks to retrieve the visitor configuration of this Value Configuration */ public void addVisitors(VisitorConfigMap visitorMap) { ValueBinder binder = new ValueBinder(getBeanId()); SmooksResourceConfiguration populatorConfig = new SmooksResourceConfiguration(dataSelector); SelectorPropertyResolver.resolveSelectorTokens(populatorConfig); binder.setDecoder(decoder); binder.setDefaultValue(defaultValue); binder.setValueAttributeName(populatorConfig.getStringParameter(BeanInstancePopulator.VALUE_ATTRIBUTE_NAME)); visitorMap.addVisitor(binder, populatorConfig.getSelector(), targetNamespace, true); }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(!isAttribute) { bindValue(DomUtils.getAllText(element, false), executionContext, new Fragment(element)); } }
private Object decodeDataString(String dataString, ExecutionContext executionContext) throws DataDecodeException { if((dataString == null || dataString.length() == 0) && defaultValue != null) { if(defaultValue.equals("null")) { return null; } dataString = defaultValue; } try { return getDecoder(executionContext).decode(dataString); } catch(DataDecodeException e) { throw new DataDecodeException("Failed to decode the value '" + dataString + "' for the bean id '" + beanIdName +"'.", e); } }
private void bindValue(String dataString, ExecutionContext executionContext, Fragment source) { Object valueObj = decodeDataString(dataString, executionContext); BeanContext beanContext = executionContext.getBeanContext(); if(valueObj == null) { beanContext.removeBean(beanId, source); } else { beanContext.addBean(beanId, valueObj, source); } }
private void bindValue(String dataString, ExecutionContext executionContext, Fragment source) { Object valueObj = decodeDataString(dataString, executionContext); BeanContext beanContext = executionContext.getBeanContext(); if(valueObj == null) { beanContext.removeBean(beanId, source); } else { beanContext.addBean(beanId, valueObj, source); } }
/** * Used by Smooks to retrieve the visitor configuration of this Value Configuration */ public void addVisitors(VisitorConfigMap visitorMap) { ValueBinder binder = new ValueBinder(getBeanId()); SmooksResourceConfiguration populatorConfig = new SmooksResourceConfiguration(dataSelector); SelectorPropertyResolver.resolveSelectorTokens(populatorConfig); binder.setDecoder(decoder); binder.setDefaultValue(defaultValue); binder.setValueAttributeName(populatorConfig.getStringParameter(BeanInstancePopulator.VALUE_ATTRIBUTE_NAME)); visitorMap.addVisitor(binder, populatorConfig.getSelector(), targetNamespace, true); }
public void visitAfter(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { if(!isAttribute) { bindValue(element.getTextContent(), executionContext, new Fragment(element)); } }
private void bindValue(String dataString, ExecutionContext executionContext, Fragment source) { Object valueObj = decodeDataString(dataString, executionContext); BeanContext beanContext = executionContext.getBeanContext(); if(valueObj == null) { beanContext.removeBean(beanId, source); } else { beanContext.addBean(beanId, valueObj, source); } }
private Object decodeDataString(String dataString, ExecutionContext executionContext) throws DataDecodeException { if((dataString == null || dataString.length() == 0) && defaultValue != null) { if(defaultValue.equals("null")) { return null; } dataString = defaultValue; } try { return getDecoder(executionContext).decode(dataString); } catch(DataDecodeException e) { throw new DataDecodeException("Failed to decode the value '" + dataString + "' for the bean id '" + beanIdName +"'.", e); } }
/** * Used by Smooks to retrieve the visitor configuration of this Value Configuration */ public void addVisitors(VisitorConfigMap visitorMap) { ValueBinder binder = new ValueBinder(getBeanId()); SmooksResourceConfiguration populatorConfig = new SmooksResourceConfiguration(dataSelector); SelectorPropertyResolver.resolveSelectorTokens(populatorConfig); binder.setDecoder(decoder); binder.setDefaultValue(defaultValue); binder.setValueAttributeName(populatorConfig.getStringParameter(BeanInstancePopulator.VALUE_ATTRIBUTE_NAME)); visitorMap.addVisitor(binder, populatorConfig.getSelector(), targetNamespace, true); }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(!isAttribute) { bindValue(DomUtils.getAllText(element, false), executionContext, new Fragment(element)); } }
private Object decodeDataString(String dataString, ExecutionContext executionContext) throws DataDecodeException { if((dataString == null || dataString.length() == 0) && defaultValue != null) { if(defaultValue.equals("null")) { return null; } dataString = defaultValue; } try { return getDecoder(executionContext).decode(dataString); } catch(DataDecodeException e) { throw new DataDecodeException("Failed to decode the value '" + dataString + "' for the bean id '" + beanIdName +"'.", e); } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { if(isAttribute) { bindValue(DomUtils.getAttributeValue(element, valueAttributeName), executionContext, new Fragment(element)); } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { if(isAttribute) { bindValue(DomUtils.getAttributeValue(element, valueAttributeName), executionContext, new Fragment(element)); } }
public void visitAfter(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { if(!isAttribute) { bindValue(element.getTextContent(), executionContext, new Fragment(element)); } }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(!isAttribute) { bindValue(DomUtils.getAllText(element, false), executionContext, new Fragment(element)); } }
public void visitAfter(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { if(!isAttribute) { bindValue(element.getTextContent(), executionContext, new Fragment(element)); } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { if(isAttribute) { bindValue(DomUtils.getAttributeValue(element, valueAttributeName), executionContext, new Fragment(element)); } }
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { if(isAttribute) { bindValue(SAXUtil.getAttribute(valueAttributeName, element.getAttributes()), executionContext, new Fragment(element)); } else { // Turn on Text Accumulation... element.accumulateText(); } }
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { if(isAttribute) { bindValue(SAXUtil.getAttribute(valueAttributeName, element.getAttributes()), executionContext, new Fragment(element)); } else { // Turn on Text Accumulation... element.accumulateText(); } }