Class ControllerUtil


  • public class ControllerUtil
    extends Object
    Utility class providing common controller functionality for the ATH application. This class manages filter configurations, language information, encoding details, parameter validation, and pagination utilities.

    Key responsibilities include:

    • Loading and managing Okapi filter configurations
    • Providing language and encoding information lists
    • Parameter validation for web service endpoints
    • Pagination support for large data sets

    This class is initialized statically and caches language, encoding, and filter information for performance. All methods are static and the class is not meant to be instantiated.

    Since:
    1.0
    Version:
    1.0
    Author:
    Acumen Velocity
    • Constructor Detail

      • ControllerUtil

        public ControllerUtil()
    • Method Detail

      • getFcMapper

        public static net.sf.okapi.common.filters.IFilterConfigurationMapper getFcMapper()
      • checkObjectIdParam

        public static boolean checkObjectIdParam​(String param)
      • setMappings

        public static void setMappings​(net.sf.okapi.common.filters.IFilterConfigurationMapper fcMapper,
                                       boolean reset,
                                       boolean addConfigurations)
        Add the default mappings provided in the DefaultFilters.properties file.
        Parameters:
        fcMapper - the mapper where to add the mapping.
        reset - true to clear all filters, editors and dec descriptions in the mapper before setting the new ones.
        addConfigurations - true to add the filters configurations, false to add only the parameters editors and UI descriptions.
      • checkParam

        public static boolean checkParam​(String param)
      • checkParam

        public static boolean checkParam​(Object param)
      • getPage

        public static <T> List<T> getPage​(List<T> sourceList,
                                          int page,
                                          int pageSize)
        Returns a view (not a new list) of the sourceList for the range based on page and pageSize.
        Parameters:
        sourceList -
        page - , page number should start from 1
        pageSize -
        Returns:
        custom error can be given instead of returning emptyList
      • getFilterId

        public static String getFilterId​(String fileExt)
      • checkUuidParam

        public static boolean checkUuidParam​(String param)
      • importFile

        public static io.swagger.oas.inflector.models.ResponseContext importFile​(org.apache.solr.common.SolrInputDocument doc,
                                                                                 UUID docId,
                                                                                 String docFileName,
                                                                                 URI docGcsUrl,
                                                                                 String docEncoding,
                                                                                 String srcLang,
                                                                                 String trgLang,
                                                                                 String filterId,
                                                                                 String filterParams,
                                                                                 String srcSrx,
                                                                                 UUID tmId,
                                                                                 Integer tmThreshold,
                                                                                 String mtEngineId,
                                                                                 String mtEngineParams,
                                                                                 List<MtResources> mtCustomResources,
                                                                                 boolean mtProvideConfidenceScores,
                                                                                 boolean mtUseTranslateLlm,
                                                                                 boolean mtSendPlainText,
                                                                                 boolean useCodesReinsertionModel,
                                                                                 String codesReinsertionModelName,
                                                                                 UUID userId,
                                                                                 boolean newDoc)
                                                                          throws Exception
        Throws:
        Exception
      • alignFile

        public static io.swagger.oas.inflector.models.ResponseContext alignFile​(org.apache.solr.common.SolrInputDocument doc,
                                                                                UUID docId,
                                                                                File docFile,
                                                                                String docFileName,
                                                                                URI docGcsUrl,
                                                                                String docEncoding,
                                                                                URI docTrlGcsUrl,
                                                                                String docTrlEncoding,
                                                                                String srcLang,
                                                                                String trgLang,
                                                                                String filterId,
                                                                                String filterParams,
                                                                                String srcSrx,
                                                                                String trgSrx,
                                                                                boolean mtSendPlainText,
                                                                                boolean useAlignmentModel,
                                                                                String alignmentModelName,
                                                                                boolean useCodesReinsertionModel,
                                                                                String codesReinsertionModelName,
                                                                                UUID userId)
                                                                         throws Exception
        Throws:
        Exception
      • exportFile

        public static io.swagger.oas.inflector.models.ResponseContext exportFile​(org.apache.solr.common.SolrDocument doc,
                                                                                 org.apache.solr.common.SolrDocument tmDoc,
                                                                                 org.apache.solr.common.SolrInputDocument updateDoc,
                                                                                 URI docOutGcsUrl,
                                                                                 String docOutEncoding,
                                                                                 UUID tmId,
                                                                                 UUID userId)
                                                                          throws Exception
        Throws:
        Exception
      • getProjectId

        public static String getProjectId()