jet.cs.util
Class APIUtil

java.lang.Object
  extended by jet.cs.util.APIUtil

public class APIUtil
extends java.lang.Object

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 int[] getYearMonthDate(java.util.Date dt)
           
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 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

parseInt

public static int parseInt(java.lang.String str)
Parses an integer string to int. The default value is -1.

Parameters:
str - The integer string.
Returns:
the int value. The default value is -1.

parseInt

public static int parseInt(java.lang.String str,
                           int defVal)
Parses an integer string to int.

Parameters:
str - The integer string.
defVal - The default int value.
Returns:
the int value.

parseLong

public static long parseLong(java.lang.String str)
Parses an integer string to long. The default value is -1L.

Parameters:
str - The long integer string.
Returns:
the long value. The default value is -1L.

parseLong

public static long parseLong(java.lang.String str,
                             int defVal)
Parses a long integer string to long.

Parameters:
str - The long integer string.
defVal - The default int value.
Returns:
the long value.

parseLong

public static long parseLong(java.lang.String str,
                             long defVal)
Parses a long integer string to long.

Parameters:
str - The long integer string.
defVal - The default long value.
Returns:
the long value.

parseDouble

public static double parseDouble(java.lang.String str,
                                 double f)
Parses a double string to double.

Parameters:
str - The double string.
defVal - The default double value.
Returns:
the double value.

getBoolean

public static boolean getBoolean(java.lang.String s)
Parses a boolean string to boolean. The default value is false.

Parameters:
s - The boolean string.
Returns:
the boolean value. The default value is false.

getBoolean

public static boolean getBoolean(java.lang.String s,
                                 boolean defVal)
Parses a boolean string to boolean.

Parameters:
s - The boolean string.
defVal - The default boolean value.
Returns:
the boolean value.

getDefaultTimeZone

public static java.lang.String getDefaultTimeZone()
Gets the default timezone ID.

Returns:
the default timezone ID.

getStackTraceString

public static java.lang.String getStackTraceString(java.lang.Throwable t)
Gets the stack trace string of a Throwable object.

Parameters:
t - The Throwable object.
Returns:
the stack trace string of a Throwable object.

toDateTimeString

public 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".

Parameters:
dt - The Date object.
tz - The timezone.
Returns:
the string with the format "EEE MMM d HH:mm:ss z yyyy".

toWinDateString

public 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".

Parameters:
date - The Date object.
Returns:
the Windows style date string with the format "MM/dd/yy h:mm a".

toSortableWinDateString

public 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".

Parameters:
date - The Date object.
Returns:
the Windows style date string with the format "MM'/'dd'/'yy HH:mm".

toWinDateStringShowing

public static java.lang.String toWinDateStringShowing(java.util.Date date)
Converts a Date object to Windows style date string with the format "MMM dd, yyyy".

Parameters:
date - The Date object.
Returns:
the Windows style date string with the format "MMM dd, yyyy".

toWinDateSecondString

public 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".

Parameters:
date - The Date object.
Returns:
the Windows style date string with the format "MM/dd/yy h:mm:ss a".

getTimeElapseString

public static java.lang.String getTimeElapseString(long milliSeconds)
Converts milliseconds to display time. For example, converts 170543milliseconds to 2'50".

Parameters:
milliSeconds - The time elapsed in milliseconds.
Returns:
the time string. For example, converts 170000milliseconds to 2'50".

getLaunchTypeString

public static java.lang.String getLaunchTypeString(int launchType)
Gets the launch type of display string through the launch type of scheduled tasks.

Parameters:
launchType - The launch type of scheduled tasks.
Returns:
the launch type of display string with the launch type of scheduled tasks.

getDisplayNameOfTask

public static java.lang.String getDisplayNameOfTask(java.lang.String taskClass)
Gets the display name through class names of scheduled tasks.

Parameters:
taskClass - The class name of scheduled tasks.
Returns:
the display name through the class name of scheduled tasks.

parseParamValues

public static java.util.Hashtable parseParamValues(java.io.InputStream input)
                                            throws java.io.IOException
Parses parameters from a parameter file input stream.

Parameters:
input - The parameter file input stream.
Returns:
the parameters. Keys are parameter names. Values are parameter values.
Throws:
java.io.IOException - if an IOException occurs.

addUrlPath

public 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.

Parameters:
path1 - The path string.
path2 - The path that will be appended to the path1.
Returns:
add the path to the path string and the result path is non-URL-encoded.

addUrlPaths

public 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.

Parameters:
path1 - The URL address string.
path2 - The path that will be appended to the URL address.
Returns:
add the path to the URL address string and the result URL string is URL-encoded.

convertToAbsPath

public 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. For example, if the file is "c:\JREntServer\jreport\SunVMDemo\SunVMDemo.cat" and the server root dir is "c:\JREntServer\jreport", then the method returns "/SunVMDemo/SunVMDemo.cat".

Parameters:
path - The file.
root - The server root dir.
Returns:
the resource URL path of the file in the report server.

getPathAndName

