Class Tool


  • public final class Tool
    extends java.lang.Object
    Main toolbox
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ANY_LANG
      Deprecated.
      Use Globals LANG_ANY
      static int DB_DATE
      Deprecated. 
      static int DB_DATETIME
      Deprecated. 
      static int DB_TIME
      Deprecated. 
      static java.lang.String DECIMAL_000  
      static int DECIMAL_MAX_SCALE  
      static int DEF_PRECISION
      Decimal precision
      static int DEF_SIZE
      Decimal size
      static java.lang.String DEFAULT_LANG
      Deprecated.
      Use Globals.getDefaultLanguage()
      static java.text.DecimalFormatSymbols DFS_ENU  
      static java.text.DecimalFormatSymbols DFS_FRA  
      static java.lang.String FALSE
      FALSE
      static java.util.TimeZone GMT
      GMT time zone
      static int MAX_COLOR
      16M colors
      static java.lang.String TRUE
      TRUE
      static java.util.TimeZone UTC
      UTC time zone
    • Method Summary

      Modifier and Type Method Description
      static java.lang.Object[] append​(java.lang.Object[] a, java.lang.Object o)
      Append an object to a object array
      static java.lang.String[] append​(java.lang.String[] a, java.lang.String s)
      Append a string to a string array
      static java.lang.String appendToList​(java.lang.String value, java.lang.String list, java.lang.String separator)
      Add a value to a serialized list, if does not already contain it
      static java.lang.String arrayToEnum​(java.lang.String[] arr)
      Convert string array to multiple enumeration value
      static java.io.InputStream bytes2InputStream​(byte[] b)
      Deprecated.
      Use toInputStream
      static java.lang.String bytes2String​(byte[] b)
      Deprecated.
      Use toString
      static java.lang.Object bytesToObject​(byte[] b)
      Object deserialization
      static java.lang.String checkDir​(java.lang.String dir, java.lang.String baseDir)
      Build a directory
      static java.lang.String cleanString​(java.lang.String str)
      Trims and removes carriage returns and tabs from a string
      static java.lang.String cleanXml​(java.lang.String xml)
      Deprecated. 
      static java.lang.Object clone​(java.io.Serializable object)
      Clone thru object serialization
      static int compareDate​(java.lang.String d1, java.lang.String d2)
      Compare 2 dates
      static java.lang.Object[] concat​(java.lang.Object[] a1, java.lang.Object[] a2)
      Concatenate two arrays
      static java.lang.String[] concat​(java.lang.String[] a1, java.lang.String[] a2)
      Concatenate two string arrays
      static java.lang.String concat​(java.lang.String s1, java.lang.String s2)
      Concatenate two strings
      static java.lang.String convertDateUTC2Local​(java.lang.String date)
      Convert a UTC date to local date
      static java.io.InputStream convertEncoding​(java.io.InputStream in, java.lang.String encodingIn, java.lang.String encodingOut)
      Convert encoding of input stream
      static java.lang.String convertFilterToService​(ObjectField f, java.lang.String filter, java.lang.String df, java.lang.String lang, boolean convertWildcards)  
      static java.lang.String convertGuiToService​(int type, int size, int precision, java.lang.String value, java.lang.String df, java.lang.String lang)
      Convert a GUI value to the server format
      static java.lang.String convertGuiToService​(int type, int size, int precision, java.lang.String value, java.lang.String df, java.lang.String lang, java.lang.String rendering)
      Convert a GUI value to the server format
      static java.lang.String convertGuiToService​(ObjectField f, java.lang.String value, java.lang.String df, java.lang.String lang)  
      static java.lang.String convertServiceToFilter​(ObjectField f, java.lang.String filter, java.lang.String df, java.lang.String lang, boolean convertWildcards)  
      static java.lang.String convertServiceToGui​(int type, int size, int precision, java.lang.String value, java.lang.String df, java.lang.String lang)
      Convert server value to GUI
      static java.lang.String convertServiceToGui​(int type, int size, int precision, java.lang.String value, java.lang.String df, java.lang.String lang, java.lang.String rendering)
      Convert server value to GUI
      static java.lang.String convertServiceToGui​(ObjectField f, java.lang.String value, java.lang.String df, java.lang.String lang)  
      static java.lang.String convertTimeZone​(java.lang.String date, java.util.TimeZone fromTZ, java.util.TimeZone toTZ)
      Convert a date to timezone
      static java.util.Date convertToDate​(java.lang.String date)
      Deprecated.
      Use fromDate
      static java.util.Date convertToDateTime​(java.lang.String datetime)
      Deprecated.
      User fromDateTime
      static void copy​(java.io.InputStream is, java.io.OutputStream out)
      Copy input stream into output stream, flush and close
      static void copy​(java.io.InputStream is, java.io.OutputStream out, long limit)
      Copy input stream into output stream, flush and close
      static boolean copyFile​(java.io.File src, java.io.File dest, boolean override)
      File copy
      static boolean copyFile​(java.lang.String src, java.lang.String dest, boolean override)
      File copy
      static java.lang.String currentDate()
      Deprecated.
      Use getCurrentDate
      static java.lang.String currentDatetime()
      Deprecated.
      Use getCurrentDatetime
      static java.lang.String currentDatetime​(long offset)
      Deprecated.
      Use getCurrentDatetime
      static java.lang.String currentTime()
      Deprecated.
      Use getCurrentTime
      static java.lang.String dateFromFormat​(java.lang.String d, java.lang.String df)
      Convert named format date (e.g.
      static java.lang.String dateFromMSJSONDate​(java.lang.String d)  
      static java.lang.String dateFromRFC1123​(java.lang.String d)  
      static java.lang.String dateFromRFC3339​(java.lang.String d)  
      static java.lang.String dateFromRFC822​(java.lang.String d)
      Parse date from RFC822 format to internal date format
      static java.lang.String dateFromTimestamp​(java.lang.String d)  
      static java.lang.String dateTimeFromFormat​(java.lang.String d, java.lang.String df)
      Convert named format date (e.g.
      static java.lang.String dateTimeFromMSJSONDate​(java.lang.String d)  
      static java.lang.String dateTimeFromRFC1123​(java.lang.String d)  
      static java.lang.String dateTimeFromRFC3339​(java.lang.String d)  
      static java.lang.String dateTimeFromRFC822​(java.lang.String d)
      Parse date from RFC822 format to internal datetime format
      static java.lang.String dateTimeFromTimestamp​(java.lang.String d)  
      static java.lang.String dateTimeToFormat​(java.lang.String dt, java.lang.String df)
      Converts internal datetime format date (yyyy-MM-dd HH:mm:ss) to named format date (e.g.
      static java.lang.String dateTimeToMSJSONDate​(java.lang.String dt)  
      static java.lang.String dateTimeToRFC1123​(java.lang.String dt)  
      static java.lang.String dateTimeToRFC3339​(java.lang.String dt)  
      static java.lang.String datetimeToRFC822​(java.lang.String dt)
      Alias to dateTimeToRFC822
      static java.lang.String dateTimeToRFC822​(java.lang.String dt)
      Convert datetime from internal format to RFC822 format
      static java.lang.String dateTimeToTimestamp​(java.lang.String dt)  
      static java.lang.String dateToFormat​(java.lang.String d, java.lang.String df)
      Converts internal date format date (yyyy-MM-dd) to named format date (e.g.
      static java.lang.String dateToMSJSONDate​(long d)  
      static java.lang.String dateToMSJSONDate​(java.lang.String d)  
      static java.lang.String dateToRFC1123​(long d)  
      static java.lang.String dateToRFC1123​(java.lang.String d)  
      static java.lang.String dateToRFC3339​(long d)  
      static java.lang.String dateToRFC3339​(java.lang.String d)  
      static java.lang.String dateToRFC822​(java.lang.String d)
      Convert date from internal format to RFC822 format
      static java.lang.String dateToTimestamp​(long d)  
      static java.lang.String dateToTimestamp​(java.lang.String d)  
      static java.lang.String decalDate​(java.lang.String d, int n)
      Deprecated. 
      static java.util.Date decalDateWeekEnd​(java.util.Date d, int n)
      Deprecated.
      Use shiftDaysNoWeekEnds
      static java.lang.String decalMonth​(java.lang.String d, int n)
      Deprecated.
      Use shiftMonths
      static java.lang.String decalSecond​(java.lang.String d, int n)
      Deprecated.
      Use shiftSeconds
      static java.util.Map<java.lang.String,​java.lang.String> decodeUrlParams​(java.lang.String url, java.lang.String encoding)  
      static boolean deleteDirectory​(java.io.File path)
      Deprecated.
      Use FileTool.deleteFileOrDir
      static int diffDate​(java.lang.String d1, java.lang.String d2)
      Day difference between 2 dates
      static long diffDatetime​(java.lang.String d1, java.lang.String d2)
      Seconds difference between 2 dates
      static int diffMonth​(java.lang.String d1, java.lang.String d2)
      Month difference between 2 dates
      static int diffWeek​(java.lang.String d1, java.lang.String d2)
      Week difference between 2 dates
      static java.lang.String encodeUrlParams​(java.util.Map<java.lang.String,​java.lang.Object> params, java.lang.String encoding)  
      static java.lang.String[] enumToArray​(java.lang.String val)
      Convert internal multiple enumeration values into string array
      static java.lang.String extractDate​(java.lang.String v)
      Extract date part from a service date or service
      static java.lang.String extractItemFromDN​(java.lang.String dn, java.lang.String name, java.lang.String sep)
      Extract named item (e.g.
      static java.lang.String extractTime​(java.lang.String v)
      Extract date part from a service date or service
      static java.lang.Object fileToObject​(java.io.File file)
      Object deserialization
      static java.lang.String fixCRLF​(java.lang.String s)
      Fix CRLF problems
      static java.lang.String format​(java.lang.String fmt, java.lang.Object val)
      Format value as string
      static java.util.Date fromDate​(java.lang.String date)
      Convert to Java Date from internal format date.
      static java.util.Date fromDatetime​(java.lang.String datetime)
      Alias to fromDateTime
      static java.util.Date fromDateTime​(java.lang.String datetime)
      Convert to Java Date from internal format datetime.
      static java.util.Date fromMSJSONDate​(java.lang.String s)  
      static java.util.Date fromRFC1123​(java.lang.String s)  
      static java.util.Date fromRFC3339​(java.lang.String s)  
      static java.util.Date fromRFC822​(java.lang.String d)
      Parse date from RFC822 format
      static java.util.Date fromTime​(java.lang.String time)
      Convert to Java Date from internal format time.
      static java.util.Date fromTimestamp​(java.lang.String s)  
      static int fuzzyMatchScore​(java.lang.String s1, java.lang.String s2)
      Get fuzzy match score
      static int fuzzyMatchScore​(java.lang.String s1, java.lang.String s2, boolean extended)
      Get fuzzy match score
      static byte[] getBytes​(java.io.InputStream is)
      Get bytes from input stream
      static byte[] getBytes​(java.io.InputStream is, long limit)
      Get bytes from input stream
      static byte[] getBytes​(java.lang.Object object)
      Get bytes from object
      static byte[] getBytes​(java.lang.Object data, java.lang.String encoding)
      Get bytes from object
      static int getCalendarField​(java.lang.String d, int cf)
      Calendar field from date
      static java.lang.String getColor​(int index)
      Generate a color
      static java.lang.String getColor​(java.lang.String value)
      Generate a color
      static java.lang.String[] getColors()  
      static java.lang.String getCurrentDate()
      Current internal format date
      static java.lang.String getCurrentDate​(int offset)
      Current internal format date with day offset
      static java.lang.String getCurrentDatetime()
      Alias to getCurrentDateTime
      static java.lang.String getCurrentDatetime​(long offset)
      Alias to getCurrentDateTime
      static java.lang.String getCurrentDateTime()
      Current internal format datetime
      static java.lang.String getCurrentDateTime​(long offset)
      Current internal format datetime with millisecond offset
      static java.lang.String getCurrentMonth()  
      static java.lang.String getCurrentTime()
      Current internal format time
      static java.lang.String getCurrentTime​(long offset)
      Current internal format time with millisecond offset
      static java.lang.String getCurrentTimestamp()
      Current timestamp yyyy-MM-dd HH:mm:ss.SSS
      static java.lang.String getCurrentWeek()  
      static java.lang.String getCurrentYear()  
      static java.text.SimpleDateFormat getDateFormat()
      Internal date format yyyy-MM-dd
      static java.text.SimpleDateFormat getDatetimeFormat()
      Internal datetime format
      static int getDayOfMonth​(java.lang.String d)
      Calendar day of month from date
      static int getDayOfWeek​(java.lang.String d)
      Calendar day of week from date
      static int getDayOfYear​(java.lang.String d)
      Calendar day of year from date
      static ObjectField getFieldFromFullInput​(java.util.List<ObjectField> fields, java.lang.String name)
      Get a field out of a field list from field full input name
      static ObjectField getFieldFromInput​(java.util.List<ObjectField> fields, java.lang.String name)
      Get a field out of a field list from field input name
      static ObjectField getFieldFromName​(java.util.List<ObjectField> fields, java.lang.String name)
      Get a field out of a field list from field simple name
      static java.lang.String getHumanReadableDatetime​(java.lang.String dt, java.lang.String lang)
      Get human readable date for internal language code's locale
      static java.lang.String getHumanReadableDatetime​(java.util.Date dt, java.lang.String lang)
      Get human readable date for internal language code's locale
      static IndexTool getIndexTool()
      Return the index tool.
      static java.util.Locale getLocale​(java.lang.String lang)
      Get Locale from internal language code
      static int getMonth​(java.lang.String d)
      Calendar month from date
      static java.io.InputStream getStaticResourceAsStream​(java.lang.String path)
      Get static resource as stream
      static java.lang.String getStaticResourcePath​(java.lang.String path)
      Get static resource absolute path
      static java.lang.String getText​(java.util.Map<java.lang.String,​java.lang.String> texts, java.lang.String code)
      Deprecated.
      use T(texts, code)
      static java.text.SimpleDateFormat getTimeFormat()
      Internal time format
      static java.lang.String getTimeZone​(boolean shortFormat)
      System time zone
      static int getWeekOfMonth​(java.lang.String d)
      Calendar week of month from date
      static int getWeekOfYear​(java.lang.String d)
      Calendar week of year from date
      static int getYear​(java.lang.String d)
      Calendar year from date
      static int getYearOfWeek​(java.lang.String d)
      Calendar year of week from date
      static byte[] hashBytes​(java.lang.String algo, byte[] data)
      Byte array hash of byte array data
      static int hashCode​(Grant g)
      Generate an integer hash from business object functional key label
      static int hashCode​(ObjectDB obj, java.lang.String[] row)
      Generate an integer hash from business object functional key label
      static int hashCode​(java.lang.Object... vals)
      Generate an integer hash from arguments
      static java.lang.String hashString​(java.lang.String algo, java.lang.String data)
      Hexadeciaml hash of string
      static java.lang.String hexaToString​(java.lang.String hexaText)
      Convert a text hexa in String (decode the toHTTP encoding)
      static boolean isDate​(java.lang.String date)
      Validate a date.
      static boolean isDate​(java.lang.String dd, java.lang.String MM, java.lang.String yyyy)
      Validate a date.
      static boolean isDatetime​(java.lang.String dt)
      Alias to isDateTime
      static boolean isDateTime​(java.lang.String dt)
      Validate a datetime yyyy-MM-dd HH:mm:ss
      static boolean isEmpty​(byte[] b)
      Check if a byte array is null or empty
      static boolean isEmpty​(StringIntern s)
      Check if a StringIntern value is null or empty (heading and trailing whitespaces are ignored)
      static boolean isEmpty​(java.io.File f)
      Check if a File is null or empty
      static boolean isEmpty​(java.lang.Object o)
      Check if a Object value is null or empty (heading and trailing whitespaces are ignored)
      static boolean isEmpty​(java.lang.Object[] a)
      Check if a Object array is null or empty
      static boolean isEmpty​(java.lang.String s)
      Check if a String value is null or empty (heading and trailing whitespaces are ignored)
      static boolean isEmpty​(java.lang.StringBuffer s)
      Check if a StringBuffer value is null or empty (heading and trailing whitespaces are not ignored)
      static boolean isEmpty​(java.lang.StringBuilder s)
      Check if a StringBuilder value is null or empty (heading and trailing whitespaces are not ignored)
      static boolean isEmpty​(java.util.List<?> l)
      Check if a List is null or empty
      static boolean isEmpty​(java.util.Map<?,​?> h)
      Check if a Hashmap is null or empty
      static boolean isEmpty​(org.json.JSONArray a)
      Check if a JSON array is null or empty
      static boolean isEmpty​(org.json.JSONObject o)
      Check if a JSON object is null or empty
      static boolean isEqual​(java.lang.String s1, java.lang.String s2)
      Check if two String values are equals handling potential null values
      static boolean isFalse​(java.lang.String value)
      Checks if a value is a false value using various syntaxes
      static boolean isInternalRowIdField​(java.lang.String name)
      Checks if field name is an internal row ID field
      static boolean isServiceDate​(java.lang.String v)  
      static boolean isServiceDatetime​(java.lang.String v)  
      static boolean isServiceTime​(java.lang.String v)  
      static boolean isTechnicalField​(java.lang.String name)
      Checks if field name is one of object's technical field (row_id or timestamp)
      static boolean isTime​(java.lang.String time)
      Validate a time.
      static boolean isTime​(java.lang.String HH, java.lang.String MI, java.lang.String SS)
      Validate a time.
      static boolean isTimestampField​(java.lang.String name)
      Checks if field name is one of object's technical timestamp field
      static boolean isTrue​(java.lang.String value)
      Checks if a value is a true value using various syntaxes
      static java.lang.String[] listStaticResources​(java.lang.String path)
      List static resource names
      static java.lang.String lpad​(java.lang.String str, char pad, int length)
      Alias to lpadString
      static java.lang.String lpadString​(java.lang.String str, char pad, int length)
      Left pad string with specified char to specified length
      static java.lang.String[] merge​(java.lang.String[] l1, java.lang.String[] l2, boolean removeDuplicates)
      Merge 2 string arrays
      static java.util.List<java.lang.String> merge​(java.util.List<java.lang.String> l1, java.lang.String[] l2, boolean removeDuplicates)
      Merge a string and a string array
      static java.util.List<java.lang.String> merge​(java.util.List<java.lang.String> l1, java.util.List<java.lang.String> l2, boolean removeDuplicates)
      Merge 2 string lists
      static java.lang.String now​(int type)
      Deprecated.
      Use getCurrentDate or getCurentTime or getCurrentDatetime
      static byte[] objectToBytes​(java.io.Serializable object)
      Object serialization
      static void objectToFile​(java.io.Serializable object, java.io.File output)
      Object serialization
      static java.lang.String padString​(java.lang.String str, char pad, int length)
      Deprecated.
      Use rpad
      static boolean parseBoolean​(java.lang.Object val)
      Parses a string into an boolean with false as default value.
      static boolean parseBoolean​(java.lang.Object val, boolean def)
      Parses a string into an boolean with default value.
      static boolean parseBoolean​(java.lang.Object val, boolean def, boolean extendedValues)
      Parses a string into an boolean with default value.
      static char parseChar​(java.lang.Object val)
      Parses a string into an character with (char)0 as default value.
      static char parseChar​(java.lang.Object val, char def)
      Parses a string into an character with default value.
      static java.math.BigDecimal parseDecimal​(java.lang.Object val)
      Parses a string into a big decimal with 0.0 as default value
      static java.math.BigDecimal parseDecimal​(java.lang.Object val, double def)
      Parses a string into a big decimal with default value
      static java.math.BigDecimal parseDecimal​(java.lang.Object val, java.math.BigDecimal def)
      Parses a string into a big decimal with default value
      static double parseDouble​(java.lang.Object val)
      Parses a string into an double with 0.0 as default value.
      static double parseDouble​(java.lang.Object val, double def)
      Parses a string into an double with default value
      static boolean parseFlag​(java.lang.Object val)
      Parses a flag string into an boolean with false as default value using various formats (true/false, yes/no, y/n, 1/0, ...)
      static boolean parseFlag​(java.lang.Object val, boolean def)
      Parses a flag string into an boolean with default value using various formats (true/false, yes/no, y/n, 1/0, ...)
      static float parseFloat​(java.lang.Object val)
      Parses a string into an float with 0.0 as default value.
      static float parseFloat​(java.lang.Object val, float def)
      Parses a string into an float with default value
      static int parseInt​(java.lang.Object val)
      Parses a string into an integer with 0 as default value.
      static int parseInt​(java.lang.Object val, int def)
      Parses a string into an integer with default value.
      static org.json.JSONArray parseJSONArray​(java.lang.Object val)
      Parses a string into a JSON array
      static org.json.JSONArray parseJSONArray​(java.lang.Object val, org.json.JSONArray def)
      Parses a string into a JSON array with default value
      static org.json.JSONObject parseJSONObject​(java.lang.Object val)
      Parses a string into a JSON object
      static org.json.JSONObject parseJSONObject​(java.lang.Object val, org.json.JSONObject def)
      Parses a string into a JSON object with default value
      static long parseLong​(java.lang.Object val)
      Parses a string into an long with 0 as default value.
      static long parseLong​(java.lang.Object val, long def)
      Parses a string into an long with default value
      static void parseXML​(java.util.Map<java.lang.String,​java.lang.String> h, org.w3c.dom.Node n, java.lang.String nn)
      Recursively convert XML DOM node into a HashMap.
      static boolean randomBool()
      Generate a random native boolean
      static java.lang.String randomBoolean()
      Generate a random boolean
      static java.lang.String randomDate()
      Generate a random date
      static java.lang.String randomDate​(int minYear)
      Generate a random date
      static java.lang.String randomDateTime()
      Generate a random date and time
      static java.lang.String randomDateTime​(int minYear)
      Generate a random date and time
      static int randomInt​(int min, int max)
      Generate a random native integer
      static java.lang.String randomInteger​(int min, int max)
      Generate a random integer
      static long randomLong()
      Generate a random native long integer
      static java.lang.String randomNumber​(int length)
      Generate a random integer of specified length
      static java.lang.String randomString​(int length)
      Generate a random string of specified length
      static java.lang.String randomString​(int length, boolean alphanum)
      Generate a random string of specified length
      static java.lang.String randomUUID()
      Generate a random UUID
      static byte[] readBytes​(java.io.File file)
      Deprecated.
      Use FileTool.readFileAsBytes
      static java.lang.String readFile​(java.lang.String file)
      Deprecated.
      Use FileTool.readFile
      static java.lang.String readFile​(java.lang.String file, java.lang.String encoding)
      Deprecated.
      Use FileTool.readFile
      static byte[] readStaticResource​(java.lang.String path)
      Read static resource as byte array
      static java.lang.String readStream​(java.io.InputStream input, java.lang.String encoding)
      Read from input stream to string
      static byte[] readStreamToByteArray​(java.io.InputStream input)
      Read from input stream to byte array
      static void readStreamToFile​(java.io.InputStream in, java.io.File file)
      Read from input stream to file
      static void readStreamToFile​(java.io.InputStream input, java.lang.String path)
      Read from input stream to file
      static java.lang.String readUrl​(java.lang.String url)
      Read from URL
      static java.lang.String readUrl​(java.lang.String url, java.lang.Object postData)
      Read from URL with with POST data
      static java.lang.String readUrl​(java.lang.String url, java.lang.Object postData, java.lang.String encoding)
      Read from URL with POST data
      static java.lang.String readUrl​(java.lang.String url, java.lang.String encoding)
      Read from URL
      static java.lang.String readUrl​(java.lang.String url, java.lang.String username, java.lang.String password)
      Read from URL with basic HTTP authentication
      static java.lang.String readUrl​(java.lang.String url, java.lang.String username, java.lang.String password, java.lang.Object postData, boolean multipart, java.lang.Object headers)
      Read from URL with basic HTTP authentication and POST data
      static java.lang.String readUrl​(java.lang.String url, java.lang.String username, java.lang.String password, java.lang.Object postData, java.lang.Object headers)
      Read from URL with basic HTTP authentication and POST data
      static java.lang.String readUrl​(java.lang.String url, java.lang.String username, java.lang.String password, java.lang.Object postData, java.lang.Object headers, java.lang.String encoding)
      Read from URL with basic HTTP authentication and POST data
      static java.lang.String readUrl​(java.lang.String url, java.lang.String username, java.lang.String password, java.lang.String method, java.lang.Object postData, java.lang.Object headers, java.lang.String encoding)
      Read from URL with basic HTTP authentication
      static byte[] readUrlAsByteArray​(java.lang.String url)
      Read from URL as byte array
      static byte[] readUrlAsByteArray​(java.lang.String url, boolean binary)
      Read from URL as byte array
      static byte[] readUrlAsByteArray​(java.lang.String url, java.lang.String username, java.lang.String password, java.lang.Object postData, java.lang.Object headers, java.lang.String encoding)
      Read from URL as byte array with basic HTTP authentication
      static byte[] readUrlAsByteArray​(java.lang.String url, java.lang.String username, java.lang.String password, java.util.Map<java.lang.String,​java.lang.Object> postData, boolean multipart, java.lang.Object headers)
      Read from URL with basic HTTP authentication and POST data
      static byte[] readUrlAsByteArrayUsingMultipart​(java.lang.String url, java.lang.String username, java.lang.String password, java.util.Map<java.lang.String,​java.lang.Object> postData, java.lang.Object headers)
      Read from URL with basic HTTP authentication and multipart POST data.
      static byte[] readUrlAsByteArrayWithClientCert​(java.lang.String url, byte[] jks, java.lang.String passphrase, java.lang.Object postData, java.lang.Object headers, java.lang.String encoding)
      Read from URL as byte array with client certificate authentication
      static java.lang.String readUrlUsingMultipart​(java.lang.String url, java.lang.String username, java.lang.String password, java.util.Map<java.lang.String,​java.lang.Object> postData, java.lang.Object headers)
      Read from URL with basic HTTP authentication and multipart POST data.
      static java.lang.String readUrlWithClientCert​(java.lang.String url, byte[] jks, java.lang.String passphrase)
      Read from URL with client certificate authentication
      static java.lang.String readUrlWithClientCert​(java.lang.String url, byte[] jks, java.lang.String passphrase, java.lang.Object postData, java.lang.Object headers, java.lang.String encoding)
      Read from URL with client certificate authentication
      static java.lang.String replaceParams​(java.lang.String str, java.lang.String[] params)
      Substitute variable zones [n] in text with parameters
      static java.lang.String replaceText​(java.lang.String str, java.lang.String cut, java.lang.String paste)
      Replace text in text
      static java.lang.Object resizeArray​(java.lang.Object oldArray, int newSize)
      Reallocates an array with a new size, and copies the contents of the old array to the new array.
      static java.lang.String rpad​(java.lang.String str, char pad, int length)
      Alias to rpadString
      static java.lang.String rpadString​(java.lang.String str, char pad, int length)
      Right pad string with specified char to specified length
      static java.util.List<java.lang.Integer> searchDate​(java.lang.String str)
      Search date in text
      static java.util.List<java.lang.Integer> searchDatetime​(java.lang.String str)
      Alias to searchDateTime
      static java.util.List<java.lang.Integer> searchDateTime​(java.lang.String str)
      Search datetime in text
      static java.util.List<java.lang.Integer> searchTime​(java.lang.String str)
      Search time in text
      static java.lang.String shiftDays​(java.lang.String d, int n)
      Shift a date with days
      static java.lang.String shiftDaysNoWeekEnds​(java.lang.String d, int n)
      Shift a date with days excluding week end days
      static java.util.Date shiftDaysNoWeekEnds​(java.util.Date d, int n)
      Shift a date with days excluding week end days
      static java.lang.String shiftHours​(java.lang.String d, int n)
      Shift a date with hours
      static java.util.Date shiftHours​(java.util.Date d, int n)
      Shift a date with hours
      static java.lang.String shiftMinutes​(java.lang.String d, int n)
      Shift a date with minutes
      static java.util.Date shiftMinutes​(java.util.Date d, int n)
      Shift a date with minutes
      static java.lang.String shiftMonths​(java.lang.String d, int n)
      Shift a date with months
      static java.util.Date shiftMonths​(java.util.Date d, int n)
      Shift a date with months
      static java.lang.String shiftSeconds​(java.lang.String d, int n)
      Shift a date with seconds
      static java.util.Date shiftSeconds​(java.util.Date d, int n)
      Shift a date with seconds
      static java.lang.String shuffle​(java.lang.String val)
      Shuffle a string
      static java.lang.String simpleDiff​(byte[] data1, byte[] data2)
      Process simple diff between 2 byte arrays
      static java.lang.String simpleDiff​(java.lang.String data1, java.lang.String data2)
      Process simple diff between 2 strings
      static long sizeOfDirectory​(java.io.File path)
      Deprecated.
      Use FileTool.sizeOfDirectory
      static long sizeOfDirectory​(java.lang.String path)
      Deprecated.
      Use FileTool.sizeOfDirectory
      static void sleep​(long delay)
      Sleep with silent interruption.
      static void sort​(java.util.List<java.lang.String[]> list, int index)
      Sort a list of string arrays
      static void sort​(java.util.List<java.lang.String[]> list, int index, boolean reverse)
      Sort a list of string arrays
      static void sort​(java.util.List<java.lang.String[]> list, int index, boolean ignorecase, boolean reverse)
      Sort a list of string arrays
      static void sort​(java.util.List<java.lang.String> list)
      Sort a list of strings
      static void sort​(java.util.List<java.lang.String> list, boolean reverse)
      Sort a list of strings
      static void sort​(java.util.List<java.lang.String> list, boolean ignorecase, boolean reverse)
      Sort a list of strings
      static java.lang.Object streamToObject​(java.io.InputStream in)
      Object deserialization
      static java.io.InputStream string2InputStream​(java.lang.String s, java.lang.String charset)
      Deprecated.
      Use toInputStream
      static boolean stringToFile​(java.lang.String path, java.lang.String data)
      Deprecated.
      Use FileTool.writeFile
      static java.lang.String T​(java.util.Map<java.lang.String,​java.lang.String> texts, java.lang.String code)
      Return translated label from TEXT list of values
      static java.lang.String T​(java.util.Map<java.lang.String,​java.lang.String> texts, java.lang.String code, boolean plural)
      Return translated label from TEXT list of values
      static java.lang.String toBase64​(java.lang.Object data)
      Get Base64 representation of Java object
      static byte[] toByteArray​(java.lang.Object data)
      Get byte array representation from Java object:
      - Byte array : returns byte array as is
      - String : returns byte array from string using platform encoding
      - Other object : returns byte array from toString of object using platform encoding
      static java.awt.Color toColor​(java.lang.String color)
      Convert to color
      static java.lang.String toColorRGB​(long color)
      Convert to color
      static java.lang.String toDate​(long date)
      Convert from Java Date to internal format date.
      static java.lang.String toDate​(java.util.Date date)
      Convert from Java Date to internal format date.
      static java.lang.String toDatetime​(long date)
      Alias to toDateTime
      static java.lang.String toDatetime​(java.util.Date date)
      Alias to toDateTime
      static java.lang.String toDateTime​(long date)
      Convert from Java Date to internal format datetime.
      static java.lang.String toDateTime​(java.util.Date date)
      Convert from Java Date to internal format datetime.
      static java.lang.String toFormattedDate​(java.lang.String v, java.lang.String df)
      Convert a service date to a formatted date
      static java.lang.String toFormattedDatetime​(java.lang.String v, java.lang.String df)
      Convert a service date time to a formatted date time
      static java.lang.String toFormattedFloat​(double d, int size, int precision, java.lang.String lang)  
      static java.lang.String toFormattedFloat​(java.lang.String v, int size, int precision, java.lang.String lang)
      Convert a service float to a formatted string
      static java.lang.String toFormattedFloat​(java.math.BigDecimal f, int size, int precision, java.lang.String lang)
      Convert a service float to a formatted string
      static java.lang.String toFormattedTime​(java.lang.String v)
      Convert a service time to a formatted time
      static java.lang.String toGUI​(java.lang.String value)
      Alias to toHTML
      static java.lang.String toGUIDate​(java.lang.String v, java.lang.String df)
      Deprecated.
      Use toFormattedDate()
      static java.lang.String toGUIDatetime​(java.lang.String v, java.lang.String df)
      Deprecated.
      Use toFormattedTime()
      static java.lang.String toGUILabel​(java.lang.String name)
      Deprecated.
      use toLabel
      static java.lang.String toGUITime​(java.lang.String v)
      Deprecated.
      Use toFormattedTime()
      static java.lang.String toHex​(java.lang.Object data)
      Get hexadecimal representation of Java object
      static java.lang.String toHTML​(java.lang.String value)
      Convert value for HTML use
      static java.lang.String toHTTP​(java.lang.String text)
      Convert a text for HTTP use
      static java.io.InputStream toInputStream​(byte[] data)
      Get input stream from byte array
      static java.io.InputStream toInputStream​(java.lang.String data)
      Get input stream from string using platform encoding
      static java.io.InputStream toInputStream​(java.lang.String data, java.lang.String encoding)
      Get input stream from string using specified encoding
      static java.lang.String toJS​(java.lang.String value)
      Convert for Javascript use
      static java.lang.String toLabel​(java.lang.String name)
      Converts a logical name into a human readable label (e.g.
      static java.util.List<java.lang.String> toLines​(java.io.InputStream in)
      Convert input stream as lines list
      static java.util.List<java.lang.String> toLines​(java.io.Reader data)
      Convert reader as lines list
      static java.util.List<java.lang.String> toLines​(java.lang.String data)
      Convert string as lines list
      static java.lang.String toMSJSONDate​(java.util.Date d)  
      static java.lang.String toRFC1123​(java.util.Date d)  
      static java.lang.String toRFC3339​(java.util.Date d)  
      static java.lang.String toRFC822​(long d)
      Convert date to RFC822 format
      static java.lang.String toRFC822​(java.util.Date d)
      Convert date to RFC822 format
      static java.lang.String toServiceBoolean​(java.lang.String v, boolean ext)
      Convert a boolean value to a service float
      static java.lang.String toServiceDate​(java.lang.String v, java.lang.String df)
      Convert a formatted date to a service date
      static java.lang.String toServiceDatetime​(java.lang.String v, java.lang.String df)
      Convert a formatted date time to a service date
      static java.lang.String toServiceFloat​(java.lang.String v, java.lang.String lang)
      Convert a formatted float to a service float
      static java.lang.String toServiceTime​(java.lang.String v)
      Convert a formatted time to a service time
      static java.lang.String toSQL​(java.lang.String value)
      Convert text for SQL use
      static java.lang.String toString​(java.lang.Object data)
      Get string representation of Java object :
      - String : returns string as is
      - Char array : returns new string from characters
      - Byte array : returns new string from bytes using platform encoding
      - Other object : returns toString of object
      static java.lang.String toTime​(long sec)
      Convert from seconds to a time format.
      static java.lang.String toTimeMillis​(long msec)
      Convert from milliseconds to a time format.
      static java.lang.String toTimestamp​(java.util.Date d)  
      static java.lang.String toXML​(java.lang.String value)
      Convert value for XML content use
      static java.lang.String toXMLAttribute​(java.lang.String value)
      Convert value for XML attribute use
      static java.lang.String trim​(java.lang.String s)
      Extended trim on both sides
      static java.lang.String unifiedDiff​(java.lang.String name1, byte[] data1, java.lang.String name2, byte[] data2, int nbContextLines)
      Process unified diff between 2 byte arrays
      static java.lang.String unifiedDiff​(java.lang.String name1, java.lang.String data1, java.lang.String name2, java.lang.String data2, int nbContextLines)
      Process unified diff between 2 strings
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_LANG

        @Deprecated
        public static final java.lang.String DEFAULT_LANG
        Deprecated.
        Use Globals.getDefaultLanguage()
      • ANY_LANG

        @Deprecated
        public static final java.lang.String ANY_LANG
        Deprecated.
        Use Globals LANG_ANY
        See Also:
        Constant Field Values
      • DB_TIME

        @Deprecated
        public static final int DB_TIME
        Deprecated.
        Time type (for usage as parameter of deprecated method now(type))
        See Also:
        Constant Field Values
      • DB_DATE

        @Deprecated
        public static final int DB_DATE
        Deprecated.
        Date type (for usage as parameter of deprecated method now(type))
        See Also:
        Constant Field Values
      • DB_DATETIME

        @Deprecated
        public static final int DB_DATETIME
        Deprecated.
        Datetime type (for usage as parameter of deprecated method now(type))
        See Also:
        Constant Field Values
      • GMT

        public static final java.util.TimeZone GMT
        GMT time zone
      • UTC

        public static final java.util.TimeZone UTC
        UTC time zone
      • DFS_FRA

        public static final java.text.DecimalFormatSymbols DFS_FRA
      • DFS_ENU

        public static final java.text.DecimalFormatSymbols DFS_ENU
    • Method Detail

      • getDateFormat

        public static java.text.SimpleDateFormat getDateFormat()
        Internal date format yyyy-MM-dd
      • getDatetimeFormat

        public static java.text.SimpleDateFormat getDatetimeFormat()
        Internal datetime format
      • getTimeFormat

        public static java.text.SimpleDateFormat getTimeFormat()
        Internal time format
      • isTrue

        public static final boolean isTrue​(java.lang.String value)
        Checks if a value is a true value using various syntaxes
      • isFalse

        public static final boolean isFalse​(java.lang.String value)
        Checks if a value is a false value using various syntaxes
      • parseFlag

        public static boolean parseFlag​(java.lang.Object val)
        Parses a flag string into an boolean with false as default value using various formats (true/false, yes/no, y/n, 1/0, ...)
        Parameters:
        val - Value to parse
      • parseFlag

        public static boolean parseFlag​(java.lang.Object val,
                                        boolean def)
        Parses a flag string into an boolean with default value using various formats (true/false, yes/no, y/n, 1/0, ...)
        Parameters:
        val - Value to parse
        def - Default value
      • parseBoolean

        public static boolean parseBoolean​(java.lang.Object val)
        Parses a string into an boolean with false as default value.
        Parameters:
        val - Value to parse
      • parseBoolean

        public static boolean parseBoolean​(java.lang.Object val,
                                           boolean def)
        Parses a string into an boolean with default value.
        Parameters:
        val - Value to parse
        def - Default value
      • parseBoolean

        public static boolean parseBoolean​(java.lang.Object val,
                                           boolean def,
                                           boolean extendedValues)
        Parses a string into an boolean with default value.
        Parameters:
        val - Value to parse
        def - Default value
        extendedValues - allows extended boolean values to be taken into account (yes/no, y/n, 1/0, ...) ?
      • parseChar

        public static char parseChar​(java.lang.Object val)
        Parses a string into an character with (char)0 as default value. If the string length is more than 1 only the first character is used.
        Parameters:
        val - Value to parse
      • parseChar

        public static char parseChar​(java.lang.Object val,
                                     char def)
        Parses a string into an character with default value. If the string length is more than 1 only the first character is used.
        Parameters:
        val - Value to parse
        def - Default value
      • parseInt

        public static int parseInt​(java.lang.Object val)
        Parses a string into an integer with 0 as default value.
        Parameters:
        val - Value to parse
      • parseInt

        public static int parseInt​(java.lang.Object val,
                                   int def)
        Parses a string into an integer with default value.
        Parameters:
        val - Value to parse
        def - Default value
      • parseLong

        public static long parseLong​(java.lang.Object val)
        Parses a string into an long with 0 as default value.
        Parameters:
        val - Value to parse
      • parseLong

        public static long parseLong​(java.lang.Object val,
                                     long def)
        Parses a string into an long with default value
        Parameters:
        val - Value to parse
        def - Default value
      • parseFloat

        public static float parseFloat​(java.lang.Object val)
        Parses a string into an float with 0.0 as default value.
        Parameters:
        val - Value to parse
      • parseFloat

        public static float parseFloat​(java.lang.Object val,
                                       float def)
        Parses a string into an float with default value
        Parameters:
        val - Value to parse
        def - Default value
      • parseDouble

        public static double parseDouble​(java.lang.Object val)
        Parses a string into an double with 0.0 as default value.
        Parameters:
        val - Value to parse
      • parseDouble

        public static double parseDouble​(java.lang.Object val,
                                         double def)
        Parses a string into an double with default value
        Parameters:
        val - Value to parse
        def - Default value
      • parseDecimal

        public static java.math.BigDecimal parseDecimal​(java.lang.Object val)
        Parses a string into a big decimal with 0.0 as default value
        Parameters:
        val - Value to parse
      • parseDecimal

        public static java.math.BigDecimal parseDecimal​(java.lang.Object val,
                                                        double def)
        Parses a string into a big decimal with default value
        Parameters:
        val - Value to parse
        def - Default value
      • parseDecimal

        public static java.math.BigDecimal parseDecimal​(java.lang.Object val,
                                                        java.math.BigDecimal def)
        Parses a string into a big decimal with default value
        Parameters:
        val - Value to parse
        def - Default value
      • parseJSONObject

        public static org.json.JSONObject parseJSONObject​(java.lang.Object val)
        Parses a string into a JSON object
        Parameters:
        val - Value to parse
      • parseJSONObject

        public static org.json.JSONObject parseJSONObject​(java.lang.Object val,
                                                          org.json.JSONObject def)
        Parses a string into a JSON object with default value
        Parameters:
        val - Value to parse
        def - Default value
      • parseJSONArray

        public static org.json.JSONArray parseJSONArray​(java.lang.Object val)
        Parses a string into a JSON array
        Parameters:
        val - Value to parse
      • parseJSONArray

        public static org.json.JSONArray parseJSONArray​(java.lang.Object val,
                                                        org.json.JSONArray def)
        Parses a string into a JSON array with default value
        Parameters:
        val - Value to parse
        def - Default value
      • currentDate

        @Deprecated
        public static java.lang.String currentDate()
        Deprecated.
        Use getCurrentDate
      • getCurrentDate

        public static java.lang.String getCurrentDate()
        Current internal format date
        Returns:
        Date in service format (yyyy-MM-dd)
      • getCurrentDate

        public static java.lang.String getCurrentDate​(int offset)
        Current internal format date with day offset
        Parameters:
        offset - Day offset (negative = in the past)
        Returns:
        Date in service format (yyyy-MM-dd)
      • currentTime

        @Deprecated
        public static java.lang.String currentTime()
        Deprecated.
        Use getCurrentTime
      • getCurrentTime

        public static java.lang.String getCurrentTime()
        Current internal format time
        Returns:
        Time in internal format (HH:mm:ss)
      • getCurrentTime

        public static java.lang.String getCurrentTime​(long offset)
        Current internal format time with millisecond offset
        Parameters:
        offset - Milliseconds offset (negative = in the past)
        Returns:
        Time in internal format (HH:mm:ss)
      • currentDatetime

        @Deprecated
        public static java.lang.String currentDatetime()
        Deprecated.
        Use getCurrentDatetime
      • getCurrentDateTime

        public static java.lang.String getCurrentDateTime()
        Current internal format datetime
        Returns:
        Datetime in internal format (yyyy-MM-dd HH:mm:ss)
      • getCurrentDatetime

        public static java.lang.String getCurrentDatetime()
        Alias to getCurrentDateTime
      • currentDatetime

        @Deprecated
        public static java.lang.String currentDatetime​(long offset)
        Deprecated.
        Use getCurrentDatetime
      • getCurrentDateTime

        public static java.lang.String getCurrentDateTime​(long offset)
        Current internal format datetime with millisecond offset
        Parameters:
        offset - Milliseconds offset (negative = in the past)
        Returns:
        Datetime in internal format (yyyy-MM-dd HH:mm:ss)
      • getCurrentDatetime

        public static java.lang.String getCurrentDatetime​(long offset)
        Alias to getCurrentDateTime
      • getCurrentTimestamp

        public static java.lang.String getCurrentTimestamp()
        Current timestamp yyyy-MM-dd HH:mm:ss.SSS
      • getCurrentWeek

        public static java.lang.String getCurrentWeek()
        Returns:
        Week in internal format (yyyy-ww)
      • getCurrentMonth

        public static java.lang.String getCurrentMonth()
        Returns:
        Month in internal format (yyyy-mm)
      • getCurrentYear

        public static java.lang.String getCurrentYear()
        Returns:
        Year in internal format (yyyy)
      • now

        @Deprecated
        public static final java.lang.String now​(int type)
        Deprecated.
        Use getCurrentDate or getCurentTime or getCurrentDatetime
      • convertToDate

        @Deprecated
        public static java.util.Date convertToDate​(java.lang.String date)
        Deprecated.
        Use fromDate
      • fromDate

        public static java.util.Date fromDate​(java.lang.String date)
        Convert to Java Date from internal format date.
        Parameters:
        date - Date[time] in internal format (yyyy-dd-MM)
        Returns:
        Date
      • convertToDateTime

        @Deprecated
        public static java.util.Date convertToDateTime​(java.lang.String datetime)
        Deprecated.
        User fromDateTime
      • fromDateTime

        public static java.util.Date fromDateTime​(java.lang.String datetime)
        Convert to Java Date from internal format datetime.
        Parameters:
        datetime - Date[time] in internal format (yyyy-dd-MM [HH:mm:ss])
        Returns:
        Date
      • fromDatetime

        public static java.util.Date fromDatetime​(java.lang.String datetime)
        Alias to fromDateTime
      • fromTime

        public static java.util.Date fromTime​(java.lang.String time)
        Convert to Java Date from internal format time.
        Parameters:
        time - Time in internal format (HH:mm:ss)
        Returns:
        Date
      • toDate

        public static java.lang.String toDate​(java.util.Date date)
        Convert from Java Date to internal format date.
        Parameters:
        date - Date
        Returns:
        internal format date
      • toDate

        public static java.lang.String toDate​(long date)
        Convert from Java Date to internal format date.
        Parameters:
        date - Date as milliseconds
        Returns:
        internal format date
      • toDateTime

        public static java.lang.String toDateTime​(java.util.Date date)
        Convert from Java Date to internal format datetime.
        Parameters:
        date - Date
        Returns:
        internal format datetime
      • toDateTime

        public static java.lang.String toDateTime​(long date)
        Convert from Java Date to internal format datetime.
        Parameters:
        date - Date as milliseconds
        Returns:
        internal format datetime
      • toDatetime

        public static java.lang.String toDatetime​(java.util.Date date)
        Alias to toDateTime
      • toDatetime

        public static java.lang.String toDatetime​(long date)
        Alias to toDateTime
      • toTime

        public static java.lang.String toTime​(long sec)
        Convert from seconds to a time format.
        Parameters:
        sec - duration in seconds
        Returns:
        hh:mm:ss
      • toTimeMillis

        public static java.lang.String toTimeMillis​(long msec)
        Convert from milliseconds to a time format.
        Parameters:
        msec - duration in milliseconds
        Returns:
        hh:mm:ss.yyy
      • isDate

        public static boolean isDate​(java.lang.String dd,
                                     java.lang.String MM,
                                     java.lang.String yyyy)
        Validate a date.
        Parameters:
        dd - day
        MM - month
        yyyy - year
        Returns:
        True if date exists
      • isDate

        public static boolean isDate​(java.lang.String date)
        Validate a date.
        Parameters:
        date - yyyy-MM-dd
        Returns:
        True if date exists
      • isTime

        public static boolean isTime​(java.lang.String HH,
                                     java.lang.String MI,
                                     java.lang.String SS)
        Validate a time.
        Parameters:
        HH - hour
        MI - minute
        SS - second
        Returns:
        True if hour exists
      • isTime

        public static boolean isTime​(java.lang.String time)
        Validate a time.
        Parameters:
        time - HH:mm:ss
        Returns:
        True if date exists
      • isDateTime

        public static boolean isDateTime​(java.lang.String dt)
        Validate a datetime yyyy-MM-dd HH:mm:ss
      • isDatetime

        public static boolean isDatetime​(java.lang.String dt)
        Alias to isDateTime
      • replaceText

        public static java.lang.String replaceText​(java.lang.String str,
                                                   java.lang.String cut,
                                                   java.lang.String paste)
        Replace text in text
        Parameters:
        str - source
        cut - cut text
        paste - paste text
        Returns:
        Text
      • replaceParams

        public static java.lang.String replaceParams​(java.lang.String str,
                                                     java.lang.String[] params)
        Substitute variable zones [n] in text with parameters
        Parameters:
        str - Initial string
        params - Parameters
        Returns:
        Substituted string
      • searchDate

        public static java.util.List<java.lang.Integer> searchDate​(java.lang.String str)
        Search date in text
        Parameters:
        str - text
        Returns:
        List of positions
      • searchTime

        public static java.util.List<java.lang.Integer> searchTime​(java.lang.String str)
        Search time in text
        Parameters:
        str - text
        Returns:
        List of positions
      • searchDateTime

        public static java.util.List<java.lang.Integer> searchDateTime​(java.lang.String str)
        Search datetime in text
        Parameters:
        str - text
        Returns:
        List of positions
      • searchDatetime

        public static java.util.List<java.lang.Integer> searchDatetime​(java.lang.String str)
        Alias to searchDateTime
      • compareDate

        public static int compareDate​(java.lang.String d1,
                                      java.lang.String d2)
        Compare 2 dates
        Parameters:
        d1 - date / datetime yyyy-MM-dd HH:mm:ss
        d2 - date / datetime yyyy-MM-dd HH:mm:ss
        Returns:
        0 equals, positive if d1 sup d2, negative if d1 inf d2
      • diffDate

        public static int diffDate​(java.lang.String d1,
                                   java.lang.String d2)
        Day difference between 2 dates
        Parameters:
        d1 - date yyyy-MM-dd
        d2 - date yyyy-MM-dd
        Returns:
        d2-d1 in days
      • diffWeek

        public static int diffWeek​(java.lang.String d1,
                                   java.lang.String d2)
        Week difference between 2 dates
        Parameters:
        d1 - date yyyy-MM-dd
        d2 - date yyyy-MM-dd
        Returns:
        d2-d1 in weeks
      • diffMonth

        public static int diffMonth​(java.lang.String d1,
                                    java.lang.String d2)
        Month difference between 2 dates
        Parameters:
        d1 - date yyyy-MM-dd
        d2 - date yyyy-MM-dd
        Returns:
        d2-d1 in months
      • diffDatetime

        public static long diffDatetime​(java.lang.String d1,
                                        java.lang.String d2)
        Seconds difference between 2 dates
        Parameters:
        d1 - date yyyy-MM-dd HH:MI:SS
        d2 - date yyyy-MM-dd HH:MI:SS
        Returns:
        d2-d1 in seconds
      • decalDate

        @Deprecated
        public static java.lang.String decalDate​(java.lang.String d,
                                                 int n)
        Deprecated.
      • shiftDays

        public static java.lang.String shiftDays​(java.lang.String d,
                                                 int n)
        Shift a date with days
        Parameters:
        d - Dateformat yyyy-MM-dd
        n - Days to shift (may be negative)
        Returns:
        shifted date yyyy-MM-dd
      • decalDateWeekEnd

        @Deprecated
        public static java.util.Date decalDateWeekEnd​(java.util.Date d,
                                                      int n)
        Deprecated.
        Use shiftDaysNoWeekEnds
      • shiftDaysNoWeekEnds

        public static java.lang.String shiftDaysNoWeekEnds​(java.lang.String d,
                                                           int n)
        Shift a date with days excluding week end days
        Parameters:
        d - Date string
        n - Days to shift (may be negative)
        Returns:
        shifted date string
      • shiftDaysNoWeekEnds

        public static java.util.Date shiftDaysNoWeekEnds​(java.util.Date d,
                                                         int n)
        Shift a date with days excluding week end days
        Parameters:
        d - Date
        n - Days to shift (may be negative)
        Returns:
        shifted date
      • decalMonth

        @Deprecated
        public static java.lang.String decalMonth​(java.lang.String d,
                                                  int n)
        Deprecated.
        Use shiftMonths
      • shiftMonths

        public static java.lang.String shiftMonths​(java.lang.String d,
                                                   int n)
        Shift a date with months
        Parameters:
        d - Date string
        n - Months to shift (may be negative)
        Returns:
        shifted date string
      • shiftMonths

        public static java.util.Date shiftMonths​(java.util.Date d,
                                                 int n)
        Shift a date with months
        Parameters:
        d - Date
        n - Months to shift (may be negative)
        Returns:
        shifted date
      • decalSecond

        @Deprecated
        public static java.lang.String decalSecond​(java.lang.String d,
                                                   int n)
        Deprecated.
        Use shiftSeconds
      • shiftSeconds

        public static java.lang.String shiftSeconds​(java.lang.String d,
                                                    int n)
        Shift a date with seconds
        Parameters:
        d - Date string
        n - Seconds to shift (may be negative)
        Returns:
        shifted date string
      • shiftSeconds

        public static java.util.Date shiftSeconds​(java.util.Date d,
                                                  int n)
        Shift a date with seconds
        Parameters:
        d - Date
        n - Seconds to shift (may be negative)
        Returns:
        shifted date
      • shiftMinutes

        public static java.lang.String shiftMinutes​(java.lang.String d,
                                                    int n)
        Shift a date with minutes
        Parameters:
        d - Date string
        n - Minutes to shift (may be negative)
        Returns:
        shifted date string
      • shiftMinutes

        public static java.util.Date shiftMinutes​(java.util.Date d,
                                                  int n)
        Shift a date with minutes
        Parameters:
        d - Date
        n - Minutes to shift (may be negative)
        Returns:
        shifted date
      • shiftHours

        public static java.lang.String shiftHours​(java.lang.String d,
                                                  int n)
        Shift a date with hours
        Parameters:
        d - Date string
        n - Hours to shift (may be negative)
        Returns:
        shifted date string
      • shiftHours

        public static java.util.Date shiftHours​(java.util.Date d,
                                                int n)
        Shift a date with hours
        Parameters:
        d - Date
        n - Hours to shift (may be negative)
        Returns:
        shifted date
      • getCalendarField

        public static int getCalendarField​(java.lang.String d,
                                           int cf)
        Calendar field from date
        Parameters:
        d - Date (format yyyy-MM-dd)
        cf - Calendar field (cf. Calendar class constants)
        Returns:
        calendar field value of date
      • getYear

        public static int getYear​(java.lang.String d)
        Calendar year from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Year
      • getMonth

        public static int getMonth​(java.lang.String d)
        Calendar month from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Month
      • getDayOfWeek

        public static int getDayOfWeek​(java.lang.String d)
        Calendar day of week from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Day of week
      • getDayOfMonth

        public static int getDayOfMonth​(java.lang.String d)
        Calendar day of month from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Day of month
      • getDayOfYear

        public static int getDayOfYear​(java.lang.String d)
        Calendar day of year from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Day of year
      • getWeekOfMonth

        public static int getWeekOfMonth​(java.lang.String d)

        Calendar week of month from date

        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Week of month
      • getWeekOfYear

        public static int getWeekOfYear​(java.lang.String d)
        Calendar week of year from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Week of year
      • getYearOfWeek

        public static int getYearOfWeek​(java.lang.String d)
        Calendar year of week from date
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Year of week
      • fromRFC822

        public static java.util.Date fromRFC822​(java.lang.String d)
        Parse date from RFC822 format
        Parameters:
        d - Date in RFC822 format
        Returns:
        Date
      • dateFromRFC822

        public static java.lang.String dateFromRFC822​(java.lang.String d)
        Parse date from RFC822 format to internal date format
        Parameters:
        d - Date in RFC822 format
        Returns:
        Date in internal format (yyyy-MM-dd HH:mm:ss)
      • dateTimeFromRFC822

        public static java.lang.String dateTimeFromRFC822​(java.lang.String d)
        Parse date from RFC822 format to internal datetime format
        Parameters:
        d - Date in RFC822 format
        Returns:
        Datetime in internal format (yyyy-MM-dd HH:mm:ss)
      • toRFC822

        public static java.lang.String toRFC822​(java.util.Date d)
        Convert date to RFC822 format
        Parameters:
        d - Date
        Returns:
        Date in RFC82 format
      • toRFC822

        public static java.lang.String toRFC822​(long d)
        Convert date to RFC822 format
        Parameters:
        d - Date as miliseconds
        Returns:
        Date in RFC82 format
      • dateToRFC822

        public static java.lang.String dateToRFC822​(java.lang.String d)
        Convert date from internal format to RFC822 format
        Parameters:
        d - Date in internal format (yyyy-MM-dd)
        Returns:
        Date in RFC822 format
      • dateTimeToRFC822

        public static java.lang.String dateTimeToRFC822​(java.lang.String dt)
        Convert datetime from internal format to RFC822 format
        Parameters:
        dt - Datetime in internal format (yyyy-MM-dd HH:mm:ss)
        Returns:
        Date in RFC822 format
      • datetimeToRFC822

        public static java.lang.String datetimeToRFC822​(java.lang.String dt)
        Alias to dateTimeToRFC822
      • getLocale

        public static java.util.Locale getLocale​(java.lang.String lang)
        Get Locale from internal language code
        Parameters:
        lang - Language code (e.g. FRA, ENU, ...)
        Returns:
        Locale
      • getHumanReadableDatetime

        public static final java.lang.String getHumanReadableDatetime​(java.util.Date dt,
                                                                      java.lang.String lang)
        Get human readable date for internal language code's locale
        Parameters:
        dt - Date
        lang - Language code (e.g. FRA, ENU, ...)
        Returns:
        Human readable date
      • getHumanReadableDatetime

        public static final java.lang.String getHumanReadableDatetime​(java.lang.String dt,
                                                                      java.lang.String lang)
        Get human readable date for internal language code's locale
        Parameters:
        dt - Date (and optional time) in format yyyy-MM-dd[ HH:mm:ss]
        lang - Language code (e.g. FRA, ENU, ...)
        Returns:
        Human readable date
      • getTimeZone

        public static java.lang.String getTimeZone​(boolean shortFormat)
        System time zone
        Parameters:
        shortFormat - Short format (like CET) ?
      • fromRFC1123

        public static java.util.Date fromRFC1123​(java.lang.String s)
      • toRFC1123

        public static java.lang.String toRFC1123​(java.util.Date d)
      • dateToRFC1123

        public static java.lang.String dateToRFC1123​(long d)
      • dateToRFC1123

        public static java.lang.String dateToRFC1123​(java.lang.String d)
      • dateTimeToRFC1123

        public static java.lang.String dateTimeToRFC1123​(java.lang.String dt)
      • dateFromRFC1123

        public static java.lang.String dateFromRFC1123​(java.lang.String d)
      • dateTimeFromRFC1123

        public static java.lang.String dateTimeFromRFC1123​(java.lang.String d)
      • fromRFC3339

        public static java.util.Date fromRFC3339​(java.lang.String s)
      • toRFC3339

        public static java.lang.String toRFC3339​(java.util.Date d)
      • dateToRFC3339

        public static java.lang.String dateToRFC3339​(long d)
      • dateToRFC3339

        public static java.lang.String dateToRFC3339​(java.lang.String d)
      • dateTimeToRFC3339

        public static java.lang.String dateTimeToRFC3339​(java.lang.String dt)
      • dateFromRFC3339

        public static java.lang.String dateFromRFC3339​(java.lang.String d)
      • dateTimeFromRFC3339

        public static java.lang.String dateTimeFromRFC3339​(java.lang.String d)
      • fromTimestamp

        public static java.util.Date fromTimestamp​(java.lang.String s)
      • toTimestamp

        public static java.lang.String toTimestamp​(java.util.Date d)
      • dateToTimestamp

        public static java.lang.String dateToTimestamp​(long d)
      • dateToTimestamp

        public static java.lang.String dateToTimestamp​(java.lang.String d)
      • dateTimeToTimestamp

        public static java.lang.String dateTimeToTimestamp​(java.lang.String dt)
      • dateFromTimestamp

        public static java.lang.String dateFromTimestamp​(java.lang.String d)
      • dateTimeFromTimestamp

        public static java.lang.String dateTimeFromTimestamp​(java.lang.String d)
      • fromMSJSONDate

        public static java.util.Date fromMSJSONDate​(java.lang.String s)
      • toMSJSONDate

        public static java.lang.String toMSJSONDate​(java.util.Date d)
      • dateToMSJSONDate

        public static java.lang.String dateToMSJSONDate​(long d)
      • dateToMSJSONDate

        public static java.lang.String dateToMSJSONDate​(java.lang.String d)
      • dateTimeToMSJSONDate

        public static java.lang.String dateTimeToMSJSONDate​(java.lang.String dt)
      • dateFromMSJSONDate

        public static java.lang.String dateFromMSJSONDate​(java.lang.String d)
      • dateTimeFromMSJSONDate

        public static java.lang.String dateTimeFromMSJSONDate​(java.lang.String d)
      • dateToFormat

        public static java.lang.String dateToFormat​(java.lang.String d,
                                                    java.lang.String df)
        Converts internal date format date (yyyy-MM-dd) to named format date (e.g. RFC3339)
      • dateTimeToFormat

        public static java.lang.String dateTimeToFormat​(java.lang.String dt,
                                                        java.lang.String df)
        Converts internal datetime format date (yyyy-MM-dd HH:mm:ss) to named format date (e.g. RFC3339)
      • dateFromFormat

        public static java.lang.String dateFromFormat​(java.lang.String d,
                                                      java.lang.String df)
        Convert named format date (e.g. RFC3339) to internal date format date (yyyy-MM-dd)
      • dateTimeFromFormat

        public static java.lang.String dateTimeFromFormat​(java.lang.String d,
                                                          java.lang.String df)
        Convert named format date (e.g. RFC3339) to internal datetime format date (yyyy-MM-dd HH:mm:ss)
      • convertTimeZone

        public static java.lang.String convertTimeZone​(java.lang.String date,
                                                       java.util.TimeZone fromTZ,
                                                       java.util.TimeZone toTZ)
        Convert a date to timezone
        Parameters:
        date - YYYY-MM-DD HH:MM:SS
        fromTZ - From timezone (ex TimeZone.getTimeZone("UTC"))
        toTZ - To timezone (ex TimeZone.getDefault() for local time zone)
        Returns:
        YYYY-MM-DD HH:MM:SS in new timezone
      • convertDateUTC2Local

        public static java.lang.String convertDateUTC2Local​(java.lang.String date)
        Convert a UTC date to local date
        Parameters:
        date - YYYY-MM-DD HH:MM:SS
        Returns:
        YYYY-MM-DD HH:MM:SS in local timezone
      • toHTTP

        public static java.lang.String toHTTP​(java.lang.String text)
        Convert a text for HTTP use
        Parameters:
        text - a text
        Returns:
        String to use in URL parameter
      • hexaToString

        public static java.lang.String hexaToString​(java.lang.String hexaText)
        Convert a text hexa in String (decode the toHTTP encoding)
        Parameters:
        hexaText - HTTP hexa encoded text
        Returns:
        String literal
      • toGUI

        public static java.lang.String toGUI​(java.lang.String value)
        Alias to toHTML
      • toHTML

        public static java.lang.String toHTML​(java.lang.String value)
        Convert value for HTML use
        Parameters:
        value - a text
        Returns:
        text for HTML
      • toXML

        public static java.lang.String toXML​(java.lang.String value)
        Convert value for XML content use
        Parameters:
        value - a text
        Returns:
        text for HTML
      • toXMLAttribute

        public static java.lang.String toXMLAttribute​(java.lang.String value)
        Convert value for XML attribute use
        Parameters:
        value - a text
        Returns:
        text for HTML
      • toSQL

        public static java.lang.String toSQL​(java.lang.String value)
        Convert text for SQL use
        Parameters:
        value - a text
        Returns:
        text for SQL
      • toJS

        public static java.lang.String toJS​(java.lang.String value)
        Convert for Javascript use
        Parameters:
        value - a text
        Returns:
        text for JS parameter
      • toFormattedFloat

        public static java.lang.String toFormattedFloat​(java.lang.String v,
                                                        int size,
                                                        int precision,
                                                        java.lang.String lang)
        Convert a service float to a formatted string
        Parameters:
        v - Value ##0.0#
        size - field length (unused)
        precision - precision size (limited to DECIMAL_MAX_SCALE)
        lang - user language
        Returns:
        Formatted string
      • toFormattedFloat

        public static java.lang.String toFormattedFloat​(double d,
                                                        int size,
                                                        int precision,
                                                        java.lang.String lang)
      • toFormattedFloat

        public static java.lang.String toFormattedFloat​(java.math.BigDecimal f,
                                                        int size,
                                                        int precision,
                                                        java.lang.String lang)
        Convert a service float to a formatted string
        Parameters:
        f - Value
        size - field length (unused)
        precision - precision size (limited to DECIMAL_MAX_SCALE)
        lang - user language
        Returns:
        Formatted string
      • toServiceFloat

        public static java.lang.String toServiceFloat​(java.lang.String v,
                                                      java.lang.String lang)
        Convert a formatted float to a service float
        Parameters:
        v - Value
        lang - user language
        Returns:
        Service value #####0.##
      • toServiceBoolean

        public static java.lang.String toServiceBoolean​(java.lang.String v,
                                                        boolean ext)
        Convert a boolean value to a service float
        Parameters:
        v - Value
        ext - Extended values ?
        Returns:
        Service value TRUE or FALSE
      • extractDate

        public static java.lang.String extractDate​(java.lang.String v)
        Extract date part from a service date or service
        Parameters:
        v - Service date or datetime
      • extractTime

        public static java.lang.String extractTime​(java.lang.String v)
        Extract date part from a service date or service
        Parameters:
        v - Service date or datetime
      • isServiceDate

        public static boolean isServiceDate​(java.lang.String v)
      • toGUIDate

        @Deprecated
        public static final java.lang.String toGUIDate​(java.lang.String v,
                                                       java.lang.String df)
        Deprecated.
        Use toFormattedDate()
      • toFormattedDate

        public static java.lang.String toFormattedDate​(java.lang.String v,
                                                       java.lang.String df)
        Convert a service date to a formatted date
        Parameters:
        v - Service date value
        df - Date format (e.g. getGrant().getDateFormat())
        Returns:
        Formatted date
      • toServiceDate

        public static java.lang.String toServiceDate​(java.lang.String v,
                                                     java.lang.String df)
        Convert a formatted date to a service date
        Parameters:
        v - Formatted date value yyyy-MM-dd
        df - Date format (e.g. getGrant().getDateFormat())
        Returns:
        Service date
      • isServiceTime

        public static boolean isServiceTime​(java.lang.String v)
      • toGUITime

        @Deprecated
        public static final java.lang.String toGUITime​(java.lang.String v)
        Deprecated.
        Use toFormattedTime()
      • toFormattedTime

        public static java.lang.String toFormattedTime​(java.lang.String v)
        Convert a service time to a formatted time
        Parameters:
        v - Service time value
        Returns:
        Formatted time
      • toServiceTime

        public static java.lang.String toServiceTime​(java.lang.String v)
        Convert a formatted time to a service time
        Parameters:
        v - Formatted time value hh:mm:ss
        Returns:
        Service time
      • isServiceDatetime

        public static boolean isServiceDatetime​(java.lang.String v)
      • toGUIDatetime

        @Deprecated
        public static final java.lang.String toGUIDatetime​(java.lang.String v,
                                                           java.lang.String df)
        Deprecated.
        Use toFormattedTime()
      • toFormattedDatetime

        public static java.lang.String toFormattedDatetime​(java.lang.String v,
                                                           java.lang.String df)
        Convert a service date time to a formatted date time
        Parameters:
        v - Service date time value yyyy-MM-dd HH:mm:ss
        df - Date time format (e.g. getGrant().getDatetimeFormat())
        Returns:
        Formatted date time
      • toServiceDatetime

        public static java.lang.String toServiceDatetime​(java.lang.String v,
                                                         java.lang.String df)
        Convert a formatted date time to a service date
        Parameters:
        v - Formatted date time value
        df - Date time format (e.g. getGrant().getDatetimeFormat())
        Returns:
        Service date time
      • convertGuiToService

        public static java.lang.String convertGuiToService​(int type,
                                                           int size,
                                                           int precision,
                                                           java.lang.String value,
                                                           java.lang.String df,
                                                           java.lang.String lang)
        Convert a GUI value to the server format
        Parameters:
        type - Field type
        size - Size
        precision - Precision (for float)
        value - HUI value
        df - Date format
        lang - User language
        Returns:
        Server format
      • convertGuiToService

        public static java.lang.String convertGuiToService​(int type,
                                                           int size,
                                                           int precision,
                                                           java.lang.String value,
                                                           java.lang.String df,
                                                           java.lang.String lang,
                                                           java.lang.String rendering)
        Convert a GUI value to the server format
        Parameters:
        type - Field type
        size - Size
        precision - Precision (for float)
        value - HUI value
        df - Date format
        lang - User language
        rendering - Optional field rendering
        Returns:
        Server format
      • convertGuiToService

        public static java.lang.String convertGuiToService​(ObjectField f,
                                                           java.lang.String value,
                                                           java.lang.String df,
                                                           java.lang.String lang)
      • convertFilterToService

        public static java.lang.String convertFilterToService​(ObjectField f,
                                                              java.lang.String filter,
                                                              java.lang.String df,
                                                              java.lang.String lang,
                                                              boolean convertWildcards)
      • convertServiceToGui

        public static java.lang.String convertServiceToGui​(int type,
                                                           int size,
                                                           int precision,
                                                           java.lang.String value,
                                                           java.lang.String df,
                                                           java.lang.String lang)
        Convert server value to GUI
        Parameters:
        type - Field type
        size - Size
        precision - Precision (for float)
        value - Server value
        df - Date format
        lang - User language
        Returns:
        GUI value
      • convertServiceToGui

        public static java.lang.String convertServiceToGui​(int type,
                                                           int size,
                                                           int precision,
                                                           java.lang.String value,
                                                           java.lang.String df,
                                                           java.lang.String lang,
                                                           java.lang.String rendering)
        Convert server value to GUI
        Parameters:
        type - Field type
        size - Size
        precision - Precision (for float)
        value - Server value
        df - Date format
        lang - User language
        rendering - Optional field rendering
        Returns:
        GUI value
      • convertServiceToGui

        public static java.lang.String convertServiceToGui​(ObjectField f,
                                                           java.lang.String value,
                                                           java.lang.String df,
                                                           java.lang.String lang)
      • convertServiceToFilter

        public static java.lang.String convertServiceToFilter​(ObjectField f,
                                                              java.lang.String filter,
                                                              java.lang.String df,
                                                              java.lang.String lang,
                                                              boolean convertWildcards)
      • getFieldFromName

        public static ObjectField getFieldFromName​(java.util.List<ObjectField> fields,
                                                   java.lang.String name)

        Get a field out of a field list from field simple name

        Parameters:
        name - Field simple name
        Returns:
        Field or null if field is not in the list
      • getFieldFromInput

        public static ObjectField getFieldFromInput​(java.util.List<ObjectField> fields,
                                                    java.lang.String name)

        Get a field out of a field list from field input name

        Parameters:
        name - Field input name
        Returns:
        Field or null if field is not in the list
      • getFieldFromFullInput

        public static ObjectField getFieldFromFullInput​(java.util.List<ObjectField> fields,
                                                        java.lang.String name)

        Get a field out of a field list from field full input name

        Parameters:
        name - Field full input name
        Returns:
        Field or null if field is not in the list
      • appendToList

        public static java.lang.String appendToList​(java.lang.String value,
                                                    java.lang.String list,
                                                    java.lang.String separator)
        Add a value to a serialized list, if does not already contain it
        Parameters:
        value -
        list -
        separator -
      • T

        public static java.lang.String T​(java.util.Map<java.lang.String,​java.lang.String> texts,
                                         java.lang.String code)

        Return translated label from TEXT list of values

        Parameters:
        texts - HashMap of all texts
        code - Code of text
        Returns:
        translated text, or code if unknown
      • T

        public static java.lang.String T​(java.util.Map<java.lang.String,​java.lang.String> texts,
                                         java.lang.String code,
                                         boolean plural)

        Return translated label from TEXT list of values

        Parameters:
        texts - HashMap of all texts
        code - Code of text
        plural - Get plural label if exists
        Returns:
        translated text, or code if unknown
      • getText

        @Deprecated
        public static java.lang.String getText​(java.util.Map<java.lang.String,​java.lang.String> texts,
                                               java.lang.String code)
        Deprecated.
        use T(texts, code)
      • isTechnicalField

        public static boolean isTechnicalField​(java.lang.String name)

        Checks if field name is one of object's technical field (row_id or timestamp)

        Parameters:
        name - Field or column name
      • isInternalRowIdField

        public static boolean isInternalRowIdField​(java.lang.String name)

        Checks if field name is an internal row ID field

        Parameters:
        name - Field or column name
      • isTimestampField

        public static boolean isTimestampField​(java.lang.String name)

        Checks if field name is one of object's technical timestamp field

        Parameters:
        name - Field or column name
      • isEqual

        public static boolean isEqual​(java.lang.String s1,
                                      java.lang.String s2)

        Check if two String values are equals handling potential null values

        Parameters:
        s1 - First string
        s2 - Second string
      • isEmpty

        public static boolean isEmpty​(java.lang.Object o)

        Check if a Object value is null or empty (heading and trailing whitespaces are ignored)

        Parameters:
        o - Object to check
      • isEmpty

        public static boolean isEmpty​(java.lang.String s)

        Check if a String value is null or empty (heading and trailing whitespaces are ignored)

        Parameters:
        s - String to check
      • isEmpty

        public static boolean isEmpty​(StringIntern s)

        Check if a StringIntern value is null or empty (heading and trailing whitespaces are ignored)

        Parameters:
        s - String to check
      • isEmpty

        public static boolean isEmpty​(java.lang.StringBuilder s)

        Check if a StringBuilder value is null or empty (heading and trailing whitespaces are not ignored)

        Parameters:
        s - StringBuilder to check
      • isEmpty

        public static boolean isEmpty​(java.lang.StringBuffer s)

        Check if a StringBuffer value is null or empty (heading and trailing whitespaces are not ignored)

        Parameters:
        s - StringBuffer to check
      • isEmpty

        public static boolean isEmpty​(java.util.Map<?,​?> h)

        Check if a Hashmap is null or empty

        Parameters:
        h - Hashmap to check
      • isEmpty

        public static boolean isEmpty​(java.util.List<?> l)

        Check if a List is null or empty

        Parameters:
        l - List to check
      • isEmpty

        public static boolean isEmpty​(java.lang.Object[] a)

        Check if a Object array is null or empty

        Parameters:
        a - Object array to check
      • isEmpty

        public static boolean isEmpty​(byte[] b)

        Check if a byte array is null or empty

        Parameters:
        b - Byte array to check
      • isEmpty

        public static boolean isEmpty​(org.json.JSONObject o)

        Check if a JSON object is null or empty

        Parameters:
        o - JSON object to check
      • isEmpty

        public static boolean isEmpty​(java.io.File f)

        Check if a File is null or empty

        Parameters:
        f - file to check
      • isEmpty

        public static boolean isEmpty​(org.json.JSONArray a)

        Check if a JSON array is null or empty

        Parameters:
        a - JSON array to check
      • trim

        public static java.lang.String trim​(java.lang.String s)
        Extended trim on both sides
        Parameters:
        s - String
      • concat

        public static java.lang.String concat​(java.lang.String s1,
                                              java.lang.String s2)
        Concatenate two strings
        Parameters:
        s1 - First string to concatenate (may be null)
        s2 - Second string to concatenate (may be null)
      • concat

        public static java.lang.Object[] concat​(java.lang.Object[] a1,
                                                java.lang.Object[] a2)
        Concatenate two arrays
        Parameters:
        a1 - First array to concatenate (may be null)
        a2 - Second array to concatenate (may be null)
      • append

        public static java.lang.Object[] append​(java.lang.Object[] a,
                                                java.lang.Object o)
        Append an object to a object array
        Parameters:
        a - Object array
        o - Object to add
      • concat

        public static java.lang.String[] concat​(java.lang.String[] a1,
                                                java.lang.String[] a2)
        Concatenate two string arrays
        Parameters:
        a1 - First string array to concatenate (may be null)
        a2 - Second string array to concatenate (may be null)
        Returns:
        new aray with the arays
      • append

        public static java.lang.String[] append​(java.lang.String[] a,
                                                java.lang.String s)
        Append a string to a string array
        Parameters:
        a - String array
        s - String to add
      • merge

        public static java.util.List<java.lang.String> merge​(java.util.List<java.lang.String> l1,
                                                             java.util.List<java.lang.String> l2,
                                                             boolean removeDuplicates)
        Merge 2 string lists
        Parameters:
        l1 - First string list
        l2 - Second string list
        removeDuplicates - Remove duplicates?
      • merge

        public static java.util.List<java.lang.String> merge​(java.util.List<java.lang.String> l1,
                                                             java.lang.String[] l2,
                                                             boolean removeDuplicates)
        Merge a string and a string array
        Parameters:
        l1 - String list
        l2 - String array
        removeDuplicates - Remove duplicates?
      • merge

        public static java.lang.String[] merge​(java.lang.String[] l1,
                                               java.lang.String[] l2,
                                               boolean removeDuplicates)
        Merge 2 string arrays
        Parameters:
        l1 - First string array
        l2 - Second string array
        removeDuplicates - Remove duplicates?
      • sleep

        public static void sleep​(long delay)
        Sleep with silent interruption.
        Parameters:
        delay - sleep time in millisec
      • getBytes

        public static byte[] getBytes​(java.lang.Object object)
        Get bytes from object
        Parameters:
        object - Object
        Returns:
        bytes array
      • getBytes

        public static byte[] getBytes​(java.lang.Object data,
                                      java.lang.String encoding)
        Get bytes from object
        Parameters:
        data - Data
        encoding - Optional encoding (only required if data is a string)
        Returns:
        bytes array
      • getBytes

        public static byte[] getBytes​(java.io.InputStream is)
        Get bytes from input stream
        Parameters:
        is - input stream
        Returns:
        bytes array
      • getBytes

        public static byte[] getBytes​(java.io.InputStream is,
                                      long limit)
                               throws FileSizeException
        Get bytes from input stream
        Parameters:
        is - input stream
        limit - max size in Mo
        Returns:
        null or bytes array if lower than the requered limit
        Throws:
        FileSizeException
      • copy

        public static void copy​(java.io.InputStream is,
                                java.io.OutputStream out)
        Copy input stream into output stream, flush and close
        Parameters:
        is - input stream
        out - output stream
      • copy

        public static void copy​(java.io.InputStream is,
                                java.io.OutputStream out,
                                long limit)
                         throws FileSizeException
        Copy input stream into output stream, flush and close
        Parameters:
        is - input stream
        out - output stream
        limit - max size in Mo
        Throws:
        FileSizeException
      • sizeOfDirectory

        @Deprecated
        public static long sizeOfDirectory​(java.lang.String path)
        Deprecated.
        Use FileTool.sizeOfDirectory
      • sizeOfDirectory

        @Deprecated
        public static long sizeOfDirectory​(java.io.File path)
        Deprecated.
        Use FileTool.sizeOfDirectory
      • deleteDirectory

        @Deprecated
        public static boolean deleteDirectory​(java.io.File path)
        Deprecated.
        Use FileTool.deleteFileOrDir
      • checkDir

        public static java.lang.String checkDir​(java.lang.String dir,
                                                java.lang.String baseDir)
        Build a directory
        Parameters:
        dir - Absolute or relative directory
        baseDir - Base directory to add if relative
        Returns:
        Absolute path
      • readFile

        @Deprecated
        public static java.lang.String readFile​(java.lang.String file)
                                         throws java.io.IOException
        Deprecated.
        Use FileTool.readFile
        Throws:
        java.io.IOException
      • readFile

        @Deprecated
        public static java.lang.String readFile​(java.lang.String file,
                                                java.lang.String encoding)
                                         throws java.io.IOException
        Deprecated.
        Use FileTool.readFile
        Throws:
        java.io.IOException
      • readBytes

        @Deprecated
        public static byte[] readBytes​(java.io.File file)
                                throws java.io.IOException
        Deprecated.
        Use FileTool.readFileAsBytes
        Throws:
        java.io.IOException
      • stringToFile

        @Deprecated
        public static boolean stringToFile​(java.lang.String path,
                                           java.lang.String data)
                                    throws java.io.IOException
        Deprecated.
        Use FileTool.writeFile
        Throws:
        java.io.IOException
      • copyFile

        public static boolean copyFile​(java.io.File src,
                                       java.io.File dest,
                                       boolean override)
        File copy
        Parameters:
        src - Source file
        dest - Destination file
        override - True to override if exists
        Returns:
        True on success
      • copyFile

        public static boolean copyFile​(java.lang.String src,
                                       java.lang.String dest,
                                       boolean override)
        File copy
        Parameters:
        src - Source file
        dest - Destination file
        override - True to override if exists
        Returns:
        True on success
      • readStream

        public static java.lang.String readStream​(java.io.InputStream input,
                                                  java.lang.String encoding)
                                           throws java.io.IOException
        Read from input stream to string
        Parameters:
        input - Input stream to read from
        encoding - Input stream encoding
        Throws:
        java.io.IOException
      • readStreamToByteArray

        public static byte[] readStreamToByteArray​(java.io.InputStream input)
                                            throws java.io.IOException
        Read from input stream to byte array
        Parameters:
        input - Input stream to read from
        Throws:
        java.io.IOException
      • readStreamToFile

        public static void readStreamToFile​(java.io.InputStream input,
                                            java.lang.String path)
                                     throws java.io.IOException
        Read from input stream to file
        Parameters:
        input - Input stream to read from
        path - File path
        Throws:
        java.io.IOException
      • readStreamToFile

        public static void readStreamToFile​(java.io.InputStream in,
                                            java.io.File file)
                                     throws java.io.IOException
        Read from input stream to file
        Parameters:
        in - Input stream to read from
        file - File
        Throws:
        java.io.IOException
      • convertEncoding

        public static java.io.InputStream convertEncoding​(java.io.InputStream in,
                                                          java.lang.String encodingIn,
                                                          java.lang.String encodingOut)
                                                   throws java.io.UnsupportedEncodingException,
                                                          java.io.IOException
        Convert encoding of input stream
        Parameters:
        in - Stream
        encodingIn - Input encoding
        encodingOut - Output encoding
        Returns:
        new stream based on temporary file (burned after reading)
        Throws:
        java.io.IOException
        java.io.UnsupportedEncodingException
      • getStaticResourcePath

        public static java.lang.String getStaticResourcePath​(java.lang.String path)
        Get static resource absolute path
        Parameters:
        path - Absolute or relative path (if relative Globals.STATIC_RESOURCES_PATH is used as root path prefix)
        Returns:
        Resource absolute path
      • getStaticResourceAsStream

        public static java.io.InputStream getStaticResourceAsStream​(java.lang.String path)
                                                             throws java.io.IOException
        Get static resource as stream
        Parameters:
        path - Absolute or relative path (if relative Globals.STATIC_RESOURCES_PATH is used as root path prefix)
        Returns:
        Input stream
        Throws:
        java.io.IOException
      • readStaticResource

        public static byte[] readStaticResource​(java.lang.String path)
                                         throws java.io.IOException
        Read static resource as byte array
        Parameters:
        path - Absolute or relative path (if relative Globals.STATIC_RESOURCES_PATH is used as root path prefix)
        Returns:
        Byte array
        Throws:
        java.io.IOException
      • listStaticResources

        public static java.lang.String[] listStaticResources​(java.lang.String path)
                                                      throws java.io.IOException
        List static resource names
        Parameters:
        path - Absolute or relative directory (if relative Globals.STATIC_RESOURCES_PATH is used as root path prefix)
        Throws:
        java.io.IOException
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url)
                                        throws java.lang.Exception
        Read from URL
        Parameters:
        url - URL to read (GET)
        Returns:
        Full response as string, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.String encoding)
                                        throws java.lang.Exception
        Read from URL
        Parameters:
        url - URL to read (GET)
        encoding - Request and response encoding (converted from and to platform encoding)
        Returns:
        Full response as string, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.Object postData)
                                        throws java.lang.Exception
        Read from URL with with POST data
        Parameters:
        url - URL to read (POST if postData is set or GET)
        postData - Optional POST data (URL-encoded String or Map)
        Returns:
        Full response as string, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.Object postData,
                                               java.lang.String encoding)
                                        throws java.lang.Exception
        Read from URL with POST data
        Parameters:
        url - URL to read (POST if postData is set or GET)
        postData - Optional POST data (URL-encoded String or Map)
        encoding - Request and response encoding (converted from and to platform encoding)
        Returns:
        Full response as string, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.String username,
                                               java.lang.String password)
                                        throws java.lang.Exception
        Read from URL with basic HTTP authentication
        Parameters:
        url - URL to read (GET)
        username - Optional user name
        password - Optional password
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.String username,
                                               java.lang.String password,
                                               java.lang.Object postData,
                                               java.lang.Object headers)
                                        throws java.lang.Exception
        Read from URL with basic HTTP authentication and POST data
        Parameters:
        url - URL to read (POST if postData is set or GET)
        username - Optional user name
        password - Optional password
        postData - Optional POST data (URL-encoded String or Map)
        headers - Optional extra headers (String array of "name:value" or Map)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.String username,
                                               java.lang.String password,
                                               java.lang.String method,
                                               java.lang.Object postData,
                                               java.lang.Object headers,
                                               java.lang.String encoding)
                                        throws java.lang.Exception
        Read from URL with basic HTTP authentication
        Parameters:
        url - URL to read
        username - Optional user name
        password - Optional password
        method - Optional HTTP method (GET|POST|DELETE|PUT)
        headers - Optional extra headers (String array of "name:value" or Map)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.String username,
                                               java.lang.String password,
                                               java.lang.Object postData,
                                               java.lang.Object headers,
                                               java.lang.String encoding)
                                        throws java.lang.Exception
        Read from URL with basic HTTP authentication and POST data
        Parameters:
        url - URL to read (POST if postData is set or GET)
        username - Optional user name
        password - Optional password
        postData - Optional POST data (URL encoded String or Map)
        headers - Optional extra headers (String array of "name:value" or Map)
        encoding - Request and response encoding (converted from and to platform encoding)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrl

        public static java.lang.String readUrl​(java.lang.String url,
                                               java.lang.String username,
                                               java.lang.String password,
                                               java.lang.Object postData,
                                               boolean multipart,
                                               java.lang.Object headers)
                                        throws java.lang.Exception
        Read from URL with basic HTTP authentication and POST data
        Parameters:
        url - URL to read (POST if postData is set or GET)
        username - Optional user name
        password - Optional password
        postData - Optional POST data (URL-encoded String or Map)
        multipart - Post as multipart? If true, postData must be a Map.
        headers - Optional extra headers (String array of "name:value" or Map)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlUsingMultipart

        public static java.lang.String readUrlUsingMultipart​(java.lang.String url,
                                                             java.lang.String username,
                                                             java.lang.String password,
                                                             java.util.Map<java.lang.String,​java.lang.Object> postData,
                                                             java.lang.Object headers)
                                                      throws java.lang.Exception
        Read from URL with basic HTTP authentication and multipart POST data.
        Parameters:
        url - URL to read (POST)
        username - Optional user name
        password - Optional password
        postData - Map of POST data
        headers - Optional extra headers (String array of "name:value" or Map)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlAsByteArray

        public static byte[] readUrlAsByteArray​(java.lang.String url)
                                         throws java.lang.Exception
        Read from URL as byte array
        Parameters:
        url - URL to read (GET)
        Returns:
        Full response as byte array, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlAsByteArray

        public static byte[] readUrlAsByteArray​(java.lang.String url,
                                                boolean binary)
                                         throws java.lang.Exception
        Read from URL as byte array
        Parameters:
        url - URL to read (GET)
        binary - Binary content ?
        Returns:
        Full response as byte array, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlAsByteArray

        public static byte[] readUrlAsByteArray​(java.lang.String url,
                                                java.lang.String username,
                                                java.lang.String password,
                                                java.lang.Object postData,
                                                java.lang.Object headers,
                                                java.lang.String encoding)
                                         throws java.lang.Exception
        Read from URL as byte array with basic HTTP authentication
        Parameters:
        url - URL to read
        username - Optional user name
        password - Optional password
        postData - Optional POST data (URL encoded String or Map)
        headers - Optional extra headers (String array of "name:value" or Map)
        encoding - Request and response encoding (converted from and to platform encoding)
        Returns:
        Full response as byte array, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlAsByteArray

        public static byte[] readUrlAsByteArray​(java.lang.String url,
                                                java.lang.String username,
                                                java.lang.String password,
                                                java.util.Map<java.lang.String,​java.lang.Object> postData,
                                                boolean multipart,
                                                java.lang.Object headers)
                                         throws java.lang.Exception
        Read from URL with basic HTTP authentication and POST data
        Parameters:
        url - URL to read (POST if postData is set or GET)
        username - Optional user name
        password - Optional password
        postData - Map of data to post
        multipart - Post as multipart?
        headers - Optional extra headers (String array of "name:value" or Map)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlAsByteArrayUsingMultipart

        public static byte[] readUrlAsByteArrayUsingMultipart​(java.lang.String url,
                                                              java.lang.String username,
                                                              java.lang.String password,
                                                              java.util.Map<java.lang.String,​java.lang.Object> postData,
                                                              java.lang.Object headers)
                                                       throws java.lang.Exception
        Read from URL with basic HTTP authentication and multipart POST data.
        Parameters:
        url - URL to read (POST)
        username - Optional user name
        password - Optional password
        postData - Map of POST data
        headers - Optional extra headers (String array of "name:value" or Map)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlWithClientCert

        public static java.lang.String readUrlWithClientCert​(java.lang.String url,
                                                             byte[] jks,
                                                             java.lang.String passphrase)
                                                      throws java.lang.Exception
        Read from URL with client certificate authentication
        Parameters:
        url - URL to read
        jks - Optional client certificate
        passphrase - Optional client certificate passphrase
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlWithClientCert

        public static java.lang.String readUrlWithClientCert​(java.lang.String url,
                                                             byte[] jks,
                                                             java.lang.String passphrase,
                                                             java.lang.Object postData,
                                                             java.lang.Object headers,
                                                             java.lang.String encoding)
                                                      throws java.lang.Exception
        Read from URL with client certificate authentication
        Parameters:
        url - URL to read
        jks - Optional client certificate
        passphrase - Optional client certificate passphrase
        postData - Optional POST data (URL encoded String or Map)
        headers - Optional extra headers (String array of "name:value" or Map)
        encoding - Request and response encoding (converted from and to platform encoding)
        Returns:
        Full response as text, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • readUrlAsByteArrayWithClientCert

        public static byte[] readUrlAsByteArrayWithClientCert​(java.lang.String url,
                                                              byte[] jks,
                                                              java.lang.String passphrase,
                                                              java.lang.Object postData,
                                                              java.lang.Object headers,
                                                              java.lang.String encoding)
                                                       throws java.lang.Exception
        Read from URL as byte array with client certificate authentication
        Parameters:
        url - URL to read
        jks - Optional client certificate
        passphrase - Optional client certificate passphrase
        postData - Optional POST data (URL encoded String or Map)
        headers - Optional extra headers (String array of "name:value[|name:value(...)]" or Map)
        encoding - Request and response encoding (converted from and to platform encoding)
        Returns:
        Full response as byte array, or exception SocketTimeoutException, IOException, InterruptedException
        Throws:
        java.lang.Exception
      • encodeUrlParams

        public static java.lang.String encodeUrlParams​(java.util.Map<java.lang.String,​java.lang.Object> params,
                                                       java.lang.String encoding)
      • decodeUrlParams

        public static java.util.Map<java.lang.String,​java.lang.String> decodeUrlParams​(java.lang.String url,
                                                                                             java.lang.String encoding)
      • toLines

        public static java.util.List<java.lang.String> toLines​(java.io.InputStream in)
        Convert input stream as lines list
        Parameters:
        in - Input stream
      • toLines

        public static java.util.List<java.lang.String> toLines​(java.lang.String data)
        Convert string as lines list
        Parameters:
        data - String
      • toLines

        public static java.util.List<java.lang.String> toLines​(java.io.Reader data)
        Convert reader as lines list
      • simpleDiff

        public static java.lang.String simpleDiff​(byte[] data1,
                                                  byte[] data2)
        Process simple diff between 2 byte arrays
      • simpleDiff

        public static java.lang.String simpleDiff​(java.lang.String data1,
                                                  java.lang.String data2)
        Process simple diff between 2 strings
      • unifiedDiff

        public static java.lang.String unifiedDiff​(java.lang.String name1,
                                                   byte[] data1,
                                                   java.lang.String name2,
                                                   byte[] data2,
                                                   int nbContextLines)
        Process unified diff between 2 byte arrays
      • unifiedDiff

        public static java.lang.String unifiedDiff​(java.lang.String name1,
                                                   java.lang.String data1,
                                                   java.lang.String name2,
                                                   java.lang.String data2,
                                                   int nbContextLines)
        Process unified diff between 2 strings
      • parseXML

        public static void parseXML​(java.util.Map<java.lang.String,​java.lang.String> h,
                                    org.w3c.dom.Node n,
                                    java.lang.String nn)
        Recursively convert XML DOM node into a HashMap.
        Parameters:
        h - HashMap
        n - Initial DOM node
        nn - Initial node name
      • cleanXml

        @Deprecated
        public static java.lang.String cleanXml​(java.lang.String xml)
        Deprecated.
      • cleanString

        public static java.lang.String cleanString​(java.lang.String str)

        Trims and removes carriage returns and tabs from a string

        Parameters:
        str - Input string
        Returns:
        Cleaned output string
      • fixCRLF

        public static java.lang.String fixCRLF​(java.lang.String s)

        Fix CRLF problems

        Parameters:
        s - Input string
        Returns:
        Substituted string
      • getColors

        public static java.lang.String[] getColors()
      • getColor

        public static java.lang.String getColor​(int index)
        Generate a color
        Parameters:
        index - Color index
        Returns:
        a color string #RRGGBB from index modulo COLORS array length
      • getColor

        public static java.lang.String getColor​(java.lang.String value)
        Generate a color
        Parameters:
        value - A value
        Returns:
        a color string #RRGGBB
      • toColor

        public static java.awt.Color toColor​(java.lang.String color)
        Convert to color
        Parameters:
        color - #RRGGBB or RRGGBB
        Returns:
        a color
      • toColorRGB

        public static java.lang.String toColorRGB​(long color)
        Convert to color
        Parameters:
        color - A color
        Returns:
        #RRGGBB
      • randomString

        public static java.lang.String randomString​(int length)
        Generate a random string of specified length
        Parameters:
        length - Length
      • randomString

        public static java.lang.String randomString​(int length,
                                                    boolean alphanum)
        Generate a random string of specified length
        Parameters:
        length - Length
        alphanum - Alphanumeric or alphabetic?
      • randomNumber

        public static java.lang.String randomNumber​(int length)
        Generate a random integer of specified length
        Parameters:
        length - Length
      • randomInt

        public static int randomInt​(int min,
                                    int max)
        Generate a random native integer
      • randomInteger

        public static java.lang.String randomInteger​(int min,
                                                     int max)
        Generate a random integer
      • randomLong

        public static long randomLong()
        Generate a random native long integer
      • randomBool

        public static boolean randomBool()
        Generate a random native boolean
      • randomBoolean

        public static java.lang.String randomBoolean()
        Generate a random boolean
      • randomDate

        public static java.lang.String randomDate()
        Generate a random date
      • randomDate

        public static java.lang.String randomDate​(int minYear)
        Generate a random date
        Parameters:
        minYear - Minimum year
      • randomDateTime

        public static java.lang.String randomDateTime()
        Generate a random date and time
      • randomDateTime

        public static java.lang.String randomDateTime​(int minYear)
        Generate a random date and time
        Parameters:
        minYear - Minimum year
      • randomUUID

        public static java.lang.String randomUUID()
        Generate a random UUID
      • shuffle

        public static java.lang.String shuffle​(java.lang.String val)
        Shuffle a string
        Parameters:
        val - String
      • padString

        @Deprecated
        public static java.lang.String padString​(java.lang.String str,
                                                 char pad,
                                                 int length)
        Deprecated.
        Use rpad
      • rpadString

        public static java.lang.String rpadString​(java.lang.String str,
                                                  char pad,
                                                  int length)
        Right pad string with specified char to specified length
        Parameters:
        str - String to pad (can be null)
        pad - Padding character
        length - Length
      • rpad

        public static java.lang.String rpad​(java.lang.String str,
                                            char pad,
                                            int length)
        Alias to rpadString
      • lpadString

        public static java.lang.String lpadString​(java.lang.String str,
                                                  char pad,
                                                  int length)
        Left pad string with specified char to specified length
        Parameters:
        str - String to pad (can be null)
        pad - Padding character
        length - Length
      • lpad

        public static java.lang.String lpad​(java.lang.String str,
                                            char pad,
                                            int length)
        Alias to lpadString
      • format

        public static java.lang.String format​(java.lang.String fmt,
                                              java.lang.Object val)
        Format value as string
        Parameters:
        fmt - Format (see java.lang.String.format)
        val - Value to format
        Returns:
        formatted string
      • bytes2String

        @Deprecated
        public static java.lang.String bytes2String​(byte[] b)
        Deprecated.
        Use toString
      • toString

        public static java.lang.String toString​(java.lang.Object data)
        Get string representation of Java object :
        - String : returns string as is
        - Char array : returns new string from characters
        - Byte array : returns new string from bytes using platform encoding
        - Other object : returns toString of object
        Parameters:
        data - Data
      • toByteArray

        public static byte[] toByteArray​(java.lang.Object data)
        Get byte array representation from Java object:
        - Byte array : returns byte array as is
        - String : returns byte array from string using platform encoding
        - Other object : returns byte array from toString of object using platform encoding
        Parameters:
        data - Data
      • toBase64

        public static java.lang.String toBase64​(java.lang.Object data)
        Get Base64 representation of Java object
        Parameters:
        data - Data
        Returns:
        Base64 string
      • toHex

        public static java.lang.String toHex​(java.lang.Object data)
        Get hexadecimal representation of Java object
        Parameters:
        data - Data
        Returns:
        Hexadecimal string
      • hashBytes

        public static byte[] hashBytes​(java.lang.String algo,
                                       byte[] data)
        Byte array hash of byte array data
        Parameters:
        algo - Hash algorithm (null means MD5)
        data - Data
        Returns:
        Hash
      • hashString

        public static java.lang.String hashString​(java.lang.String algo,
                                                  java.lang.String data)
        Hexadeciaml hash of string
        Parameters:
        algo - Hash algorithm (null means MD5)
        data - Data
        Returns:
        Hash
      • hashCode

        public static int hashCode​(java.lang.Object... vals)
        Generate an integer hash from arguments
        Parameters:
        vals - Values to get hash from
      • hashCode

        public static int hashCode​(ObjectDB obj,
                                   java.lang.String[] row)
        Generate an integer hash from business object functional key label
        Parameters:
        obj - Business object
        row - Optional row
      • hashCode

        public static int hashCode​(Grant g)
        Generate an integer hash from business object functional key label
        Parameters:
        g - Grant
      • string2InputStream

        @Deprecated
        public static java.io.InputStream string2InputStream​(java.lang.String s,
                                                             java.lang.String charset)
        Deprecated.
        Use toInputStream
      • toInputStream

        public static java.io.InputStream toInputStream​(java.lang.String data)
        Get input stream from string using platform encoding
        Parameters:
        data - String
      • toInputStream

        public static java.io.InputStream toInputStream​(java.lang.String data,
                                                        java.lang.String encoding)
        Get input stream from string using specified encoding
        Parameters:
        data - String
        encoding - Encoding
      • bytes2InputStream

        @Deprecated
        public static java.io.InputStream bytes2InputStream​(byte[] b)
        Deprecated.
        Use toInputStream
      • toInputStream

        public static java.io.InputStream toInputStream​(byte[] data)
        Get input stream from byte array
        Parameters:
        data - bytes
        Returns:
        input stream
      • enumToArray

        public static java.lang.String[] enumToArray​(java.lang.String val)
        Convert internal multiple enumeration values into string array
        Parameters:
        val - Value in internal format
        Returns:
        String array
      • arrayToEnum

        public static java.lang.String arrayToEnum​(java.lang.String[] arr)
        Convert string array to multiple enumeration value
        Parameters:
        arr - String array
        Returns:
        Multiple enumeration value
      • toGUILabel

        @Deprecated
        public static java.lang.String toGUILabel​(java.lang.String name)
        Deprecated.
        use toLabel
      • toLabel

        public static java.lang.String toLabel​(java.lang.String name)
        Converts a logical name into a human readable label (e.g. "MyName_IsBOB" to "My name is BOB")
        Parameters:
        name -
        Returns:
        Human readable label
      • getIndexTool

        public static IndexTool getIndexTool()
        Return the index tool. USE_SEARCH_INDEX=sql (LuceneTool is deprecated)
        Returns:
        IndexSQLTool or null
      • resizeArray

        public static java.lang.Object resizeArray​(java.lang.Object oldArray,
                                                   int newSize)
        Reallocates an array with a new size, and copies the contents of the old array to the new array.
        Parameters:
        oldArray - the old array, to be reallocated.
        newSize - the new array size.
        Returns:
        A new array with the same contents.
      • clone

        public static java.lang.Object clone​(java.io.Serializable object)
        Clone thru object serialization
        Parameters:
        object - The serializable object
        Returns:
        The full copy
      • objectToBytes

        public static byte[] objectToBytes​(java.io.Serializable object)
        Object serialization
        Parameters:
        object - The serializable object
        Returns:
        binary
      • objectToFile

        public static void objectToFile​(java.io.Serializable object,
                                        java.io.File output)
        Object serialization
        Parameters:
        object - The serializable object
        output - Output file
      • bytesToObject

        public static java.lang.Object bytesToObject​(byte[] b)
        Object deserialization
        Parameters:
        b - binary object
        Returns:
        Object
      • streamToObject

        public static java.lang.Object streamToObject​(java.io.InputStream in)
        Object deserialization
        Parameters:
        in - Object stream
        Returns:
        Object
      • fileToObject

        public static java.lang.Object fileToObject​(java.io.File file)
        Object deserialization
        Parameters:
        file - File
        Returns:
        Object
      • sort

        public static void sort​(java.util.List<java.lang.String> list)
        Sort a list of strings
        Parameters:
        list - String list to sort
      • sort

        public static void sort​(java.util.List<java.lang.String> list,
                                boolean reverse)
        Sort a list of strings
        Parameters:
        list - String list to sort
        reverse - Reverse sort ?
      • sort

        public static void sort​(java.util.List<java.lang.String> list,
                                boolean ignorecase,
                                boolean reverse)
        Sort a list of strings
        Parameters:
        list - String list to sort
        ignorecase - Ignore case ?
        reverse - Reverse sort ?
      • sort

        public static void sort​(java.util.List<java.lang.String[]> list,
                                int index)
        Sort a list of string arrays
        Parameters:
        list - String array list to sort
        index - Index of column of string array to sort on
      • sort

        public static void sort​(java.util.List<java.lang.String[]> list,
                                int index,
                                boolean reverse)
        Sort a list of string arrays
        Parameters:
        list - String array list to sort
        index - Index of column of string array to sort on
        reverse - Reverse sort ?
      • sort

        public static void sort​(java.util.List<java.lang.String[]> list,
                                int index,
                                boolean ignorecase,
                                boolean reverse)
        Sort a list of string arrays
        Parameters:
        list - String array list to sort
        index - Index of column of string array to sort on
        ignorecase - Ignore case ?
        reverse - Reverse sort ?
      • extractItemFromDN

        public static java.lang.String extractItemFromDN​(java.lang.String dn,
                                                         java.lang.String name,
                                                         java.lang.String sep)
        Extract named item (e.g. "cn"") from a DN string using specified separator (e.g. ""/C=FR/ST=France/O=Simplicite Software/CN=myuser")
        Parameters:
        dn - DN
        name - Item name
        sep - Separator (defaults to "/")
        Returns:
        CN
      • fuzzyMatchScore

        public static int fuzzyMatchScore​(java.lang.String s1,
                                          java.lang.String s2)
        Get fuzzy match score
        Parameters:
        s1 - String 1
        s2 - String 2
        Returns:
        Score
      • fuzzyMatchScore

        public static int fuzzyMatchScore​(java.lang.String s1,
                                          java.lang.String s2,
                                          boolean extended)
        Get fuzzy match score
        Parameters:
        s1 - String 1
        s2 - String 2
        extended - Extended match (use exclusions and substitutions)
        Returns:
        Score