|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjet.cs.util.APIUtil
public class APIUtil
Class APIUtil provides some utilities for JReport server and client.
| Method Summary | |
|---|---|
static java.lang.String |
addUrlPath(java.lang.String path1,
java.lang.String path2)
Add a path to a path string and the result path string is non-URL-encoded. |
static java.lang.String |
addUrlPaths(java.lang.String path1,
java.lang.String path2)
Add a path to a URL address string and the result URL string is URL-encoded. |
static java.lang.String |
checkDigitalIDFileAndPassword(java.io.InputStream digitalID,
java.lang.String password)
check the digital ID file is criterion or not. |
static boolean |
checkFileNameWithTemplate(java.lang.String fileName)
check the user file name is valid for FileNameTemplate |
static java.lang.String |
convertToAbsPath(java.io.File path,
java.io.File root)
Convert the real path of a file to the resource URL path of the report server. |
static void |
deleteDirectory(java.lang.String path)
delete a specific folder with all files inside (all sub-folders as well). |
static java.lang.String |
escapeHtmlSpecialChars(java.lang.String originalString)
Escape special characters for HTML page. |
static boolean |
getBoolean(java.lang.String s)
parse a boolean string to boolean. |
static boolean |
getBoolean(java.lang.String s,
boolean defVal)
parse a boolean string to boolean. |
static java.lang.String |
getDefaultTimeZone()
Get the default timezone ID. |
static java.lang.String |
getDisplayNameOfTask(java.lang.String taskClass)
Get the display name through class names of scheduled tasks. |
static java.lang.String |
getEncodingDescriptionByName(java.lang.String strName)
|
static java.lang.String |
getEncodingNameByDescription(java.lang.String strDesc)
|
static java.lang.String |
getExtName(java.lang.String file)
This method return file's extension |
static java.lang.String |
getFileNameWithoutDir(java.lang.String file)
Remove a filename's path |
static java.lang.String |
getLaunchTypeString(int launchType)
Get the launch type of display string through the launch type of scheduled tasks. |
static java.lang.String[] |
getLogicalFolderAndName(java.lang.String fileName)
return logical folder and file name |
static java.lang.String |
getNameWithoutExt(java.lang.String file)
Remove a filename's extension and path |
static java.lang.String |
getNameWithoutExt(java.lang.String file,
boolean removeWholeExt)
Remove a filename's extension and path |
static java.lang.String |
getNodeNameWithoutExt(java.lang.String name,
boolean removeWholeExt)
Remove a node name's extension |
static java.lang.String[] |
getPathAndName(java.lang.String url)
Get the path name and its parent path of the url path. |
static java.lang.String |
getPublishRptTaskDisplayName(java.util.Hashtable ht)
Converts class name to string displays in task type column of schedule table. |
static java.util.Vector[] |
getRptRelatedFiles(java.lang.String folder)
get reports, catalogs and sub-folders in a specific folder. |
static int |
getScreenResolution()
|
static java.lang.String |
getStackTraceString(java.lang.Throwable t)
Get the stack trace string of a Throwable object. |
static java.lang.String[] |
getSupportedEncodingDescriptions()
|
static java.lang.String[] |
getSupportedEncodingNames()
|
static java.lang.String[][] |
getSupportedEncodings()
|
static java.lang.Object |
getTempValueFromHt(java.lang.String key)
return a certain object from hashtable according to a key |
static java.lang.String |
getTimeElapseString(long milliSeconds)
Convert milliseconds to display time. |
static int[] |
getYearMonthDate(java.util.Date dt)
|
static boolean |
isCatalogFile(java.lang.String file)
judge if the file is catalog file. |
static boolean |
isReportFile(java.lang.String file)
judge if the file is report file. |
static boolean |
isValidEmailAddress(java.lang.String address)
Check if input string is a valild email address |
static boolean |
isValidNodeName(java.lang.String name)
Check if input string is a valid node name |
static java.util.Properties |
makeMailProperty(java.util.Properties propMail,
boolean isNormalMail)
Make APIConst.TAG_JRMAIL or APIConst.TAG_CSMAIL property field by properties of an E-Mail. |
static int |
parseInt(java.lang.String str)
parse an interger string to int. |
static int |
parseInt(java.lang.String str,
int defVal)
parse an interger string to int. |
static long |
parseLong(java.lang.String str)
parse an interger string to long. |
static long |
parseLong(java.lang.String str,
int defVal)
parse a long interger string to long. |
static long |
parseLong(java.lang.String str,
long defVal)
|
static java.util.Hashtable |
parseParamValues(java.io.InputStream input)
Parse parameters from a parameter file input stream. |
static java.util.Properties |
parseQuery(java.lang.String query)
Parse a HTTP query string into a Properties object. |
static void |
putTempValueToHt(java.lang.String key,
java.lang.String value)
put a certain value to temp hashtable |
static java.lang.String |
removeExtName(java.lang.String file)
Remove a filename's extension |
static void |
removeTempValueInHt(java.lang.String key)
remove a certain value in temp hashtable |
static java.lang.String[][] |
sortAsCol(java.lang.String[][] dataTable,
int colIndex,
int SDirection)
Sort the objects in String Array based as the special column which not judge capital and lower |
static java.util.Vector |
sortAsCol(java.util.Vector vectorOfObject,
java.util.Vector vectorOfColString,
boolean sortDirection)
Sort the objects in vector based as the special column which not judge capital and lower |
static java.lang.String |
toDateTimeString(java.util.Date dt,
java.util.TimeZone tz)
Convert a Date object to string with format "EEE MMM d HH:mm:ss z yyyy". |
static java.lang.String |
toSortableWinDateString(java.util.Date date)
Convert a Date object to Windows style date string with format "MM'/'dd'/'yy HH:mm". |
static java.lang.String |
toWinDateSecondString(java.util.Date date)
Convert a Date object to Windows style date string with format "MM/dd/yy h:mm:ss a". |
static java.lang.String |
toWinDateString(java.util.Date date)
Convert a Date object to Windows style date string with format "MM/dd/yy h:mm a". |
static java.lang.String |
toWinDateStringShowing(java.util.Date date)
Convert a Date object to Windows style date string with format "MMM dd, yyyy". |
static void |
transferJRMailProperties(java.util.Properties propMail)
Deprecated. |
static java.lang.String |
VectorToURLEncodedString(java.util.Vector v)
Get the HTTP query string from a Vector. |
static java.lang.String |
writeFileToString(java.io.File strFile)
read a file content and return content string |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int parseInt(java.lang.String str)
str - the interger string.
public static int parseInt(java.lang.String str,
int defVal)
str - the interger string.defVal - the default int value.
public static long parseLong(java.lang.String str)
str - the long integer string.
public static long parseLong(java.lang.String str,
int defVal)
str - the long interger string.defVal - the default long value.
public static long parseLong(java.lang.String str,
long defVal)
public static boolean getBoolean(java.lang.String s)
s - the boolean string.
public static boolean getBoolean(java.lang.String s,
boolean defVal)
s - the boolean string.defVal - the default boolean value.
public static java.lang.String getDefaultTimeZone()
public static java.lang.String getStackTraceString(java.lang.Throwable t)
t - the Throwable object.
public static java.lang.String toDateTimeString(java.util.Date dt,
java.util.TimeZone tz)
dt - the Date object.tz - the timezone.
public static java.lang.String toWinDateString(java.util.Date date)
date - the Date object.
public static java.lang.String toSortableWinDateString(java.util.Date date)
date - the Date object.
public static java.lang.String toWinDateStringShowing(java.util.Date date)
date - the Date object.
public static java.lang.String toWinDateSecondString(java.util.Date date)
date - the Date object.
public static java.lang.String getTimeElapseString(long milliSeconds)
milliSeconds - the time elapse in milliseconds.
public static java.lang.String getLaunchTypeString(int launchType)
launchType - the launch type of scheduled tasks.
public static java.lang.String getDisplayNameOfTask(java.lang.String taskClass)
taskClass - the class name of scheduled tasks.
public static java.util.Hashtable parseParamValues(java.io.InputStream input)
throws java.io.IOException
input - the parameter file input stream.
java.io.IOException - if an IOException occurs.
public static java.lang.String addUrlPath(java.lang.String path1,
java.lang.String path2)
path1 - the path string.path2 - the path that will be appended to the path1.
public static java.lang.String addUrlPaths(java.lang.String path1,
java.lang.String path2)
path1 - the URL address string.path2 - the path that will be appended to the URL address.
public static java.lang.String convertToAbsPath(java.io.File path,
java.io.File root)
path - the file.root - the server root dir.
public static java.lang.String[] getPathAndName(java.lang.String url)
url - the URL path.
public static java.lang.String VectorToURLEncodedString(java.util.Vector v)
v - the Vector.
public static void transferJRMailProperties(java.util.Properties propMail)
propMail - the properties of a e-mail.
public static java.util.Properties makeMailProperty(java.util.Properties propMail,
boolean isNormalMail)
propMail - the properties of a e-mail.isNormalMail - Is a normal e-mail(false: using APIConst.TAG_JRMAIL; true: using APIConst.TAG_CSMAIL).
public static java.lang.String[][] getSupportedEncodings()
public static java.lang.String[] getSupportedEncodingNames()
public static java.lang.String[] getSupportedEncodingDescriptions()
public static java.lang.String getEncodingNameByDescription(java.lang.String strDesc)
public static java.lang.String getEncodingDescriptionByName(java.lang.String strName)
public static java.lang.String getExtName(java.lang.String file)
file - string of source file name
public static java.lang.String removeExtName(java.lang.String file)
file - string of source file name
public static java.lang.String getNameWithoutExt(java.lang.String file)
file - string of source file name
public static java.lang.String getNameWithoutExt(java.lang.String file,
boolean removeWholeExt)
file - string of source file nameremoveWholeExt - for some recognized file type, if value is true,
remove whole extension, otherwise remove extension after the last dot.
For example: test.cat.xml, if value is true, return test, if valude is false,
return test.cat.
public static java.lang.String getNodeNameWithoutExt(java.lang.String name,
boolean removeWholeExt)
name - string of node nameremoveWholeExt - for some recognized file type, if value is true,
remove whole extension, otherwise remove extension after the last dot.
For example: test.cat.xml, if value is true, return test, if valude is false,
return test.cat.
public static java.lang.String getFileNameWithoutDir(java.lang.String file)
file - string of source file name
public static boolean checkFileNameWithTemplate(java.lang.String fileName)
fileName - the user file name.
public static java.lang.String writeFileToString(java.io.File strFile)
strFile - the file is read.
public static java.util.Properties parseQuery(java.lang.String query)
query - the HTTP query string.
public static java.lang.String escapeHtmlSpecialChars(java.lang.String originalString)
"&" to represent the & sign.
"<" to represent the < sign.
">" to represent the > sign.
"" to represent the " mark.
originalString - original string
public static java.util.Vector sortAsCol(java.util.Vector vectorOfObject,
java.util.Vector vectorOfColString,
boolean sortDirection)
vectorOfObject - is the vector of sorting Object.vectorOfColString - is the vector of column which sorting as.sortDirection - is the direction of sorting, false is asending,true is disasending.
public static java.lang.String[][] sortAsCol(java.lang.String[][] dataTable,
int colIndex,
int SDirection)
dataTable - is the array of sorting Object.colIndex - is the number of column which sorting as.SDirection - is the direction of sorting, 0 is asending,1 is disasending.
public static java.lang.String getPublishRptTaskDisplayName(java.util.Hashtable ht)
ht - is properties of tasks
public static boolean isValidEmailAddress(java.lang.String address)
address - input string to be tested
public static boolean isValidNodeName(java.lang.String name)
name - string to be tested
public static int[] getYearMonthDate(java.util.Date dt)
public static void deleteDirectory(java.lang.String path)
throws java.lang.SecurityException
path - the full path of the file or folder which will be deleted.
java.lang.SecurityException
public static java.util.Vector[] getRptRelatedFiles(java.lang.String folder)
throws java.lang.SecurityException
folder - the full path of the folder.
java.lang.SecurityExceptionpublic static boolean isReportFile(java.lang.String file)
file - the full path of the file.
public static boolean isCatalogFile(java.lang.String file)
file - the full path of the file.
public static java.lang.String[] getLogicalFolderAndName(java.lang.String fileName)
public static void putTempValueToHt(java.lang.String key,
java.lang.String value)
key - the keyvalue - the certain valuepublic static java.lang.Object getTempValueFromHt(java.lang.String key)
key - the key
public static void removeTempValueInHt(java.lang.String key)
key - the key
public static java.lang.String checkDigitalIDFileAndPassword(java.io.InputStream digitalID,
java.lang.String password)
digitalID - the inputstream of digital ID filepassword - the digital id file open password
public static int getScreenResolution()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||