@Override
public List<ExternalId> visitSwaptionSecurity(final SwaptionSecurity security) {
final List<ExternalId> result = new ArrayList<>();
final SwapSecurity underlyingSwap = (SwapSecurity) _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId())); //TODO version
final SwapLeg payLeg = underlyingSwap.getPayLeg();
final SwapLeg receiveLeg = underlyingSwap.getReceiveLeg();
final String securityType = security.getSecurityType();
if (payLeg.getRegionId().equals(receiveLeg.getRegionId())) {
return Arrays.asList(ExternalId.of(SECURITY_IDENTIFIER, securityType + "_" + payLeg.getRegionId().getValue()));
}
result.add(ExternalId.of(SECURITY_IDENTIFIER, securityType + "_" + payLeg.getRegionId().getValue()));
result.add(ExternalId.of(SECURITY_IDENTIFIER, securityType + "_" + receiveLeg.getRegionId().getValue()));
return result;
}