X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionParameterPostProcessor.java;h=a95670b10a3fc93ccf1f52f0bf9f381fdd49c6da;hb=743ecb28b3c0236bc91a5d0993f70477236d96fd;hp=d393d774f84c96de38737d93f6458e019fc64f96;hpb=51d1c842e4e92cc65708b8bb88152d7344d43d04;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionParameterPostProcessor.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionParameterPostProcessor.java index d393d774f..a95670b10 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionParameterPostProcessor.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionParameterPostProcessor.java @@ -28,48 +28,37 @@ public class ExecutionParameterPostProcessor extends public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException { - if (!ExecutionContext.isExecuting()) + if (!ExecutionContext.isExecuting()){ + //&& !DefaultExecutionSpec.isInFlowInitialization()) { + //log.info("Skip parameter conversion for bean " + beanName); return pvs; - -// ExecutionFlow currentFlow = ExecutionContext.getCurrentFlow(); -// -// Properties props = new Properties(); -// Map attributes = currentFlow.getAttributes(); -// Map specAttributes = currentFlow -// .getExecutionSpec().getAttributes(); -// -// for (String key : specAttributes.keySet()) { -// ExecutionSpecAttribute obj = specAttributes.get(key); -// if (!(obj instanceof RefSpecAttribute)) { -// if (!attributes.containsKey(key)) -// throw new SlcException("Specified attribute " + key -// + " is not set in " + currentFlow); -// -// props.setProperty(key, attributes.get(key).toString()); -// // if (log.isTraceEnabled()) -// // log.trace("Use attribute " + key); -// } -// } + } else { + //log.info("Execute parameter conversion for bean " + beanName); + } Properties props = new Properties(); CustomPpc ppc = new CustomPpc(props); for (PropertyValue pv : pvs.getPropertyValues()) { +// log.info(" PropertyValue pv " + pv.getValue() + " - " +// + pv.getValue().getClass()); + String originalValue = null; + String convertedValue = null; if (pv.getValue() instanceof TypedStringValue) { TypedStringValue tsv = (TypedStringValue) pv.getValue(); - String originalValue = tsv.getValue(); - String convertedValue = ppc.process(originalValue); + originalValue = tsv.getValue(); + convertedValue = ppc.process(originalValue); tsv.setValue(convertedValue); - if (log.isTraceEnabled()) { - if (!originalValue.equals(convertedValue)) - log.trace("Converted field '" + pv.getName() + "': '" - + originalValue + "' to '" + convertedValue - + "' in bean " + beanName); - } - } else { - // if (log.isTraceEnabled()) - // log.trace(beanName + "[" + pv.getName() + "]: " - // + pv.getValue().getClass()); + } else if (pv.getValue() instanceof String) { + originalValue = pv.getValue().toString(); + convertedValue = ppc.process(originalValue); + pv.setConvertedValue(convertedValue); + } + if (convertedValue != null && log.isTraceEnabled()) { + if (!originalValue.equals(convertedValue)) + log.trace("Converted field '" + pv.getName() + "': '" + + originalValue + "' to '" + convertedValue + + "' in bean " + beanName); } } @@ -107,10 +96,11 @@ public class ExecutionParameterPostProcessor extends @Override protected String resolvePlaceholder(String placeholder, Properties props) { + //log.info("Try convert placeholder " + placeholder); if (ExecutionContext.isExecuting()) return ExecutionContext.getVariable(placeholder).toString(); - else if (SimpleExecutionSpec.isInFlowInitialization()) - return SimpleExecutionSpec.getInitializingFlowParameter( + else if (DefaultExecutionSpec.isInFlowInitialization()) + return DefaultExecutionSpec.getInitializingFlowParameter( placeholder).toString(); else return super.resolvePlaceholder(placeholder, props);