Class ObjectHintService

java.lang.Object
io.meeds.social.hint.service.ObjectHintService

@Service public class ObjectHintService extends Object
Collects the hints the ObjectHintPlugin contributors give about one object, once, for every host: a host calls getHints(String, String, Identity, Locale) and adds the lines it returns beside the object. Without a contributor for the object's type, it answers an empty list and the host shows the object as before.
Since:
8.0
  • Field Details

    • MAX_HINTS

      public static final int MAX_HINTS
      The number of hint lines an object keeps, all contributors merged.
      See Also:
    • MAX_HINT_LENGTH

      public static final int MAX_HINT_LENGTH
      The length a hint line is cut at.
      See Also:
  • Constructor Details

    • ObjectHintService

      public ObjectHintService()
  • Method Details

    • getHints

      public List<String> getHints(String objectType, String objectId, org.exoplatform.services.security.Identity viewer, Locale locale)
      Asks every contributor of an object type once for its hints about one object, for one viewer.

      The contributors are looked up by type at each call, kept when their ObjectHintPlugin.getObjectType() is the given type, and called in the order of their implementation's fully qualified class name, as io.meeds.social.search.service.SearchMatchService does. Each line is stripped, kept once, cut at 300 characters, and at most 5 lines are kept; a blank line is dropped. A contributor that throws is logged and skipped.

      Parameters:
      objectType - the object's type, as the host names it
      objectId - the object's id
      viewer - the identity of the user the object is shown to
      locale - the viewer's locale
      Returns:
      the hint lines, empty when there is none, never null