Class AiCapabilitiesWebScript

java.lang.Object
org.springframework.extensions.webscripts.AbstractWebScript
fr.becpg.repo.web.scripts.remote.ai.AiCapabilitiesWebScript
All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript

public class AiCapabilitiesWebScript extends org.springframework.extensions.webscripts.AbstractWebScript

Capabilities & bootstrap probe for the AI remote API (/becpg/remote/ai/capabilities).

becpg-ai calls this once per instance/session to (1) detect whether the tenant exposes the new /becpg/remote/ai/* endpoints (HTTP 200 = new mode, 404 = fall back to the generic remote API), and (2) bootstrap a small context so it can avoid repeated round-trips: the current user (+ home folder), the available entity types/models, and the beCPG version. Runs as the authenticated user, so the returned person/home reflect the caller.

Author:
matthieu
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript

    org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
    Bump when the AI remote API contract changes in a way clients must detect.
     
    private org.alfresco.service.cmr.module.ModuleService
     
    private org.alfresco.service.namespace.NamespaceService
     
    private org.alfresco.service.cmr.repository.NodeService
     
    private org.alfresco.service.cmr.security.PersonService
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private org.json.JSONArray
     
    private org.json.JSONObject
     
    void
    execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp)
    private static void
    putIfPresent(org.json.JSONObject obj, String key, Object value)
     
    private String
     
    void
    Setter for the field entityDictionaryService.
    void
    setModuleService(org.alfresco.service.cmr.module.ModuleService moduleService)
    Setter for the field moduleService.
    void
    setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
    Setter for the field namespaceService.
    void
    setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
    Setter for the field nodeService.
    void
    setPersonService(org.alfresco.service.cmr.security.PersonService personService)
    Setter for the field personService.

    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

    Methods inherited from class java.lang.Object

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

    • API_VERSION

      private static final String API_VERSION
      Bump when the AI remote API contract changes in a way clients must detect.
      See Also:
    • nodeService

      private org.alfresco.service.cmr.repository.NodeService nodeService
    • namespaceService

      private org.alfresco.service.namespace.NamespaceService namespaceService
    • personService

      private org.alfresco.service.cmr.security.PersonService personService
    • entityDictionaryService

      private EntityDictionaryService entityDictionaryService
    • moduleService

      private org.alfresco.service.cmr.module.ModuleService moduleService
  • Constructor Details

    • AiCapabilitiesWebScript

      public AiCapabilitiesWebScript()
  • Method Details

    • execute

      public void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) throws IOException
      Throws:
      IOException
    • buildUser

      private org.json.JSONObject buildUser() throws org.json.JSONException
      Throws:
      org.json.JSONException
    • buildEntityTypes

      private org.json.JSONArray buildEntityTypes() throws org.json.JSONException
      Throws:
      org.json.JSONException
    • resolveBecpgVersion

      private String resolveBecpgVersion()
    • putIfPresent

      private static void putIfPresent(org.json.JSONObject obj, String key, Object value) throws org.json.JSONException
      Throws:
      org.json.JSONException
    • setNodeService

      public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)

      Setter for the field nodeService.

      Parameters:
      nodeService - a NodeService object
    • setNamespaceService

      public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)

      Setter for the field namespaceService.

      Parameters:
      namespaceService - a NamespaceService object
    • setPersonService

      public void setPersonService(org.alfresco.service.cmr.security.PersonService personService)

      Setter for the field personService.

      Parameters:
      personService - a PersonService object
    • setEntityDictionaryService

      public void setEntityDictionaryService(EntityDictionaryService entityDictionaryService)

      Setter for the field entityDictionaryService.

      Parameters:
      entityDictionaryService - a EntityDictionaryService object
    • setModuleService

      public void setModuleService(org.alfresco.service.cmr.module.ModuleService moduleService)

      Setter for the field moduleService.

      Parameters:
      moduleService - a ModuleService object