Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30941

Expose a property to display the group id in the suggestion entries

    XMLWordPrintable

    Details

      Description

      As it's done for users with the property "displayEmailInUserSuggestion" to display the email alongside with the first name and last name is the suggestion results, it would be nice to have a property to display the group id which would help to distinguish 2 groups with the same label.

      Code suggestion

      diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/features/SuggestConstants.java b/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/features/SuggestConstants.java
      index ec4cc05b674..f18ead245f8 100644
      --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/features/SuggestConstants.java
      +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/features/SuggestConstants.java
      @@ -39,6 +39,8 @@ public class SuggestConstants {
       
           private static final String FORCE_DISPLAY_EMAIL_IN_SUGGESTION = "nuxeo.ui.displayEmailInUserSuggestion";
       
      +    private static final String FORCE_DISPLAY_GROUP_ID_IN_SUGGESTION = "nuxeo.ui.displayIdInGroupSuggestion";
      +
           public static final String ID = "id";
       
           public static final String LABEL = "displayLabel";
      @@ -57,6 +59,8 @@ public class SuggestConstants {
       
           protected static Boolean forceDisplayEmailInSuggestion = null;
       
      +    protected static Boolean forceDisplayGroupIdInSuggestion = null;
      +
           public static final String DISPLAY_ICON = "displayIcon";
       
           public static final String PARENT_FIELD_ID = "parent";
      @@ -84,6 +88,9 @@ public class SuggestConstants {
                   String groupLabelValue = (String) obj.get(groupLabelField);
                   if (StringUtils.isNotBlank(groupLabelValue)) {
                       label = groupLabelValue;
      +                if (isForceDisplayGroupIdInSuggestion()) {
      +                    label += "(" + groupId + ")";
      +                }
                   } else {
                       label = groupId;
                   }
      @@ -256,6 +263,14 @@ public class SuggestConstants {
               return forceDisplayEmailInSuggestion;
           }
       
      +    protected static boolean isForceDisplayGroupIdInSuggestion() {
      +        if (forceDisplayGroupIdInSuggestion == null) {
      +            ConfigurationService cs = Framework.getService(ConfigurationService.class);
      +            forceDisplayGroupIdInSuggestion = cs.isBooleanTrue(FORCE_DISPLAY_GROUP_ID_IN_SUGGESTION);
      +        }
      +        return forceDisplayGroupIdInSuggestion;
      +    }
      +
           // no instantiation
           protected SuggestConstants() {
           }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tmartins Thierry Martins
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: