public final class Functions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Functions.BytePrefix |
Modifier and Type | Field and Description |
---|---|
static String |
BIG_FILE_SIZE_LIMIT_PROPERTY |
static long |
DEFAULT_BIG_FILE_SIZE_LIMIT |
static String |
I18N_DURATION_PREFIX |
static Pattern |
YEAR_PATTERN |
Modifier and Type | Method and Description |
---|---|
static String |
basicDateAndTimeFormater()
Deprecated.
since 5.9.1, use
basicDateAndTimeFormatter() instead. |
static String |
basicDateAndTimeFormatter()
Return the date format to handle date and time taking the user's locale into account.
|
static String |
basicDateFormater()
Deprecated.
since 5.9.1, use
basicDateFormatter() instead. |
static String |
basicDateFormatter()
Return the date format to handle date taking the user's locale into account.
|
static List<Object> |
combineLists(List<? extends Object>... lists) |
static String |
componentAbsoluteId(javax.faces.component.UIComponent anchor,
String targetId)
Returns the target component absolute id given an anchor in the tree and a local id.
|
static String |
concat(String s1,
String s2) |
static String |
dateAndTimeFormater(String formatLength)
Deprecated.
since 5.9.1, use
dateAndTimeFormatter(String) instead. |
static String |
dateAndTimeFormatter(String formatLength)
Return the date format to handle date and time taking the user's locale into account.
|
static String |
dateFormater(String formatLength)
Deprecated.
since 5.9.1, use
#dateFormatter() instead. |
static String |
dateFormatter(String formatLength)
Return the date format to handle date taking the user's locale into account.
|
static String |
fileBaseName(String filename)
Returns the base name from the given
filename . |
static String |
fileExtension(String filename)
Returns the extension from the given
filename . |
static String |
formatDate(Date date,
String format) |
static String |
formatDateUsingBasicFormatter(Date date) |
static long |
getBigFileSizeLimit() |
static long |
getFileSize(String value) |
static long |
getValueFromMultiplier(String m)
Transform the parameter in entry according to these unit systems:
SI prefixes: k/M/G for kilo, mega, giga
IEC prefixes: Ki/Mi/Gi for kibi, mebi, gibi
|
static String |
groupDisplayName(String name,
String label)
Choose between label or name the best string to display a group
|
static String |
groupFullName(String groupId)
Returns the full name of a group from his id
|
static boolean |
hasMessages(String clientId)
Returns true if the faces context holds messages for given JSF component id, usually the form id.
|
static String |
htmlEscape(String data) |
static String |
indentString(Integer level,
String text) |
static Integer |
integerDivision(Integer x,
Integer y) |
static String |
javaScriptEscape(String data)
Escapes a given string to be used in a JavaScript function (escaping single quote characters for instance).
|
static String |
join(String[] list,
String separator) |
static String |
joinArrayWithFinalDelimiter(Object[] collection,
String separator,
String finalSeparator) |
static String |
joinCollection(Collection<Object> collection,
String separator) |
static String |
joinCollectionWithFinalDelimiter(Collection<Object> collection,
String separator,
String finalSeparator)
Can be used in order to produce something like that "Julien, Alain , Thierry et Marc-Aurele" where ' , ' and ' et
' is the final one.
|
static String |
joinRender(String render1,
String render2)
Joins two strings to get a valid render attribute for ajax components.
|
static String |
jsfTagIdEscape(String base)
Helper that escapes a string used as a JSF tag id: this is useful to replace characters that are not handled
correctly in JSF context.
|
static String |
principalFullName(NuxeoPrincipal principal) |
static String |
printFileSize(String size) |
static String |
printFormatedFileSize(String sizeS,
String format,
Boolean isShort) |
static String |
printFormattedDuration(Object durationObj) |
static String |
printFormattedDuration(Object durationObj,
Map<String,String> i18nLabels)
Format the duration of a media in a string of two consecutive units to best express the duration of a media,
e.g.:
1 hr 42 min
2 min 25 sec
10 sec
0 sec
|
static Object |
test(Boolean test,
Object onSuccess,
Object onFailure) |
static String |
translate(String messageId,
Object... params) |
static String |
userDisplayName(String id,
String first,
String last) |
static String |
userDisplayNameAndEmail(String id,
String first,
String last,
String email)
Return, from the id, the id its-self if neither last name nor name are found or the full name plus the email if
this one exists
|
static String |
userFullName(String username)
Returns the full name of a user, or its username if user if not found.
|
static boolean |
userIsMemberOf(String groupName) |
static String |
userUrl(String patternName,
String username,
String viewId,
boolean newConversation) |
static String |
userUrl(String patternName,
String username,
String viewId,
boolean newConversation,
javax.servlet.http.HttpServletRequest req) |
public static final String I18N_DURATION_PREFIX
public static final String BIG_FILE_SIZE_LIMIT_PROPERTY
public static final long DEFAULT_BIG_FILE_SIZE_LIMIT
public static final Pattern YEAR_PATTERN
public static String joinCollection(Collection<Object> collection, String separator)
public static String javaScriptEscape(String data)
public static String joinCollectionWithFinalDelimiter(Collection<Object> collection, String separator, String finalSeparator)
public static String joinArrayWithFinalDelimiter(Object[] collection, String separator, String finalSeparator)
public static boolean userIsMemberOf(String groupName)
public static String userFullName(String username)
Since 5.5, returns null if given username is null (instead of returning the current user full name).
public static String groupFullName(String groupId)
groupId
- the group idgroupDisplayName(String, String)
public static String principalFullName(NuxeoPrincipal principal)
public static String userDisplayNameAndEmail(String id, String first, String last, String email)
id
- id of the userfirst
- first name of the userlast
- last name of the useremail
- email of the userpublic static String groupDisplayName(String name, String label)
name
- the group namelabel
- the group name@Deprecated public static String dateFormater(String formatLength)
#dateFormatter()
instead.public static String dateFormatter(String formatLength)
@Deprecated public static String basicDateFormater()
basicDateFormatter()
instead.public static String basicDateFormatter()
@Deprecated public static String dateAndTimeFormater(String formatLength)
dateAndTimeFormatter(String)
instead.public static String dateAndTimeFormatter(String formatLength)
@Deprecated public static String basicDateAndTimeFormater()
basicDateAndTimeFormatter()
instead.public static String basicDateAndTimeFormatter()
public static String printFormatedFileSize(String sizeS, String format, Boolean isShort)
public static String printFormattedDuration(Object durationObj, Map<String,String> i18nLabels)
durationObj
- a Float, Double, Integer, Long or String instance representing a duration in secondsi18nLabels
- a map to translate the days, hours, minutes and seconds labelspublic static long getBigFileSizeLimit()
public static long getFileSize(String value)
public static long getValueFromMultiplier(String m)
m
- : binary prefix multiplierpublic static boolean hasMessages(String clientId)
Id given id is null, returns true if there is at least one client id with messages.
Since the form id might be prefixed with a container id in some cases, the method returns true if one of client ids with messages stats with given id, or if given id is contained in it.
public static String userUrl(String patternName, String username, String viewId, boolean newConversation)
public static String userUrl(String patternName, String username, String viewId, boolean newConversation, javax.servlet.http.HttpServletRequest req)
public static String jsfTagIdEscape(String base)
This method currently removes ASCII characters from the given string, and replaces "-" characters by "_" because the dash is an issue for forms rendered in ajax (see NXP-10793).
Also starting digits are replaced by the "_" character because a tag id cannot start with a digit.
public static String fileExtension(String filename)
filename
.
See FilenameUtils.getExtension(String)
.
public static String fileBaseName(String filename)
filename
.
See FilenameUtils.getBaseName(String)
.
public static String joinRender(String render1, String render2)
public static String componentAbsoluteId(javax.faces.component.UIComponent anchor, String targetId)
If given targetId parameter contains spaces, consider several ids should be resolved and split them.
anchor
- the component anchor, used a localization for the target component in the tree.targetId
- the component to look for locally so as to return its absolute client id.Copyright © 2015 Nuxeo SA. All rights reserved.