Class AiSearchHitWriter
java.lang.Object
fr.becpg.repo.web.scripts.remote.ai.AiSearchHitWriter
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
FieldsModifier and TypeFieldDescriptionprivate final BiPredicate<org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName> private static final Stringprivate static final Stringprivate static final Stringprivate final org.alfresco.service.namespace.NamespacePrefixResolverprivate static final Stringprivate final Set<org.alfresco.service.namespace.QName> private static final String -
Constructor Summary
ConstructorsConstructorDescriptionAiSearchHitWriter(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 TypeMethodDescriptionprivate static voidputIfPresent(org.json.JSONObject hit, String key, Serializable value) private org.json.JSONObjectreadableFields(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName, Serializable> properties) (package private) org.json.JSONObjectwrite(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.
-
Field Details
-
NODE_REF
- See Also:
-
TYPE
- See Also:
-
NAME
- See Also:
-
CODE
- See Also:
-
FIELDS
- See Also:
-
namespaceResolver
private final org.alfresco.service.namespace.NamespacePrefixResolver namespaceResolver -
projectedFields
-
canReadField
private final BiPredicate<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName> canReadField
-
-
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 hitprojectedFields- the fields asked for by the caller, may be emptycanReadField- 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 foundtype- the type of the nodeproperties- 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
-