Class AiSearchHitWriter

java.lang.Object
fr.becpg.repo.web.scripts.remote.ai.AiSearchHitWriter

class AiSearchHitWriter extends Object
Writes one compact hit of the AI search (/becpg/remote/ai/search): node reference, type, name, code and the projected fields. The code and the projected fields go through the field read check, so a field a security rule hides from the user is left out, as in the remote export (#37820). The name stays: it identifies the node, like in the remote export.
Author:
matthieu
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final BiPredicate<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName>
     
    private static final String
     
    private static final String
     
    private static final String
     
    private final org.alfresco.service.namespace.NamespacePrefixResolver
     
    private static final String
     
    private final Set<org.alfresco.service.namespace.QName>
     
    private static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AiSearchHitWriter(org.alfresco.service.namespace.NamespacePrefixResolver namespaceResolver, Set<org.alfresco.service.namespace.QName> projectedFields, BiPredicate<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName> canReadField)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    putIfPresent(org.json.JSONObject hit, String key, Serializable value)
     
    private org.json.JSONObject
    readableFields(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> properties)
     
    (package private) org.json.JSONObject
    write(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName type, Map<org.alfresco.service.namespace.QName,Serializable> properties)
    Builds the hit of a node.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AiSearchHitWriter

      AiSearchHitWriter(org.alfresco.service.namespace.NamespacePrefixResolver namespaceResolver, Set<org.alfresco.service.namespace.QName> projectedFields, BiPredicate<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName> canReadField)
      Parameters:
      namespaceResolver - resolves the prefixes written in the hit
      projectedFields - the fields asked for by the caller, may be empty
      canReadField - whether the user may read a field of a node
  • Method Details

    • write

      org.json.JSONObject write(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName type, Map<org.alfresco.service.namespace.QName,Serializable> properties)
      Builds the hit of a node.
      Parameters:
      nodeRef - the node found
      type - the type of the node
      properties - the properties of the node
      Returns:
      the hit
    • readableFields

      private org.json.JSONObject readableFields(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> properties)
    • putIfPresent

      private static void putIfPresent(org.json.JSONObject hit, String key, Serializable value)