Class AiDictionaryWebScript
java.lang.Object
org.springframework.extensions.webscripts.AbstractWebScript
fr.becpg.repo.web.scripts.remote.ai.AiDictionaryWebScript
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
public class AiDictionaryWebScript
extends org.springframework.extensions.webscripts.AbstractWebScript
AI-shaped data dictionary (/becpg/remote/ai/dictionary).
Returns a flat, AI-friendly view of the per-tenant content model so becpg-ai can resolve field/type names from intent and validate them (anti-hallucination), including the tenant's custom fields. This is the server-driven replacement for the static field/type embeddings baked into the becpg-ai image.
?type=ns:type→ the type title plus itsfields(name, title, dataType, mandatory) andassociations(name, title, targetType).- no parameter → the list of entity
types(subtypes ofbcpg:entityV2).
- Author:
- matthieu
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.alfresco.service.cmr.dictionary.DictionaryServiceprivate EntityDictionaryServiceprivate org.alfresco.service.namespace.NamespaceService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Map<org.alfresco.service.namespace.QName, org.alfresco.service.cmr.dictionary.AssociationDefinition> allAssociations(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) private Map<org.alfresco.service.namespace.QName, org.alfresco.service.cmr.dictionary.PropertyDefinition> allProperties(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) The full default field set of a type: its own properties plus the properties of its default aspects (mirrors howJsonSchemaEntityVisitorbuilds an entity schema).private org.json.JSONArrayDistinct union of properties (type + default aspects) across all entity types (subtypes ofbcpg:entityV2), deduplicated by name — the lexical corpus for intent → field resolution.private org.json.JSONArraybuildAssociations(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) private org.json.JSONArraybuildFields(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) private org.json.JSONArrayvoidexecute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) private org.json.JSONObjectfieldEntry(org.alfresco.service.cmr.dictionary.PropertyDefinition prop, boolean withMandatory) voidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) Setter for the fielddictionaryService.voidsetEntityDictionaryService(EntityDictionaryService entityDictionaryService) Setter for the fieldentityDictionaryService.voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) Setter for the fieldnamespaceService.Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
-
Field Details
-
dictionaryService
private org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService -
entityDictionaryService
-
namespaceService
private org.alfresco.service.namespace.NamespaceService namespaceService
-
-
Constructor Details
-
AiDictionaryWebScript
public AiDictionaryWebScript()
-
-
Method Details
-
execute
public void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) throws IOException - Throws:
IOException
-
buildTypes
private org.json.JSONArray buildTypes() throws org.json.JSONException- Throws:
org.json.JSONException
-
allProperties
private Map<org.alfresco.service.namespace.QName,org.alfresco.service.cmr.dictionary.PropertyDefinition> allProperties(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) The full default field set of a type: its own properties plus the properties of its default aspects (mirrors howJsonSchemaEntityVisitorbuilds an entity schema). In-memory model lookups only. -
allAssociations
private Map<org.alfresco.service.namespace.QName,org.alfresco.service.cmr.dictionary.AssociationDefinition> allAssociations(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) -
buildAllFields
private org.json.JSONArray buildAllFields() throws org.json.JSONExceptionDistinct union of properties (type + default aspects) across all entity types (subtypes ofbcpg:entityV2), deduplicated by name — the lexical corpus for intent → field resolution. In-memory (compiled model), so cheap; bounded by the data model and cached client-side per tenant.- Throws:
org.json.JSONException
-
buildFields
private org.json.JSONArray buildFields(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) throws org.json.JSONException - Throws:
org.json.JSONException
-
fieldEntry
private org.json.JSONObject fieldEntry(org.alfresco.service.cmr.dictionary.PropertyDefinition prop, boolean withMandatory) throws org.json.JSONException - Throws:
org.json.JSONException
-
buildAssociations
private org.json.JSONArray buildAssociations(org.alfresco.service.cmr.dictionary.ClassDefinition classDef) throws org.json.JSONException - Throws:
org.json.JSONException
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) Setter for the field
dictionaryService.- Parameters:
dictionaryService- aDictionaryServiceobject
-
setEntityDictionaryService
Setter for the field
entityDictionaryService.- Parameters:
entityDictionaryService- aEntityDictionaryServiceobject
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) Setter for the field
namespaceService.- Parameters:
namespaceService- aNamespaceServiceobject
-