Skip to content

Commit

Permalink
payment: trivial renaming in DefaultPaymentDao
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
  • Loading branch information
pierre committed Jan 24, 2017
1 parent 9c691d5 commit aff04b8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public Iterator<PaymentModelDao> build(final PaymentSqlDao paymentSqlDao, final
@Override
public Pagination<PaymentModelDao> searchPayments(final String searchKey, final Long offset, final Long limit, final InternalTenantContext context) {
// Optimization: if the search key looks like a state name (e.g. _ERRORED), assume the user is searching by state only
final List<String> paymentStates = shouldSearchByStateNameOnly(searchKey);
final List<String> paymentStates = expandSearchFilterToStateNames(searchKey);

final String likeSearchKey = String.format("%%%s%%", searchKey);
return paginationHelper.getPagination(PaymentSqlDao.class,
Expand All @@ -274,7 +274,7 @@ public Iterator<PaymentModelDao> build(final PaymentSqlDao paymentSqlDao, final
context);
}

private List<String> shouldSearchByStateNameOnly(final String searchKey) {
private List<String> expandSearchFilterToStateNames(final String searchKey) {
final Pattern pattern = Pattern.compile(".*" + searchKey + ".*");

// Note that technically, we should look at all of the available state names in the database instead since the state machine is configurable. The common use-case
Expand Down

1 comment on commit aff04b8

@sbrossie
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.