|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jet.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)
Adds 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)
Adds 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)
Checks whether the digital ID file is criterion or not. |
static boolean |
checkFileNameWithTemplate(java.lang.String fileName)
Checks if the user file name is valid for FileNameTemplate. |
static java.lang.String |
convertToAbsPath(java.io.File path,
java.io.File root)
Converts the real path of a file to the resource URL path of the report server. |
static void |
deleteDirectory(java.lang.String path)
Deletes a specific folder with all files inside (all sub-folders as well) it. |
static java.lang.String |
escapeHtmlSpecialChars(java.lang.String originalString)
Escapes special characters for HTML page. |
static boolean |
getBoolean(java.lang.String s)
Parses a boolean string to boolean. |
static boolean |
getBoolean(java.lang.String s,
boolean defVal)
Parses a boolean string to boolean. |
static java.lang.String[] |
getDateFormats()
Gets the date formats supported by DHTML, Studio and Dashboard. |
static java.lang.String |
getDefaultTimeZone()
Gets the default timezone ID. |
static java.lang.String |
getDisplayNameOfTask(java.lang.String taskClass)
Gets the display name through class names of scheduled tasks. |
static java.lang.String |
getEncodingDescriptionByName(java.lang.String strName)
Gets encoding description with specific encoding name. |
static java.lang.String |
getEncodingNameByDescription(java.lang.String strDesc)
Gets encoding name with specific description. |
static java.lang.String |
getExtName(java.lang.String file)
This method returns a file's extension. |
static java.lang.String |
getFileNameWithoutDir(java.lang.String file)
Removes a filename's path. |
static java.lang.String |
getLaunchTypeString(int launchType)
Gets the launch type of display string through the launch type of scheduled tasks. |
static java.util.Vector[] |
getLcRelatedFiles(java.lang.String folder)
Gets internal resource list of an LC object. |
static java.lang.String[] |
getLogicalFolderAndName(java.lang.String fileName)
Returns the logical folder and file name. |
static java.lang.String |
getNameWithoutExt(java.lang.String file)
Removes a filename's extension and path. |
static java.lang.String |
getNameWithoutExt(java.lang.String file,
boolean removeWholeExt)
Removes a filename's extension and path. |
static java.lang.String |
getNodeNameWithoutExt(java.lang.String name,
boolean removeWholeExt)
Removes a node name's extension. |
static java.lang.String[] |
getPathAndName(java.lang.String url)
Gets the path name and its parent path of the url path. |
static java.lang.String |
getPrincipalDisplayName(java.lang.String orgName,
java.lang.String purePrincipalName)
Returns the display name of principal. |
static java.lang.String |
getPublishRptTaskDisplayName(java.util.Hashtable ht)
Converts a class name to string that is displayed in a task type column of a schedule table. |
static java.util.Vector[] |
getRptRelatedFiles(java.lang.String folder)
Gets reports, catalogs and sub-folders in a specific folder. |
static int |
getScreenResolution()
Returns the screen resolution. |
static java.lang.String[] |
getServerDateFormats()
Gets the date formats supported by server. |
static java.lang.String[] |
getServerTimeFormats()
Gets the time formats supported by server. |
static java.lang.String |
getStackTraceString(java.lang.Throwable t)
Gets the stack trace string of a Throwable object. |
static java.lang.String[] |
getSupportedEncodingDescriptions()
Gets all supported encoding description. |
static java.lang.String[] |
getSupportedEncodingNames()
Gets all supported encoding name. |
static java.lang.String[][] |
getSupportedEncodings()
Gets all supported encoding. |
static java.lang.Object |
getTempValueFromHt(java.lang.String key)
Returns a certain object from a hashtable according to a key. |
static java.lang.String |
getTimeElapseString(long milliSeconds)
Converts milliseconds to display time. |
static java.lang.String[] |
getTimeFormats()
Gets the time formats supported by DHTML, Studio and Dashboard. |
static java.lang.String[] |
getTimestampFormats()
Gets the timestamp formats supported by DHTML, Studio and Dashboard. |
static java.lang.String |
getVirtualResourcePathPrefix(java.lang.String orgName)
return virtual resource path prefix according to input organization name. |
static int[] |
getYearMonthDate(java.util.Date dt)
|
static boolean |
isBelongToOrganization(java.lang.String principalName)
Check pricipal belongs to a organization or not according to principal name |
static boolean |
isCatalogFile(java.lang.String file)
Judges if the file is a catalog file. |
static boolean |
isLCFile(java.lang.String file)
Judges if the file is an LC file. |
static boolean |
isLCResource(java.lang.String resourcePath)
Checks if the specified server resource path is an LC resource path. |
static boolean |
isReportFile(java.lang.String file)
Judges if the file is a report file. |
static boolean |
isValidEmailAddress(java.lang.String address)
Checks if the input string is a valild e-mail address. |
static boolean |
isValidFormat(java.lang.String format)
Check whether a date/time format is valid. |
static boolean |
isValidNodeName(java.lang.String name)
Checks if the input string is a valid node name. |
static java.util.Properties |
makeMailProperty(java.util.Properties propMail,
boolean isNormalMail)
Makes APIConst.TAG_JRMAIL or APIConst.TAG_CSMAIL property field by properties of an E-Mail. |
static double |
parseDouble(java.lang.String str,
double f)
Parses a double string to double. |
static int |
parseInt(java.lang.String str)
Parses an integer string to int. |
static int |
parseInt(java.lang.String str,
int defVal)
Parses an integer string to int. |
static long |
parseLong(java.lang.String str)
Parses an integer string to long. |
static long |
parseLong(java.lang.String str,
int defVal)
Parses a long integer string to long. |
static long |
parseLong(java.lang.String str,
long defVal)
Parses a long integer string to long. |
static java.util.Hashtable |
parseParamValues(java.io.InputStream input)
Parses parameters from a parameter file input stream. |
static java.lang.String[] |
parsePrincipalDisplayName(java.lang.String principalDisplayName)
Parses principal display name to organization name & principal name. |
static java.util.Properties |
parseQuery(java.lang.String query)
Parses an HTTP query string into a Properties object. |
static java.lang.String[] |
parseVirtualResourcePath(java.lang.String path)
Parses virtual resource path to organization name & resource path. |
static void |
putTempValueToHt(java.lang.String key,
java.lang.String value)
Puts a certain value to a temp hashtable. |
static java.lang.String |
removeExtName(java.lang.String file)
Removes a filename's extension. |
static void |
removeTempValueInHt(java.lang.String key)
Removes a certain value in a temp hashtable. |
static java.lang.String[][] |
sortAsCol(java.lang.String[][] dataTable,
int colIndex,
int SDirection)
Sorts the objects in String Array based on the special column which does not judge capital and lower. |
static java.util.Vector |
sortAsCol(java.util.Vector vectorOfObject,
java.util.Vector vectorOfColString,
boolean sortDirection)
Sorts the objects in vector based on the special column which does not judge capital and lower. |
static java.lang.String |
toDateTimeString(java.util.Date dt,
java.util.TimeZone tz)
Converts a Date object to string with the format "EEE MMM d HH:mm:ss z yyyy". |
static java.lang.String |
toSortableWinDateString(java.util.Date date)
Converts a Date object to Windows style date string with the format "MM'/'dd'/'yy HH:mm". |
static java.lang.String |
toWinDateSecondString(java.util.Date date)
Converts a Date object to Windows style date string with the format "MM/dd/yy h:mm:ss a". |
static java.lang.String |
toWinDateString(java.util.Date date)
Converts a Date object to Windows style date string with the format "MM/dd/yy h:mm a". |
static java.lang.String |
toWinDateStringShowing(java.util.Date date)
Converts a Date object to Windows style date string with the format "MMM dd, yyyy". |
static void |
transferJRMailProperties(java.util.Properties propMail)
Deprecated. |
static java.lang.String |
VectorToURLEncodedString(java.util.Vector v)
Gets the HTTP query string from a Vector. |
static java.lang.String |
writeFileToString(java.io.File strFile)
Reads a file content and returns the 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 integer string.
public static int parseInt(java.lang.String str, int defVal)
str
- The integer 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 integer string.defVal
- The default int value.
public static long parseLong(java.lang.String str, long defVal)
str
- The long integer string.defVal
- The default long value.
public static double parseDouble(java.lang.String str, double f)
str
- The double string.defVal
- The default double value.
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 elapsed 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 an e-mail.public static java.util.Properties makeMailProperty(java.util.Properties propMail, boolean isNormalMail)
propMail
- The properties of an e-mail.isNormalMail
- Specifies if it 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)
strDesc
- the encoding description.
public static java.lang.String getEncodingDescriptionByName(java.lang.String strName)
strName
- the encoding name.
public static java.lang.String getExtName(java.lang.String file)
file
- String of the source file name.
public static java.lang.String removeExtName(java.lang.String file)
file
- String of the source file name.
public static java.lang.String getNameWithoutExt(java.lang.String file)
file
- String of the source file name.
public static java.lang.String getNameWithoutExt(java.lang.String file, boolean removeWholeExt)
file
- String of the source file name.removeWholeExt
- For some recognized file type, if the value is true,
removes the whole extension, otherwise removes the extension after the last dot.
For example, test.cat.xml. If the value is true, returns test; if the value is false,
returns test.cat.
public static java.lang.String getNodeNameWithoutExt(java.lang.String name, boolean removeWholeExt)
name
- String of the node name.removeWholeExt
- For some recognized file type, if the value is true,
removes the whole extension, otherwise removes the extension after the last dot.
For example, test.cat.xml. If the value is true, returns test; if the value is false,
returns test.cat.
public static java.lang.String getFileNameWithoutDir(java.lang.String file)
file
- String of the 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
- The vector of the sorting object.vectorOfColString
- The vector of the column which is sorted as.sortDirection
- The direction of the sorting. False is ascending; true is descending.
public static java.lang.String[][] sortAsCol(java.lang.String[][] dataTable, int colIndex, int SDirection)
dataTable
- The array of the sorting object.colIndex
- The number of the column which is sorted as.SDirection
- The direction of the sorting. 0 is ascending; 1 is descending.
public static java.lang.String getPublishRptTaskDisplayName(java.util.Hashtable ht)
ht
- Properties of tasks.
public static boolean isValidEmailAddress(java.lang.String address)
address
- The input string to be tested.
public static boolean isValidNodeName(java.lang.String name)
name
- The 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.SecurityException
public static java.util.Vector[] getLcRelatedFiles(java.lang.String folder) throws java.lang.Exception
folder
- The file path of LC.
java.lang.Exception
public 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 boolean isLCFile(java.lang.String file)
file
- The full path of the file.
public static java.lang.String[] getLogicalFolderAndName(java.lang.String fileName)
the
- specific file name.
public static void putTempValueToHt(java.lang.String key, java.lang.String value)
key
- The key.value
- The certain value.public 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 input stream of the digital ID file .password
- The digital id file open password.
public static int getScreenResolution()
public static boolean isLCResource(java.lang.String resourcePath)
resourcePath
- The specified server resource path.
public static java.lang.String[] getServerDateFormats()
public static java.lang.String[] getServerTimeFormats()
public static java.lang.String[] getDateFormats()
public static java.lang.String[] getTimeFormats()
public static java.lang.String[] getTimestampFormats()
public static boolean isValidFormat(java.lang.String format)
public static java.lang.String[] parsePrincipalDisplayName(java.lang.String principalDisplayName)
principalDisplayName
- the user|role|group dispaly name, for example: orgname\userName
public static boolean isBelongToOrganization(java.lang.String principalName)
principalName
- the user|role|group dispaly name, for example: orgname\userName
public static java.lang.String getPrincipalDisplayName(java.lang.String orgName, java.lang.String purePrincipalName)
orgName
- purePrincipalName
-
orgName\purePrincipalName
, otherwise return purePrincipalName
public static java.lang.String getVirtualResourcePathPrefix(java.lang.String orgName)
orgName
-
/<orgName>
public static java.lang.String[] parseVirtualResourcePath(java.lang.String path)
path
- the virtual resource path, for example: <org1>/folder1
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |