ilgrosso commented on code in PR #972: URL: https://github.com/apache/syncope/pull/972#discussion_r1937318761
########## client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java: ########## @@ -927,29 +967,29 @@ private void renderSearchValueField( "value", new PropertyModel(searchClause, "value") { - private static final long serialVersionUID = 1177692285167186690L; - - @Override - public Object getObject() { - String date = (String) super.getObject(); - try { - return date != null ? fdf.parse(date) : null; - } catch (ParseException ex) { - LOG.error("Date parse error {}", date, ex); - } - return null; - } - - @Override - public void setObject(final Object object) { - if (object instanceof Date) { - String valueDate = fdf.format(object); - super.setObject(valueDate); - } else { - super.setObject(object); - } - } - }, DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT); + private static final long serialVersionUID = 1177692285167186690L; Review Comment: Please avoid this formatting-only change ########## client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java: ########## @@ -278,46 +280,58 @@ protected List<Comparator> load() { private static final long serialVersionUID = 5275935387613157437L; @Override - protected List<String> load() { + protected List<Pair<String, String>> load() { if (field.getModel().getObject() == null || field.getModel().getObject().getType() == null) { return List.of(); } switch (field.getModel().getObject().getType()) { case ATTRIBUTE: - List<String> names = new ArrayList<>(dnames.getObject().keySet()); + List<Pair<String, String>> names = dnames.getObject().entrySet().stream() + .map(item -> Pair.of(item.getKey(), StringUtils.isNotBlank( + item.getValue().getLabel(SyncopeConsoleSession.get().getLocale())) + ? item.getValue().getLabel(SyncopeConsoleSession.get().getLocale()) + : item.getKey())).collect(Collectors.toList()); if (anames != null && anames.getObject() != null && !anames.getObject().isEmpty()) { - names.addAll(anames.getObject().keySet()); + names.addAll(anames.getObject().entrySet().stream().map(item -> Pair.of(item.getKey(), + StringUtils.isNotBlank( + item.getValue().getLabel(SyncopeConsoleSession.get().getLocale())) + ? item.getValue().getLabel(SyncopeConsoleSession.get().getLocale()) + : item.getKey())).collect(Collectors.toList())); } - return names.stream().sorted().collect(Collectors.toList()); + return names.stream(). + sorted(java.util.Comparator.comparing( + entry -> entry.getValue().toLowerCase())).collect(Collectors.toList()); case GROUP_MEMBERSHIP: - return groupInfo.getLeft().getObject(); + return groupInfo.getLeft().getObject().stream().map(item -> Pair.of(item, item)) + .collect(Collectors.toList()); case ROLE_MEMBERSHIP: - return Optional.ofNullable(roleNames). - map(r -> r.getObject().stream().sorted().collect(Collectors.toList())). - orElse(List.of()); + return Optional.ofNullable(roleNames) + .map(r -> r.getObject().stream().sorted().map(item -> Pair.of(item, item)) + .collect(Collectors.toList())).orElse(List.of()); case PRIVILEGE: - return Optional.ofNullable(privilegeNames). - map(p -> p.getObject().stream().sorted().collect(Collectors.toList())). - orElse(List.of()); + return Optional.ofNullable(privilegeNames) + .map(p -> p.getObject().stream().sorted().map(item -> Pair.of(item, item)) + .collect(Collectors.toList())).orElse(List.of()); case AUX_CLASS: - return auxClassNames.getObject().stream(). - sorted().collect(Collectors.toList()); + return auxClassNames.getObject().stream().sorted().map(item -> Pair.of(item, item)) Review Comment: same for other occurrences in this class ########## client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTextFieldPanel.java: ########## @@ -104,6 +113,10 @@ public void setChoices(final List<String> choices) { this.choices = choices; } } + + protected IConverter<String> getConverter() { + return null; Review Comment: maybe ```java protected Optional<IConverter<String>> getConverter() { return Optional.empty(); } ``` ? ########## client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java: ########## @@ -278,46 +280,58 @@ protected List<Comparator> load() { private static final long serialVersionUID = 5275935387613157437L; @Override - protected List<String> load() { + protected List<Pair<String, String>> load() { if (field.getModel().getObject() == null || field.getModel().getObject().getType() == null) { return List.of(); } switch (field.getModel().getObject().getType()) { case ATTRIBUTE: - List<String> names = new ArrayList<>(dnames.getObject().keySet()); + List<Pair<String, String>> names = dnames.getObject().entrySet().stream() + .map(item -> Pair.of(item.getKey(), StringUtils.isNotBlank( + item.getValue().getLabel(SyncopeConsoleSession.get().getLocale())) + ? item.getValue().getLabel(SyncopeConsoleSession.get().getLocale()) + : item.getKey())).collect(Collectors.toList()); if (anames != null && anames.getObject() != null && !anames.getObject().isEmpty()) { - names.addAll(anames.getObject().keySet()); + names.addAll(anames.getObject().entrySet().stream().map(item -> Pair.of(item.getKey(), + StringUtils.isNotBlank( + item.getValue().getLabel(SyncopeConsoleSession.get().getLocale())) + ? item.getValue().getLabel(SyncopeConsoleSession.get().getLocale()) + : item.getKey())).collect(Collectors.toList())); } - return names.stream().sorted().collect(Collectors.toList()); + return names.stream(). + sorted(java.util.Comparator.comparing( + entry -> entry.getValue().toLowerCase())).collect(Collectors.toList()); case GROUP_MEMBERSHIP: - return groupInfo.getLeft().getObject(); + return groupInfo.getLeft().getObject().stream().map(item -> Pair.of(item, item)) + .collect(Collectors.toList()); case ROLE_MEMBERSHIP: - return Optional.ofNullable(roleNames). - map(r -> r.getObject().stream().sorted().collect(Collectors.toList())). - orElse(List.of()); + return Optional.ofNullable(roleNames) + .map(r -> r.getObject().stream().sorted().map(item -> Pair.of(item, item)) + .collect(Collectors.toList())).orElse(List.of()); case PRIVILEGE: - return Optional.ofNullable(privilegeNames). - map(p -> p.getObject().stream().sorted().collect(Collectors.toList())). - orElse(List.of()); + return Optional.ofNullable(privilegeNames) + .map(p -> p.getObject().stream().sorted().map(item -> Pair.of(item, item)) + .collect(Collectors.toList())).orElse(List.of()); case AUX_CLASS: - return auxClassNames.getObject().stream(). - sorted().collect(Collectors.toList()); + return auxClassNames.getObject().stream().sorted().map(item -> Pair.of(item, item)) Review Comment: `sorted()` shall be moved down the pipeline, e.g. ```java auxClassNames.getObject().stream(). map(item -> Pair.of(item, item)). sorted(Comparator.comparing(Pair::getKey)).collect(Collectors.toList()); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org