private void addStep(Trigger<StereoTypes> interactionUnit)
{
InteractionCoordinator coordinator = context.get(ContextKey.COORDINATOR);
final StatementContext delegate = coordinator.getDialogState().getContext(interactionUnit.getId());
assert delegate != null : "StatementContext not provided";
assert interactionUnit.doesProduce();
Resource<ResourceType> output = interactionUnit.getOutputs().iterator().next();
// skip unqualified trigger that don't point to a resource operation
if(!output.getId().equalsIgnoreSuffix(RESOURCE_OP))
return;
String operationName = output.getId().getSuffix();
if(operationName==null)
throw new IllegalArgumentException("Illegal operation name mapping: "+ output.getId()+ " (suffix required)");
DMRMapping mapping = interactionUnit.findMapping(DMR);
String address = mapping.getResolvedAddress();
if (!resolvedOperations.contains(output.getId()))
{
AddressMapping addressMapping = AddressMapping.fromString(address);
ModelNode op = addressMapping.asResource(new DelegatingStatementContext()
{
@Override
public String resolve(String key)
{
// fallback strategy for values that are created at runtime, i.e. datasource={selected.entity}
String resolved = delegate.resolve(key);
if (null == resolved) { resolved = "*"; }
return resolved;
}
@Override
public String[] resolveTuple(String key)
{
return delegate.resolveTuple(key);
}
@Override
public LinkedList<String> collect(String key) {
LinkedList<String> items = new LinkedList<String>();
items.add("*");
return items;
}
@Override
public LinkedList<String[]> collectTuples(String key) {
return delegate.collectTuples(key);
}
});
op.get(OP).set(READ_OPERATION_DESCRIPTION_OPERATION);
op.get(NAME).set(operationName);