use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class WorkflowServiceImpl method updateConfiguration.
protected WorkflowInstance updateConfiguration(WorkflowInstance instance, Map<String, String> properties) {
try {
if (properties != null) {
for (Entry<String, String> entry : properties.entrySet()) {
instance.setConfiguration(entry.getKey(), entry.getValue());
}
}
Map<String, String> wfProperties = new HashMap<String, String>();
for (String key : instance.getConfigurationKeys()) {
wfProperties.put(key, instance.getConfiguration(key));
}
String xml = replaceVariables(WorkflowParser.toXml(instance), wfProperties);
WorkflowInstanceImpl workflow = WorkflowParser.parseWorkflowInstance(xml);
return workflow;
} catch (Exception e) {
throw new IllegalStateException("Unable to replace workflow instance variables", e);
}
}
use of org.opencastproject.workflow.api.WorkflowInstanceImpl in project opencast by opencast.
the class WorkflowConfigurationTest method testConfigurationSerialization.
@Test
public void testConfigurationSerialization() throws Exception {
WorkflowOperationInstanceImpl op = new WorkflowOperationInstanceImpl("op", OperationState.RUNNING);
Set<WorkflowConfiguration> config = new HashSet<WorkflowConfiguration>();
config.add(new WorkflowConfigurationImpl("this", "that"));
op.setConfiguration(config);
WorkflowInstanceImpl instance = new WorkflowInstanceImpl();
List<WorkflowOperationInstance> ops = new ArrayList<WorkflowOperationInstance>();
ops.add(op);
instance.setOperations(ops);
String xml = WorkflowParser.toXml(instance);
Assert.assertTrue(xml.contains("configuration key=\"this\">that</"));
}
Aggregations