gluu
静的公開メンバ関数 | 全メンバ一覧
org.gluu.oxtrust.util.jsf.JsfFunctions クラス
org.gluu.oxtrust.util.jsf.JsfFunctions 連携図
Collaboration graph

静的公開メンバ関数

static DisplayNameEntry getDisplayNameEntry (String dn)
 
static List< DisplayNameEntry > getDisplayNameEntries (String baseDn, List<? extends Entry > entries)
 
static String encodeString (String str)
 
static String splitByLines (String str, int maxLength)
 
static String trimFileName (String str, int maxLength)
 
static String getColor (String color, String defaultColor)
 
static String getPersonDisplayName (User person)
 
static boolean hasPermission (Object target, String action)
 
static List< Map.Entry<?, ?> > toList (Map<?, ?> map)
 
static String trim (String str)
 
static String trimToLength (String str, int maxLength)
 
static String convertLdapTimeToDisplay (String timeStamp)
 

詳解

Tag library to help display data in facelets

著者
Yuriy Movchan Date: 11.09.2010

関数詳解

◆ convertLdapTimeToDisplay()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.convertLdapTimeToDisplay ( String  timeStamp)
inlinestatic
159  {
160  if ((timeStamp == null) || (timeStamp.length() == 0)) {
161  return timeStamp;
162  }
163 
164  return CdiUtil.bean(PersistenceEntryManager.class).decodeTime(timeStamp).toGMTString();
165 
166  }

◆ encodeString()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.encodeString ( String  str)
inlinestatic
58  {
59  if ((str == null) || (str.length() == 0)) {
60  return str;
61  }
62  try {
63  return (new URI(null, str, null)).toString();
64  } catch (URISyntaxException ex) {
65  return null;
66  }
67  }

◆ getColor()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.getColor ( String  color,
String  defaultColor 
)
inlinestatic
114  {
115  String tmpColor = StringHelper.isEmpty(color) ? defaultColor : color;
116  return "#" + tmpColor + ";";
117  }

◆ getDisplayNameEntries()

static List<DisplayNameEntry> org.gluu.oxtrust.util.jsf.JsfFunctions.getDisplayNameEntries ( String  baseDn,
List<? extends Entry >  entries 
)
inlinestatic
46  {
47  if ((baseDn == null) || (entries == null)) {
48  return null;
49  }
50 
51  try {
52  return CdiUtil.bean(LookupService.class).getDisplayNameEntriesByEntries(baseDn, entries);
53  } catch (Exception ex) {
54  return null;
55  }
56  }

◆ getDisplayNameEntry()

static DisplayNameEntry org.gluu.oxtrust.util.jsf.JsfFunctions.getDisplayNameEntry ( String  dn)
inlinestatic
34  {
35  if (dn == null) {
36  return null;
37  }
38 
39  try {
40  return CdiUtil.bean(LookupService.class).getDisplayNameEntry(dn);
41  } catch (Exception ex) {
42  return null;
43  }
44  }

◆ getPersonDisplayName()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.getPersonDisplayName ( User  person)
inlinestatic
119  {
120  if (person == null) {
121  return null;
122  }
123 
124  if (StringHelper.isEmpty(person.getDisplayName())) {
125  return person.getUid();
126  }
127 
128  return person.getDisplayName();
129  }

◆ hasPermission()

static boolean org.gluu.oxtrust.util.jsf.JsfFunctions.hasPermission ( Object  target,
String  action 
)
inlinestatic
131  {
132  return CdiUtil.bean(PermissionService.class).hasPermission(target, action);
133  }

◆ splitByLines()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.splitByLines ( String  str,
int  maxLength 
)
inlinestatic
69  {
70  if ((str == null) || (str.length() == 0) || (maxLength == 0)) {
71  return str;
72  }
73 
74  String tmpStr = StringEscapeUtils.escapeHtml(str);
75 
76  StringBuilder result = new StringBuilder();
77  int startIndex = -1;
78  int oldStartIndex = -1;
79  while (startIndex + 1 < tmpStr.length()) {
80  startIndex = tmpStr.indexOf(' ', startIndex + 1);
81  if (startIndex == -1) {
82  break;
83  }
84  if ((startIndex - oldStartIndex + 1) > maxLength) {
85  result.append(tmpStr.substring(oldStartIndex + 1, startIndex));
86  result.append("<br/>");
87  oldStartIndex = startIndex;
88  }
89  startIndex++;
90  }
91 
92  if (oldStartIndex < tmpStr.length()) {
93  result.append(tmpStr.substring(oldStartIndex + 1));
94  }
95 
96  return result.toString();
97  }

◆ toList()

static List<Map.Entry<?, ?> > org.gluu.oxtrust.util.jsf.JsfFunctions.toList ( Map<?, ?>  map)
inlinestatic
135  {
136  return map != null ? new ArrayList<Map.Entry<?, ?>>(map.entrySet()) : null;
137  }

◆ trim()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.trim ( String  str)
inlinestatic
139  {
140  if ((str == null) || (str.length() == 0)) {
141  return str;
142  }
143  return str.trim();
144  }

◆ trimFileName()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.trimFileName ( String  str,
int  maxLength 
)
inlinestatic
99  {
100  if ((str == null) || (str.length() == 0) || (maxLength < 10)) {
101  return str;
102  }
103 
104  int length = str.length();
105  int middleMaxLength = (maxLength - 3) / 2;
106 
107  if (length <= maxLength) {
108  return str;
109  }
110 
111  return str.substring(0, middleMaxLength - 1) + "..." + str.substring(length - middleMaxLength - 2);
112  }

◆ trimToLength()

static String org.gluu.oxtrust.util.jsf.JsfFunctions.trimToLength ( String  str,
int  maxLength 
)
inlinestatic
146  {
147  if (str == null) {
148  return str;
149  }
150 
151  int length = str.length();
152  if (length <= maxLength) {
153  return str;
154  }
155 
156  return str.substring(0, maxLength) + "...";
157  }

このクラス詳解は次のファイルから抽出されました: