Package overit.geocallapp.wfm.ai
Class UtilsAI
java.lang.Object
overit.geocallapp.wfm.ai.UtilsAI
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCsvToZip(File[] documents, ZipOutputStream zout, String folder) static FilebuildCsvFileAndReturnFile(List<Path> paths) Method thay build a file starting from n files.static StringbuildCsvFileAndReturnPath(List<Path> paths) Method thay build a file starting from n files.static StringbuildDatasetFileName(Date startDate, String suffix, String oc) Method that builds a dataset file name with .csv extensionstatic StringbuildOperationCenterCode(String operationCenter) Method that build the code if we have more operation centersstatic voidcheckOrdersAlreadySaw(BOConfigurationParams configurationParams, LongSet executionOperations, PoolKit poolKit) 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.static byte[]static PathcompressGzip(Path source) static PathcompressGzip(Path source, Path target) Compress source to gzip file formatstatic StringconvertMapToJson(Map<String, String> map) static StringcopyInputStream(InputStream reportTemplateIs, String destination, String filename) static PathcreateDirectory(Path dirPath) static LeveldecodeLogLevel(Long logLevel) static voiddecompressGzip(Path source, Path target) Method that decompress a file zipped, like example.csv.gz into example.csv.static booleangetBlob(Container container, Blob[] content, Long id, List<String> filePrefix, String fileExtension, String errorMsg) static booleangetBlob(Container container, Blob content, Long id, String filePrefix, String fileExtension, String errorMsg) static WebResourcegetBlobWebResource(String folder, Blob[] content, Long id, List<String> filePrefix, String fileExtension) static WebResourcestatic WebResourcestatic WebResourcegetBlobWebResource(Blob content, Long id, String filePrefix, String fileExtension) static booleangetClob(Container container, String[] content, Long id, List<String> filePrefix, String fileExtension, boolean download, String errorMsg) static booleangetClob(Container container, String content, Long id, String filePrefix, String fileExtension, boolean download, String errorMsg) static WebResourcestatic WebResourcegetClobWebResource(String content, Long id, String filePrefix, String fileExtension) static WebResourcegetClobWebResource(String folder, String[] content, Long id, List<String> filePrefix, String fileExtension) static WebResourcestatic software.amazon.awssdk.regions.Regionstatic Stringstatic longMethod that helps with cast.static tech.tablesaw.api.ColumnTypegetXmlFieldAsColumnType(String xmlFieldType) Return the type of a xml column field as TableSaw column type.static booleanThis method is going to check if a File has rows.static booleanThis method is going to check if a List of Maps (representing a dataframe) has rows.static voidsaveObjFromURLToFile(URL url, String destinationPath) static voidUntar tar.gz archive tostatic FilewriteResultToFile(DBView dbv, String fileName, String csvPath) Writes aDBViewon a CSV filestatic StringwriteToJsonFile(String jsonString, String filePath) static StringwriteToJsonFile(Map<String, String> map, String filePath)
-
Method Details
-
getClob
-
getClob
-
getClobWebResource
-
getTempFolder
-
getClobWebResource
-
getClobWebResource
public static WebResource getClobWebResource(String content, Long id, String filePrefix, String fileExtension) -
getClobWebResource
-
getBlob
-
getBlob
-
getBlobWebResource
-
getBlobWebResource
-
getBlobWebResource
public static WebResource getBlobWebResource(Blob content, Long id, String filePrefix, String fileExtension) -
getBlobWebResource
-
getRegion
public static software.amazon.awssdk.regions.Region getRegion() -
decodeLogLevel
-
writeResultToFile
public static File writeResultToFile(DBView dbv, String fileName, String csvPath) throws DAException Writes aDBViewon a CSV file- Parameters:
dbv-fileName-csvPath-- Returns:
- Throws:
DAException
-
checkOrdersNullValues
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 viewremove- 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
Method that builds a dataset file name with .csv extension- Parameters:
startDate-suffix-oc-- Returns:
-
hasAnyRow
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
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
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:
DAExceptionDAValidateException
-
getToLong
Method that helps with cast. It can cast only a String, Long, Integer to a Long.- Parameters:
map-key-- Returns:
- Throws:
DAValidateException
-
getXmlFieldAsColumnType
Return the type of a xml column field as TableSaw column type.- Parameters:
xmlFieldType-- Returns:
-
createDirectory
- Throws:
IOException
-
convertMapToJson
public static String convertMapToJson(Map<String, String> map) throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
writeToJsonFile
- Throws:
IOException
-
writeToJsonFile
- Throws:
IOException
-
copyInputStream
public static String copyInputStream(InputStream reportTemplateIs, String destination, String filename) throws IOException - Throws:
IOException
-
untar
Untar tar.gz archive to- Parameters:
archivePath- path to archive to untardestination- destination path where extraction will be performed. Should be a temp dir.- Throws:
IOException
-
decompressGzip
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
Compress source to gzip file format- Parameters:
source- path of the source filetarget- path of the target file- Throws:
IOException
-
compressGzip
- Throws:
IOException
-
addCsvToZip
public static void addCsvToZip(File[] documents, ZipOutputStream zout, String folder) throws DAException - Throws:
DAException
-
buildCsvFileAndReturnPath
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
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
- Throws:
IOException
-
compress
- Throws:
IOException
-