|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.internet2.middleware.grouper.ui.util.GrouperUiUtils
public class GrouperUiUtils
utility methods for grouper
Field Summary | |
---|---|
static File |
classFileDir
class file dir cached |
static String |
DHTMLX_OPTIONS_END
dhtmlx option end of xml |
static String |
DHTMLX_OPTIONS_START
dhtmlx option start of xml |
static String[] |
HTML_REPLACE
array for converting HTML to string |
static String[] |
HTML_REPLACE_NO_SINGLE
array for converting HTML to string |
static String[] |
HTML_SEARCH_NO_SINGLE
array for converting HTML to string |
static Pattern |
subjectPattern
pattern of a subject: sourceId||||subjectId (slashes escape the pipes) |
Constructor Summary | |
---|---|
GrouperUiUtils()
|
Method Summary | ||
---|---|---|
static void |
appendErrorToRequest(String error)
append an error to the request, will be logged and maybe emailed to admins |
|
static String |
booleanToStringOneChar(Boolean theBoolean)
convert a boolean to a T or F |
|
static File |
classFileDir()
get the class file dir |
|
static ClassLoader |
classLoader()
fast class loader |
|
static
|
cloneShallow(T object)
clone a collection, shallow, do not clone all objects inside |
|
static int |
compare(String a,
String b,
boolean ignoreCase)
|
|
static URL |
computeUrl(String resourceName,
boolean canBeNull)
compute a url of a resource |
|
static String |
convertJspToString(String jspName)
convert a jsp to string. |
|
static String |
convertLongToChar(long theLong)
this method takes a long (less than 62) and converts it to a 1 character string (a-z, A-Z, 0-9) |
|
static String |
convertLongToCharSmall(long theLong)
this method takes a long (less than 36) and converts it to a 1 character string (A-Z, 0-9) |
|
static String |
convertLongToString(long theLong)
convert a long to a string by converting it to base 62 (26 lower, 26 upper, 10 digits) |
|
static String |
convertLongToStringSmall(long theLong)
convert a long to a string by converting it to base 36 (26 upper, 10 digits) |
|
static Set<Subject> |
convertMembersToSubject(Set<Member> members)
|
|
static Set<Member> |
convertSubjectsToMembers(GrouperSession grouperSession,
Group group,
Set<Subject> subjects,
boolean immediateOnly)
find subjects which are members of a group, and return those members. |
|
static String |
convertSubjectToLabel(Subject subject)
convert a subject to string for screen |
|
static String |
convertSubjectToLabelConfigured(Subject subject)
get a label from a subject based on media.properties |
|
static String |
convertSubjectToValue(Subject subject)
convert a subject to string for screen |
|
static String |
cookieValue(String cookieName,
Cookie[] cookies)
get a cookie value (null if not there) |
|
static String |
dateToString(Date date)
convert a date to a string using the standard web service pattern yyyy/MM/dd HH:mm:ss.SSS Note that HH is 0-23 |
|
static void |
dhtmlxOptionAppend(StringBuilder result,
String value,
String label,
String imageUrl)
make one dhtmlx option |
|
static String |
escapeHtml(String input,
boolean isEscape)
Convert an XML string to HTML to display on the screen |
|
static String |
escapeHtml(String input,
boolean isEscape,
boolean escapeSingleQuotes)
Convert an XML string to HTML to display on the screen |
|
static String |
escapeJavascript(String input,
boolean isEscape)
Escapes XML ( ampersand, lessthan, greater than, double quote), and single quote with slash |
|
static String |
escapeSingleQuotes(String input)
escape single quotes for javascript |
|
static List<Cookie> |
findCookiesByPrefix(String name)
find a cookie or empty list if cant find |
|
static Subject |
findSubject(String searchString)
find a subject based on search string. |
|
static ResourceBundle |
getNavResourcesStatic(HttpSession session)
Convenience method to retrieve nav ResourceBundle |
|
static String |
imageFromSubjectSource(String sourceId)
get the image name from subject source |
|
static char |
incrementChar(char theChar)
increment a character (A-Z then 0-9) |
|
static char[] |
incrementStringInt(char[] string)
Increment a string with A-Z and 0-9 (no lower case so case insensitive apps like windows IE will still work) |
|
static void |
killCookie(String cookieName,
Cookie[] cookies,
HttpServletResponse httpServletResponse)
kill a cookie if it is there |
|
static File[] |
listFilesByExtension(File dir,
String extension)
list files with a certain extension |
|
static List<File> |
listFilesByExtensionRecursive(File dir,
String extension)
list files with a certain extension. |
|
static void |
listFilesByExtensionRecursiveHelper(File dir,
String extension,
List<File> theList)
list files with a certain extension |
|
static File[] |
listSubdirs(File dir)
get the subdirs of a dir (not ..) |
|
static void |
memberRemoveDuplicates(List<Member> members)
remove duplicates |
|
static Set<Member> |
membersSortedPaged(Set<Member> members,
QueryPaging queryPaging)
|
|
static String |
message(String key)
lookup something in nav.properties (localized) |
|
static String |
message(String key,
boolean blankIfNotFound)
lookup something in nav.properties (localized) |
|
static String |
message(String key,
boolean blankIfNotFound,
boolean escapeHtmlArgs,
Object... args)
lookup something in nav.properties (localized), substitute args |
|
static void |
printToScreen(String string,
HttpContentType httpContentType,
boolean includeXmlTag,
boolean includeHtmlTag)
Print some text to the screen |
|
static Properties |
propertiesFromResourceName(String resourceName)
read properties from a resource, dont modify the properties returned since they are cached |
|
static void |
removeCookiesByPrefix(String prefix)
get a cookie value by name, null if not there |
|
static Set<Member> |
removeOverlappingSubjects(List<Member> first,
List<Subject> second)
remove overlapping subjects from two lists. |
|
static String |
requestParams()
get request params (e.g. |
|
static Cookie |
retrieveCookie(String cookieName,
Cookie[] cookies)
get a cookie based on name or null if not there |
|
static String |
stripNonFilenameChars(String string)
keep a-z, A-Z, 0-9, underscore, dash |
|
static void |
subjectRemoveDuplicates(List<Subject> subjects)
remove duplicates |
|
static Set<Subject> |
subjectsSortedPaged(Set<Subject> subjects,
QueryPaging queryPaging)
|
|
static String |
uniqueId()
get a unique string identifier based on the current time, this is not globally unique, just unique for as long as this server is running... |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Pattern subjectPattern
public static final String DHTMLX_OPTIONS_END
public static final String DHTMLX_OPTIONS_START
public static File classFileDir
public static final String[] HTML_REPLACE
public static final String[] HTML_REPLACE_NO_SINGLE
public static final String[] HTML_SEARCH_NO_SINGLE
Constructor Detail |
---|
public GrouperUiUtils()
Method Detail |
---|
public static URL computeUrl(String resourceName, boolean canBeNull)
resourceName
- canBeNull
- if cant be null, throw runtime
public static ClassLoader classLoader()
public static Properties propertiesFromResourceName(String resourceName)
resourceName
-
public static String uniqueId()
public static String convertLongToChar(long theLong)
theLong
- is the long (less than 62) to convert to a 1 character string
public static String convertLongToCharSmall(long theLong)
theLong
- is the long (less than 36) to convert to a 1 character string
public static String convertLongToString(long theLong)
theLong
- is the long to convert
public static String convertLongToStringSmall(long theLong)
theLong
- is the long to convert
public static char incrementChar(char theChar)
theChar
-
public static char[] incrementStringInt(char[] string)
string
-
public static Cookie retrieveCookie(String cookieName, Cookie[] cookies)
cookieName
- cookies
- (from httprequest)
public static String cookieValue(String cookieName, Cookie[] cookies)
cookieName
- cookies
- (from httprequest)
public static void killCookie(String cookieName, Cookie[] cookies, HttpServletResponse httpServletResponse)
cookieName
- cookies
- (from httprequest)httpServletResponse
- is response for adding cookiespublic static String requestParams()
public static void appendErrorToRequest(String error)
error
- public static Set<Member> convertSubjectsToMembers(GrouperSession grouperSession, Group group, Set<Subject> subjects, boolean immediateOnly)
grouperSession
- group
- subjects
- immediateOnly
- true for only immediate, false for immediate and effective
public static void memberRemoveDuplicates(List<Member> members)
members
- public static void subjectRemoveDuplicates(List<Subject> subjects)
subjects
- public static Set<Member> removeOverlappingSubjects(List<Member> first, List<Subject> second)
first
- second
-
public static Set<Subject> convertMembersToSubject(Set<Member> members)
members
-
public static int compare(String a, String b, boolean ignoreCase)
a
- b
- ignoreCase
- if case shoul dbe ignored
public static String stripNonFilenameChars(String string)
string
-
public static String message(String key, boolean blankIfNotFound, boolean escapeHtmlArgs, Object... args)
key
- blankIfNotFound
- true if null or blank if not found, else it will return ???key???escapeHtmlArgs
- if html should be escaped from argsargs
-
public static String message(String key)
key
-
public static String message(String key, boolean blankIfNotFound)
key
- blankIfNotFound
- true if null or blank if not found, else it will return ???key???
public static ResourceBundle getNavResourcesStatic(HttpSession session)
session
-
public static Set<Subject> subjectsSortedPaged(Set<Subject> subjects, QueryPaging queryPaging)
subjects
- to sort and pagequeryPaging
-
public static Set<Member> membersSortedPaged(Set<Member> members, QueryPaging queryPaging)
members
- to sort and pagequeryPaging
-
public static String convertSubjectToValue(Subject subject)
subject
-
public static String convertSubjectToLabel(Subject subject)
subject
-
public static Subject findSubject(String searchString) throws SubjectNotFoundException, SubjectNotUniqueException, SourceUnavailableException
searchString
-
SubjectNotFoundException
SubjectNotUniqueException
SourceUnavailableException
public static void dhtmlxOptionAppend(StringBuilder result, String value, String label, String imageUrl)
result
- to append tovalue
- label
- imageUrl
- public static void printToScreen(String string, HttpContentType httpContentType, boolean includeXmlTag, boolean includeHtmlTag)
string
- httpContentType
- e.g. "text/html", "text/xml"includeXmlTag
- includeHtmlTag
- public static String escapeSingleQuotes(String input)
input
-
public static void removeCookiesByPrefix(String prefix)
prefix
- public static List<Cookie> findCookiesByPrefix(String name)
name
-
public static String imageFromSubjectSource(String sourceId)
sourceId
-
public static String convertSubjectToLabelConfigured(Subject subject)
subject
-
public static File classFileDir()
public static List<File> listFilesByExtensionRecursive(File dir, String extension)
dir
- extension
- if this is the empty string it should list all
public static void listFilesByExtensionRecursiveHelper(File dir, String extension, List<File> theList)
dir
- extension
- if this is the empty string it should list alltheList
- is the current list to append topublic static File[] listSubdirs(File dir)
dir
-
public static File[] listFilesByExtension(File dir, String extension)
dir
- extension
- if this is the empty string it should list all
public static String booleanToStringOneChar(Boolean theBoolean)
theBoolean
-
public static String dateToString(Date date)
date
-
public static String convertJspToString(String jspName)
jspName
- e.g. whatever.jsp, or /somePath/something.jsp
public static String escapeHtml(String input, boolean isEscape)
input
- is the XML to convertisEscape
- true to escape chars, false to unescape
public static String escapeHtml(String input, boolean isEscape, boolean escapeSingleQuotes)
input
- is the XML to convertisEscape
- true to escape chars, false to unescapeescapeSingleQuotes
- true to escape single quotes too
public static String escapeJavascript(String input, boolean isEscape)
input
- is the XML to convertisEscape
- true to escape chars, false to unescape
public static <T> T cloneShallow(T object)
T
- object
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |