String getReciverJid() { if (this instanceof XmppServiceContact) { } else if (!StringUtils.isEmpty(currentResource)) { return getUserId() + "/" + currentResource; } return getUserId(); }
private static int compareNodes(Sortable node1, Sortable node2) { int result = node1.getNodeWeight() - node2.getNodeWeight(); if (0 == result) { result = StringUtils.stringCompare(node1.getText(), node2.getText()); } return result; }
/* Divide text to array of parts using serparator charaster */ public static String[] explode(String text, char separator) { if (StringUtils.isEmpty(text)) { return new String[0]; } Vector<String> tmp = new Vector<String>(); int start = 0; int end = text.indexOf(separator, start); while (end >= start) { tmp.addElement(text.substring(start, end)); start = end + 1; end = text.indexOf(separator, start); } tmp.addElement(text.substring(start)); String[] result = new String[tmp.size()]; tmp.copyInto(result); return result; }
public void __setStatus(String resource, int priority, byte index, String statusText) { if (StatusInfo.STATUS_OFFLINE == index) { resource = StringUtils.notNull(resource); if (resource.equals(currentResource)) { currentResource = null; } removeSubContact(resource); if (0 == subContacts.size()) { setOfflineStatus(); } } else { SubContact c = getSubContact(resource); c.priority = (byte) Math.min(127, Math.max(priority, -127)); c.status = index; c.statusText = statusText; } }
public static String xmlEscape(String text) { text = StringUtils.notNull(text); return Util.replace(text, unescapedChars, escapedChars, "\"'><&"); }
public static String notUrls(String str) { str = StringUtils.notNull(str); return (-1 != str.indexOf("http://")) ? "" : str; }
private String getSubContactRealJid(String resource) { SubContact c = getExistSubContact(resource); return StringUtils.notNull((null == c) ? null : c.realJid); }