Skip to content

Commit

Permalink
Fix: for filterOnlyIds, empty still needs to mean "no restriction"
Browse files Browse the repository at this point in the history
557: Picking Window: Open HU Selection window filtering 
Task-Url: #557
  • Loading branch information
metas-ts committed Aug 31, 2017
1 parent b3c9b2c commit d921e1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,16 @@ public HUEditorView createView(final CreateViewRequest request)
*/
private static List<DocumentFilter> extractStickyFilters(
@NonNull final List<DocumentFilter> requestStickyFilters,
@Nullable final Set<Integer> huIds)
@Nullable final Set<Integer> filterOnlyIds)
{
final List<DocumentFilter> stickyFilters = new ArrayList<>(requestStickyFilters);

final DocumentFilter stickyFilter_HUIds_Existing = HUIdsFilterHelper.findExistingOrNull(stickyFilters);

// Create the sticky filter by HUIds from builder's huIds (if any huIds)
if (stickyFilter_HUIds_Existing == null && huIds != null)
if (stickyFilter_HUIds_Existing == null && filterOnlyIds != null && !filterOnlyIds.isEmpty())
{
final DocumentFilter stickyFilter_HUIds_New = HUIdsFilterHelper.createFilter(huIds);
final DocumentFilter stickyFilter_HUIds_New = HUIdsFilterHelper.createFilter(filterOnlyIds);
stickyFilters.add(0, stickyFilter_HUIds_New);
}

Expand Down
9 changes: 8 additions & 1 deletion src/main/java/de/metas/ui/web/view/CreateViewRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public static final Builder deleteStickyFilterBuilder(
private final DocumentFiltersList filters;

/**
* This one is becoming king of legacy.... it's a particular kind of sticky filter which filters by given IDs.
* This one is becoming kind of legacy.... it's a particular kind of sticky filter which filters by given IDs.<br>
* <b>Important:</b> empty means "no restriction"
*
* @deprecated please rather use {@link #getFilters()} {@link #getStickyFilters()}.
*/
Expand Down Expand Up @@ -201,7 +202,13 @@ public static final class Builder
private DocumentId parentRowId;

private Set<DocumentPath> referencingDocumentPaths;

/**
* @deprecated see {@link CreateViewRequest#filterOnlyIds}
*/
@Deprecated
private Set<Integer> filterOnlyIds;

private List<DocumentFilter> stickyFilters;
private DocumentFiltersList filters;

Expand Down

0 comments on commit d921e1c

Please sign in to comment.