public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
final TempTarget tempTargetObject = OpenGammaCompilationContext.getTempTargets(context).get(inputs.keySet().iterator().next().getTargetSpecification().getUniqueId());
if (tempTargetObject instanceof HistoricalViewEvaluationTarget) {
final HistoricalViewEvaluationTarget historicalTarget = (HistoricalViewEvaluationTarget) tempTargetObject;
final ViewCalculationConfiguration calcConfig = historicalTarget.getViewDefinition().getCalculationConfiguration(context.getViewCalculationConfiguration().getName());
final ExternalIdBundle targetEids;
if (target.getValue() instanceof ExternalIdentifiable) {
targetEids = ((ExternalIdentifiable) target.getValue()).getExternalId().toBundle();
} else if (target.getValue() instanceof ExternalBundleIdentifiable) {
targetEids = ((ExternalBundleIdentifiable) target.getValue()).getExternalIdBundle();
} else {
targetEids = null;
}
final ComputationTargetSpecification targetSpec = target.toSpecification();
final ComputationTargetReference targetContextSpec = target.getContextSpecification();
final ComputationTargetReferenceVisitor<Set<String>> getTargetType = new ComputationTargetReferenceVisitor<Set<String>>() {
@Override
public Set<String> visitComputationTargetRequirement(final ComputationTargetRequirement requirement) {
if (target.getUniqueId() == null) {
if (requirement.getIdentifiers().isEmpty()) {
if (ObjectUtils.equals(requirement.getParent(), targetContextSpec)) {
// Null target can be referenced by anything
return ImmutableSet.of(TARGET_SPECIFICATION_OBJECT, TARGET_SPECIFICATION_UNIQUE, TARGET_SPECIFICATION_EXTERNAL);
}
}
} else {
if ((targetEids != null) && targetEids.equals(requirement.getIdentifiers())) {
if (ObjectUtils.equals(requirement.getParent(), targetContextSpec)) {
// Our target
return Collections.singleton(TARGET_SPECIFICATION_EXTERNAL);
}
}