]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultDescriptorConverter.java
@update:81; Ability to copy the content of resources locally, thus enabling launchyin...
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / execution / DefaultDescriptorConverter.java
1 package org.argeo.slc.core.execution;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.argeo.slc.execution.ExecutionFlowDescriptor;
7 import org.argeo.slc.execution.ExecutionFlowDescriptorConverter;
8
9 public class DefaultDescriptorConverter implements
10 ExecutionFlowDescriptorConverter {
11
12 public Map<String, Object> convertValues(
13 ExecutionFlowDescriptor executionFlowDescriptor) {
14 // convert the values of flow.getFlowDescriptor()
15 Map<String, Object> values = executionFlowDescriptor.getValues();
16
17 Map<String, Object> convertedValues = new HashMap<String, Object>();
18
19 if (values != null) {
20 for (String key : values.keySet()) {
21 Object value = values.get(key);
22 if (value instanceof PrimitiveValue) {
23 PrimitiveValue primitiveValue = (PrimitiveValue) value;
24
25 // TODO: check that the class of the the
26 // primitiveValue.value
27 // matches
28 // the primitiveValue.type
29 convertedValues.put(key, primitiveValue.getValue());
30 } else if (value instanceof RefValue) {
31 RefValue refValue = (RefValue) value;
32 convertedValues.put(key, refValue.getLabel());
33 }
34 }
35 }
36 return convertedValues;
37 }
38
39 }