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 |
Modifier and Type | Method and Description |
---|---|
static String |
basicDateAndTimeFormater() |
static String |
basicDateFormater() |
static List<Object> |
combineLists(List<? extends Object>... lists) |
static String |
concat(String s1,
String s2) |
static String |
dateAndTimeFormater(String formatLength) |
static String |
dateFormater(String formatLength) |
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) |
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 |
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,
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 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 namepublic static String basicDateFormater()
public static String basicDateAndTimeFormater()
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)
public static String userUrl(String patternName, String username, String viewId, boolean newConversation)
public static String userUrl(String patternName, String username, String viewId, boolean newConversation, HttpServletRequest req)
Copyright © 2011 Nuxeo SA. All Rights Reserved.