@Override public String extendSearch( SecuritySearchRequest request, DbMapSqlParameterSource args, String select, String where) { if (request instanceof BondSecuritySearchRequest) { BondSecuritySearchRequest bondRequest = (BondSecuritySearchRequest) request; if (bondRequest.getIssuerName() != null || bondRequest.getIssuerType() != null) { select += "LEFT JOIN sec_bond ON (sec_bond.security_id = sec_security.id) "; } if (bondRequest.getIssuerName() != null) { args.addValue( "bond_issuer_name", getDialect().sqlWildcardAdjustValue(bondRequest.getIssuerName())); where += getDialect() .sqlWildcardQuery( "AND UPPER(issuername) ", "UPPER(:bond_issuer_name)", bondRequest.getIssuerName()); } if (bondRequest.getIssuerType() != null) { args.addValue( "bond_issuer_type", getDialect().sqlWildcardAdjustValue(bondRequest.getIssuerName())); where += getDialect() .sqlWildcardQuery( "AND UPPER(issuertype) ", "UPPER(:bond_issuer_type)", bondRequest.getIssuerName()); } } return select + where; }
// ------------------------------------------------------------------------- public MarketDataSnapshotSearchResult search(final MarketDataSnapshotSearchRequest request) { ArgumentChecker.notNull(request, "request"); ArgumentChecker.notNull(request.getPagingRequest(), "request.pagingRequest"); ArgumentChecker.notNull(request.getVersionCorrection(), "request.versionCorrection"); s_logger.debug("search {}", request); final MarketDataSnapshotSearchResult result = new MarketDataSnapshotSearchResult(); final VersionCorrection vc = request.getVersionCorrection().withLatestFixed(now()); final DbMapSqlParameterSource args = new DbMapSqlParameterSource(); args.addTimestamp("version_as_of_instant", vc.getVersionAsOf()); args.addTimestamp("corrected_to_instant", vc.getCorrectedTo()); args.addValueNullIgnored("name", getDialect().sqlWildcardAdjustValue(request.getName())); args.addValue("details", request.isIncludeData()); args.addValue("paging_offset", request.getPagingRequest().getFirstItem()); args.addValue("paging_fetch", request.getPagingRequest().getPagingSize()); String[] sql = { getElSqlBundle().getSql("Search", args), getElSqlBundle().getSql("SearchCount", args) }; searchWithPaging( request.getPagingRequest(), sql, args, new MarketDataSnapshotDocumentExtractor(request.isIncludeData()), result); return result; }
@Override protected DbMapSqlParameterSource argsHistory(AbstractHistoryRequest request) { DbMapSqlParameterSource args = super.argsHistory(request); args.addValue("details", ((MarketDataSnapshotHistoryRequest) request).isIncludeData()); return args; }