public static java.lang.String[] getPathAndName(java.lang.String url)
Gets the path name and its parent path of the url path. For example, the url path is "/SunVMDemo/SunVMDemo.cat". Then the String[0] is "/SunVMDemo/", and the String[0] is "SunVMDemo.cat".

Parameters:
url - The URL path.
Returns:
the path name(String[1]) and its parent path(String[0]) of the url path.

VectorToURLEncodedString

public static java.lang.String VectorToURLEncodedString(java.util.Vector v)
Gets the HTTP query string from a Vector. For example, the Vector is {"string1", "string2"}. Then returns string1&string2.

Parameters:
v - The Vector.
Returns:
the HTTP query string.

transferJRMailProperties

public static void transferJRMailProperties(java.util.Properties propMail)
Deprecated. 

Transfers properties of an E-Mail to JRMail property field.

Parameters:
propMail - The properties of an e-mail.

makeMailProperty

public 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.

Parameters:
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).
Returns:
the properties of an e-mail.

getSupportedEncodings

public static java.lang.String[][] getSupportedEncodings()
Gets all supported encoding.

Returns:
all supported encoding.

getSupportedEncodingNames

public static java.lang.String[] getSupportedEncodingNames()
Gets all supported encoding name.

Returns:
all supported encoding name.

getSupportedEncodingDescriptions

public static java.lang.String[] getSupportedEncodingDescriptions()
Gets all supported encoding description.

Returns:
all supported encoding description.

getEncodingNameByDescription

public static java.lang.String getEncodingNameByDescription(java.lang.String strDesc)
Gets encoding name with specific description.

Parameters:
strDesc - the encoding description.
Returns:
the specific encoding name.

getEncodingDescriptionByName

public static java.lang.String getEncodingDescriptionByName(java.lang.String strName)
Gets encoding description with specific encoding name.

Parameters:
strName - the encoding name.
Returns:
the encoding description.

getExtName

public static java.lang.String getExtName(java.lang.String file)
This method returns a file's extension.

Parameters:
file - String of the source file name.
Returns:
the file's extension.

removeExtName

public static java.lang.String removeExtName(java.lang.String file)
Removes a filename's extension.

Parameters:
file - String of the source file name.
Returns:
filename string that removes the extension.

getNameWithoutExt

public static java.lang.String getNameWithoutExt(java.lang.String file)
Removes a filename's extension and path.

Parameters:
file - String of the source file name.
Returns:
filename string that removes the extension and path.

getNameWithoutExt

public static java.lang.String getNameWithoutExt(java.lang.String file,
                                                 boolean removeWholeExt)
Removes a filename's extension and path.

Parameters:
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.
Returns:
filename string that removes the extension and path.

getNodeNameWithoutExt

public static java.lang.String getNodeNameWithoutExt(java.lang.String name,
                                                     boolean removeWholeExt)
Removes a node name's extension.

Parameters:
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.
Returns:
node name string that removes the extension.

getFileNameWithoutDir

public static java.lang.String getFileNameWithoutDir(java.lang.String file)
Removes a filename's path.

Parameters:
file - String of the source file name.
Returns:
filename string that removes the path.

checkFileNameWithTemplate

public static boolean checkFileNameWithTemplate(java.lang.String fileName)
Checks if the user file name is valid for FileNameTemplate.

Parameters:
fileName - The user file name.
Returns:
the Boolean value. The default value is false.

writeFileToString

public static java.lang.String writeFileToString(java.io.File strFile)
Reads a file content and returns the content string.

Parameters:
strFile - The file is read.
Returns:
the String of the content of the file.

parseQuery

public static java.util.Properties parseQuery(java.lang.String query)
Parses an HTTP query string into a Properties object.

Parameters:
query - The HTTP query string.
Returns:
the Properties object that contains the parameter values in the HTTP query string.

escapeHtmlSpecialChars

public static java.lang.String escapeHtmlSpecialChars(java.lang.String originalString)
Escapes special characters for HTML page.
                "&" to represent the & sign. 
                "<" to represent the < sign. 
                ">" to represent the > sign. 
                "" to represent the " mark. 
      

Parameters:
originalString - Original string.
Returns:
escaped string.

sortAsCol

public 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.

Parameters:
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.
Returns:
the vector in which the object has been sorted.

sortAsCol

public 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.

Parameters:
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.
Returns:
the String Array in which the object has been sorted.

getPublishRptTaskDisplayName

public 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.

Parameters:
ht - Properties of tasks.
Returns:
string that is displayed in the task type column of the schedule table.

isValidEmailAddress

public static boolean isValidEmailAddress(java.lang.String address)
Checks if the input string is a valild e-mail address.

Parameters:
address - The input string to be tested.
Returns:
true if the input string is a valid e-mail address, otherwise false.

isValidNodeName

public static boolean isValidNodeName(java.lang.String name)
Checks if the input string is a valid node name.

Parameters:
name - The string to be tested.
Returns:
true if the input string is a valid node name, otherwise false. A valid node name contains char '0' to '9', 'a' to 'z', 'A' to 'Z', white space, '_', '-', '.', '(', and ')', and the maximum length is 256 bytes.

