for (final String name : outputsByName.keySet()) {
StreamI<FunctionOutput> functionOutputs = outputsByName.get(name);
for (FunctionOutput functionOutput : functionOutputs) {
TargetSpecificationReference tsr = functionOutput.getTargetSpecificationReference();
ComputationTargetSpecification cts = functionOutput.getComputationTargetSpecification();
final RecordingValueProperties rvps = functionOutput.getRecordingValueProperties();
ValueProperties vps = functionOutput.getValueProperties();
if (tsr == null && cts == null) {
throw new IllegalArgumentException("Target specification must be provided by function DSL, but there wasn't any for input: " + name);
}
if (rvps == null && vps == null) {
throw new IllegalArgumentException("Value properties must be provided by function DSL, but there wasn't any for input: " + name);
}
final ComputationTargetSpecification computationTargetSpecification;
if (cts != null) {
computationTargetSpecification = cts;
} else {
computationTargetSpecification = target.toSpecification();
}
ValueProperties valueProperties;
if (vps != null) {
valueProperties = vps;
} else {
//FunctionInput copyFrom = inputsByName.get(rvps.getCopiedFrom()).first();
//Find the apropierate valueSpecifications
ValueSpecification copyFrom = functional(inputSpecificationsMap.keySet()).filter(new Function1<ValueSpecification, Boolean>() {
@Override
public Boolean execute(ValueSpecification valueSpecification) {
return valueSpecification.getValueName().equals(rvps.getCopiedFrom());
//&& valueSpecification.getTargetSpecification().equals(computationTargetSpecification) && valueSpecification.getProperties().isSatisfiedBy()
}
}).first();
ValueProperties.Builder builder;
if (copyFrom != null) {
builder = copyFrom.getProperties().copy();
} else {
builder = ValueProperties.all().copy();
}
StreamI<ValuePropertiesModifier> recorderValueProperties = rvps.getRecordedValueProperties();
ValueProperties.Builder valuePropertiesBuilder = recorderValueProperties.reduce(builder, new Function2<ValueProperties.Builder, ValuePropertiesModifier, ValueProperties.Builder>() {
@Override
public ValueProperties.Builder execute(ValueProperties.Builder builder, ValuePropertiesModifier modifier) {
return modifier.modify(builder);
}