Class AemAITranslationMergeServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class AemAITranslationMergeServlet
    extends org.apache.sling.api.servlets.SlingAllMethodsServlet
    Servlet with functionality for the AI Translation Merge tool. The operations are distinguished by parameter 'operation'. There are:
    • save: save a translation
    • check: check if a resource has unmerged translations
    • merge: merge translations
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.google.gson.Gson gson  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doPost​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
      Handles POST requests to the servlet.
      protected void handleCheck​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
      Handles the 'check' operation to verify if a resource has unmerged translations.
      protected void handleMerge​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
      Handles the 'merge' operation to merge translations.
      protected void handleSave​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
      Handles the 'save' operation to save a translation.
      • Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet

        doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayService
      • Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet

        doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
    • Field Detail

      • gson

        public static final com.google.gson.Gson gson
    • Constructor Detail

      • AemAITranslationMergeServlet

        public AemAITranslationMergeServlet()
    • Method Detail

      • handleCheck

        protected void handleCheck​(@Nonnull
                                   org.apache.sling.api.SlingHttpServletRequest request,
                                   @Nonnull
                                   org.apache.sling.api.SlingHttpServletResponse response)
                            throws IOException
        Handles the 'check' operation to verify if a resource has unmerged translations. Request parameters: - `path`: the path of the resource to check for unmerged translations (required).
        Parameters:
        request - the Sling HTTP servlet request
        response - the Sling HTTP servlet response
        Throws:
        IOException - if an I/O error occurs
      • handleSave

        protected void handleSave​(@Nonnull
                                  org.apache.sling.api.SlingHttpServletRequest request,
                                  @Nonnull
                                  org.apache.sling.api.SlingHttpServletResponse response)
                           throws IOException
        Handles the 'save' operation to save a translation. Request parameters: - `path`: the path of the resource to save the translation to (required). - `propertyName`: the name of the property to save the translation to (required). - `body`: the translation text to save (required).
        Parameters:
        request - the Sling HTTP servlet request
        response - the Sling HTTP servlet response
        Throws:
        IOException - if an I/O error occurs
      • handleMerge

        protected void handleMerge​(org.apache.sling.api.SlingHttpServletRequest request,
                                   org.apache.sling.api.SlingHttpServletResponse response)
                            throws IOException
        Handles the 'merge' operation to merge translations. Request parameters: - `path`: the path of the resource to merge the translation for (required). - `propertyName`: the name of the property to merge the translation for (required). - `originalSource`: the original source text (required). - `newSource`: the new source text (required). - `newTranslation`: the new translation text (required). - `currentText`: the current text of the component (required). - `language`: the language of the translation (optional).
        Parameters:
        request - the Sling HTTP servlet request
        response - the Sling HTTP servlet response
        Throws:
        IOException - if an I/O error occurs