+ // Validate execution specs
+ if (executionSpec == null)
+ return;
+
+ MapBindingResult errors = new MapBindingResult(parameters, "execution#"
+ + getUuid());
+ for (String key : executionSpec.getAttributes().keySet()) {
+ ExecutionSpecAttribute executionSpecAttr = executionSpec
+ .getAttributes().get(key);
+ if (!parameters.containsKey(key)) {
+ Object defaultValue = executionSpecAttr.getValue();
+ if (defaultValue == null)
+ errors.rejectValue(key, "Not set and no default value");
+ else
+ parameters.put(key, defaultValue);
+ } else {// contains key
+ Object obj = parameters.get(key);
+ if (executionSpecAttr instanceof RefSpecAttribute) {
+ RefSpecAttribute rsa = (RefSpecAttribute) executionSpecAttr;
+ Class targetClass = rsa.getTargetClass();
+ if (!targetClass.isAssignableFrom(obj.getClass())) {
+ errors.reject(key
+ + " not compatible with target class "
+ + targetClass);
+ }
+ }
+ }
+ }
+
+ if (errors.hasErrors())
+ throw new SlcException("Could not prepare execution flow: "
+ + errors.toString());
+ }