getYearMonthDate

public static int[] getYearMonthDate(java.util.Date dt)

deleteDirectory

public static void deleteDirectory(java.lang.String path)
                            throws java.lang.SecurityException
Deletes a specific folder with all files inside (all sub-folders as well) it.

Parameters:
path - The full path of the file or folder which will be deleted.
Throws:
java.lang.SecurityException

getRptRelatedFiles

public static java.util.Vector[] getRptRelatedFiles(java.lang.String folder)
                                             throws java.lang.SecurityException
Gets reports, catalogs and sub-folders in a specific folder.

Parameters:
folder - The full path of the folder.
Returns:
an array that contains three Vectors. Vector[0]: all reports in the folder. Vector[1]: all catalogs in the folder. Vector[2]: all sub-folders in the folder.
Throws:
java.lang.SecurityException

getLcRelatedFiles

public static java.util.Vector[] getLcRelatedFiles(java.lang.String folder)
                                            throws java.lang.Exception
Gets internal resource list of an LC object.

Parameters:
folder - The file path of LC.
Returns:
java.util.List :
Throws:
java.lang.Exception

isReportFile

public static boolean isReportFile(java.lang.String file)
Judges if the file is a report file.

Parameters:
file - The full path of the file.
Returns:
true if the file is report file, otherwise returns false.

isCatalogFile

public static boolean isCatalogFile(java.lang.String file)
Judges if the file is a catalog file.

Parameters:
file - The full path of the file.
Returns:
true if the file is catalog file, otherwise returns false.

isLCFile

public static boolean isLCFile(java.lang.String file)
Judges if the file is an LC file.

Parameters:
file - The full path of the file.
Returns:
true if the file is LC file, otherwise returns false.

getLogicalFolderAndName

public static java.lang.String[] getLogicalFolderAndName(java.lang.String fileName)
Returns the logical folder and file name.

Parameters:
the - specific file name.
Returns:
the logical folder and file name.

putTempValueToHt

public static void putTempValueToHt(java.lang.String key,
                                    java.lang.String value)
Puts a certain value to a temp hashtable.

Parameters:
key - The key.
value - The certain value.

getTempValueFromHt

public static java.lang.Object getTempValueFromHt(java.lang.String key)
Returns a certain object from a hashtable according to a key.

Parameters:
key - The key.
Returns:
object in the hashtable.

removeTempValueInHt

public static void removeTempValueInHt(java.lang.String key)
Removes a certain value in a temp hashtable.

Parameters:
key - The key.

checkDigitalIDFileAndPassword

public static java.lang.String checkDigitalIDFileAndPassword(java.io.InputStream digitalID,
                                                             java.lang.String password)
Checks whether the digital ID file is criterion or not.

Parameters:
digitalID - The input stream of the digital ID file .
password - The digital id file open password.
Returns:
the string about the check result message.

getScreenResolution

public static int getScreenResolution()
Returns the screen resolution.

Returns:
the screen resolution.

isLCResource

public static boolean isLCResource(java.lang.String resourcePath)
Checks if the specified server resource path is an LC resource path.

Parameters:
resourcePath - The specified server resource path.
Returns:
true if the resource path is an LC resource path, otherwise returns false.

getServerDateFormats

public static java.lang.String[] getServerDateFormats()
Gets the date formats supported by server.

Returns:
A string array, which contained all date formats supported by server.

getServerTimeFormats

public static java.lang.String[] getServerTimeFormats()
Gets the time formats supported by server.

Returns:
A string array, which contained all time formats supported by server.

getDateFormats

public static java.lang.String[] getDateFormats()
Gets the date formats supported by DHTML, Studio and Dashboard.

Returns:
A string array, which contained all date formats supported by DHTML, Studio and Dashboard.

getTimeFormats

public static java.lang.String[] getTimeFormats()
Gets the time formats supported by DHTML, Studio and Dashboard.

Returns:
A string array, which contained all time formats supported by DHTML, Studio and Dashboard.

getTimestampFormats

public static java.lang.String[] getTimestampFormats()
Gets the timestamp formats supported by DHTML, Studio and Dashboard.

Returns:
A string array, which contained all timestamp formats supported by DHTML, Studio and Dashboard.

isValidFormat

public static boolean isValidFormat(java.lang.String format)
Check whether a date/time format is valid.

Returns:
A boolean flag, true indicate the format is valid, otherwise is invalid.

parsePrincipalDisplayName

public static java.lang.String[] parsePrincipalDisplayName(java.lang.String principalDisplayName)
Parses principal display name to organization name & principal name.

Parameters:
principalDisplayName - the user|role|group dispaly name, for example: orgname\userName
Returns:
array of String. [0]: the organization name, [1]: the princinpal name with organization name prefix.

getPrincipalDisplayName

public static java.lang.String getPrincipalDisplayName(java.lang.String orgName,
                                                       java.lang.String purePrincipalName)
Returns the display name of principal.

Parameters:
orgName -
purePrincipalName -
Returns:
if the orgName is not empty orgName\purePrincipalName, otherwise return purePrincipalName