@@ -0,0 +1,3805 @@
+/**%0A * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies%0A *%0A * Please see distribution for license.%0A */%0Apackage com.opengamma.financial.target;%0A%0Aimport java.util.Collections;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aimport com.google.common.collect.ImmutableSet;%0Aimport com.opengamma.engine.ComputationTarget;%0Aimport com.opengamma.engine.function.AbstractFunction;%0Aimport com.opengamma.engine.function.FunctionCompilationContext;%0Aimport com.opengamma.engine.function.FunctionExecutionContext;%0Aimport com.opengamma.engine.function.FunctionInputs;%0Aimport com.opengamma.engine.target.ComputationTargetType;%0Aimport com.opengamma.engine.value.ComputedValue;%0Aimport com.opengamma.engine.value.ValueProperties;%0Aimport com.opengamma.engine.value.ValuePropertyNames;%0Aimport com.opengamma.engine.value.ValueRequirement;%0Aimport com.opengamma.engine.value.ValueRequirementNames;%0Aimport com.opengamma.engine.value.ValueSpecification;%0Aimport com.opengamma.financial.temptarget.ConfigItemTarget;%0A%0A/**%0A * Function that returns the target object (UniqueIdentifiable).%0A */%0Apublic class TargetReturningFunction extends AbstractFunction.NonCompiledInvoker %7B%0A%0A  // REVIEW 2013-03-06 Andrew -- Candidate to move into OG-Engine as %22TargetSourcingFunction%22%0A%0A  /**%0A   *%0A   */%0A  public TargetReturningFunction() %7B%0A  %7D%0A%0A  @Override%0A  public Set%3CComputedValue%3E execute(FunctionExecutionContext executionContext, FunctionInputs inputs, ComputationTarget target, Set%3CValueRequirement%3E desiredValues) %7B%0A    //final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.YIELD_CURVE, target.toSpecification(), properties);%0A    ValueProperties outputProperties = createValueProperties().get();%0A    ValueSpecification spec = new ValueSpecification(ValueRequirementNames.TARGET, target.toSpecification(), outputProperties);%0A    //return new ValueSpecification(_newValueName, inputSpec.getTargetSpecification(), outputProperties);%0A    return ImmutableSet.of(new ComputedValue(spec, target.getValue()));%0A  %7D%0A%0A  @Override%0A  public ComputationTargetType getTargetType() %7B%0A    return ConfigItemTarget.TYPE; // anything really but kept short as only used in 1 case so far - expand as and when needed%0A  %7D%0A%0A  @Override%0A  public boolean canApplyTo(FunctionCompilationContext context, ComputationTarget target) %7B%0A    return true;%0A  %7D%0A%0A  @Override%0A  public Set%3CValueSpecification%3E getResults(FunctionCompilationContext context, ComputationTarget target) %7B%0A    return ImmutableSet.of(new ValueSpecification(ValueRequirementNames.TARGET, target.toSpecification(), ValueProperties.all()));%0A  %7D%0A%0A  @Override%0A  public Set%3CValueRequirement%3E getRequirements(FunctionCompilationContext context, ComputationTarget target, ValueRequirement desiredValue) %7B%0A    return Collections.EMPTY_SET;%0A  %7D%0A%0A  @Override%0A  public Set%3CValueSpecification%3E getResults(FunctionCompilationContext context, ComputationTarget target, Map%3CValueSpecification, ValueRequirement%3E inputs) %7B%0A    if (!inputs.isEmpty()) %7B // doesn't take any inputs%0A      return null;%0A    %7D%0A    ValueProperties outputProperties = createValueProperties().get();%0A    ValueSpecification spec = new ValueSpecification(ValueRequirementNames.TARGET, target.toSpecification(), outputProperties);%0A    return ImmutableSet.of(spec);%0A    //ValueSpecification inputSpec = Iterables.getOnlyElement(inputs.keySet());%0A    //return ImmutableSet.of(getOutputSpec(inputSpec));%0A  %7D%0A%0A  protected ValueSpecification getOutputSpec(ValueSpecification inputSpec) %7B%0A    ValueProperties outputProperties = inputSpec.getProperties().copy()%0A        .withoutAny(ValuePropertyNames.FUNCTION)%0A        .with(ValuePropertyNames.FUNCTION, getUniqueId()).get();%0A    return new ValueSpecification(ValueRequirementNames.TARGET, inputSpec.getTargetSpecification(), outputProperties);%0A  %7D%0A%0A%7D

Revert commit