Class UtilsAI

java.lang.Object
overit.geocallapp.wfm.ai.UtilsAI

public class UtilsAI extends Object
  • Method Details

    • getClob

      public static boolean getClob(Container container, String content, Long id, String filePrefix, String fileExtension, boolean download, String errorMsg)
    • getClob

      public static boolean getClob(Container container, String[] content, Long id, List<String> filePrefix, String fileExtension, boolean download, String errorMsg)
    • getClobWebResource

      public static WebResource getClobWebResource(String folder, String content, Long id, String filePrefix, String fileExtension)
    • getTempFolder

      public static String getTempFolder()
    • getClobWebResource

      public static WebResource getClobWebResource(String folder, String[] content, Long id, List<String> filePrefix, String fileExtension)
    • getClobWebResource

      public static WebResource getClobWebResource(String content, Long id, String filePrefix, String fileExtension)
    • getClobWebResource

      public static WebResource getClobWebResource(String[] content, Long id, List<String> filePrefix, String fileExtension)
    • getBlob

      public static boolean getBlob(Container container, Blob[] content, Long id, List<String> filePrefix, String fileExtension, String errorMsg)
    • getBlob

      public static boolean getBlob(Container container, Blob content, Long id, String filePrefix, String fileExtension, String errorMsg)
    • getBlobWebResource

      public static WebResource getBlobWebResource(String folder, Blob content, Long id, String filePrefix, String fileExtension)
    • getBlobWebResource

      public static WebResource getBlobWebResource(String folder, Blob[] content, Long id, List<String> filePrefix, String fileExtension)
    • getBlobWebResource

      public static WebResource getBlobWebResource(Blob content, Long id, String filePrefix, String fileExtension)
    • getBlobWebResource

      public static WebResource getBlobWebResource(Blob[] content, Long id, List<String> filePrefix, String fileExtension)
    • getRegion

      public static software.amazon.awssdk.regions.Region getRegion()
    • decodeLogLevel

      public static Level decodeLogLevel(Long logLevel)
    • writeResultToFile

      public static File writeResultToFile(DBView dbv, String fileName, String csvPath) throws DAException
      Writes a DBView on a CSV file
      Parameters:
      dbv -
      fileName -
      csvPath -
      Returns:
      Throws:
      DAException
    • checkOrdersNullValues

      public static List<String> checkOrdersNullValues(DBView ordersDBView, boolean remove)
      This method is going to return a list populated with as many String as many rows it found with null values.
      Parameters:
      ordersDBView - orders'DB view
      remove - if true this method will remove all the rows with null values, otherwise it will save a message error into the return List
      Returns:
      a list containing a string for each order row with null values
    • buildDatasetFileName

      public static String buildDatasetFileName(Date startDate, String suffix, String oc)
      Method that builds a dataset file name with .csv extension
      Parameters:
      startDate -
      suffix -
      oc -
      Returns:
    • hasAnyRow

      public static boolean hasAnyRow(File fileToCheck) throws DAValidateException
      This method is going to check if a File has rows.
      Parameters:
      fileToCheck - a File containing a dataframe's data
      Returns:
      true if the dataframe this file represents has 1 or more rows
      Throws:
      DAValidateException
    • hasAnyRow

      public static boolean hasAnyRow(List<Map<String,String>> listOfMaps)
      This method is going to check if a List of Maps (representing a dataframe) has rows.
      Parameters:
      listOfMaps - a List of maps representing a dataframe, each Map associates the column name to the value in this row
      Returns:
      true if the dataframe this list is representing has 1 or more rows
    • buildOperationCenterCode

      public static String buildOperationCenterCode(String operationCenter)
      Method that build the code if we have more operation centers
      Parameters:
      operationCenter -
      Returns:
    • checkOrdersAlreadySaw

      public static void checkOrdersAlreadySaw(BOConfigurationParams configurationParams, LongSet executionOperations, PoolKit poolKit) throws DAException, DAValidateException
      Throws:
      DAException
      DAValidateException
    • getToLong

      public static long getToLong(Map<String,Object> map, String key) throws DAValidateException
      Method that helps with cast. It can cast only a String, Long, Integer to a Long.
      Parameters:
      map -
      key -
      Returns:
      Throws:
      DAValidateException
    • getXmlFieldAsColumnType

      public static tech.tablesaw.api.ColumnType getXmlFieldAsColumnType(String xmlFieldType)
      Return the type of a xml column field as TableSaw column type.
      Parameters:
      xmlFieldType -
      Returns:
    • createDirectory

      public static Path createDirectory(Path dirPath) throws IOException
      Throws:
      IOException
    • convertMapToJson

      public static String convertMapToJson(Map<String,String> map) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • writeToJsonFile

      public static String writeToJsonFile(Map<String,String> map, String filePath) throws IOException
      Throws:
      IOException
    • writeToJsonFile

      public static String writeToJsonFile(String jsonString, String filePath) throws IOException
      Throws:
      IOException
    • copyInputStream

      public static String copyInputStream(InputStream reportTemplateIs, String destination, String filename) throws IOException
      Throws:
      IOException
    • untar

      public static void untar(String archivePath, String destination) throws IOException
      Untar tar.gz archive to
      Parameters:
      archivePath - path to archive to untar
      destination - destination path where extraction will be performed. Should be a temp dir.
      Throws:
      IOException
    • decompressGzip

      public static void decompressGzip(Path source, Path target) throws IOException
      Method that decompress a file zipped, like example.csv.gz into example.csv.
      Parameters:
      source - the source path where the file is.
      target - the path target where the file will be.
      Throws:
      IOException
    • compressGzip

      public static Path compressGzip(Path source, Path target) throws IOException
      Compress source to gzip file format
      Parameters:
      source - path of the source file
      target - path of the target file
      Throws:
      IOException
    • compressGzip

      public static Path compressGzip(Path source) throws IOException
      Throws:
      IOException
    • addCsvToZip

      public static void addCsvToZip(File[] documents, ZipOutputStream zout, String folder) throws DAException
      Throws:
      DAException
    • buildCsvFileAndReturnPath

      public static String buildCsvFileAndReturnPath(List<Path> paths) throws IOException
      Method thay build a file starting from n files. The files must have the same header.
      Parameters:
      paths - the absolute paths of the files
      Returns:
      the path of the file generated.
      Throws:
      IOException
    • buildCsvFileAndReturnFile

      public static File buildCsvFileAndReturnFile(List<Path> paths) throws IOException
      Method thay build a file starting from n files. The files must have the same header.
      Parameters:
      paths - the absolute paths of the files
      Returns:
      the path of the file generated.
      Throws:
      IOException
    • saveObjFromURLToFile

      public static void saveObjFromURLToFile(URL url, String destinationPath) throws IOException
      Throws:
      IOException
    • compress

      public static byte[] compress(String str) throws IOException
      Throws:
      IOException