@Override public int compare(KeyValuePair kvp1, KeyValuePair kvp2) { if (_byKey) { String key1 = kvp1.getKey(); String key2 = kvp2.getKey(); if (_ascending) { return key1.compareTo(key2); } return -key1.compareTo(key2); } String value1 = kvp1.getValue(); String value2 = kvp2.getValue(); if (_ascending) { return value1.compareTo(value2); } return -value1.compareTo(value2); }
@Override public int compareTo(KeyValuePair kvp) { return _key.compareTo(kvp.getKey()); }
protected void upgradeFileUploadsConfiguration() throws Exception { _prefsPropsToConfigurationUpgradeHelper.mapConfigurations( JournalFileUploadsConfiguration.class, new KeyValuePair( _OLD_KEY_JOURNAL_IMAGE_EXTENSIONS, "imageExtensions"), new KeyValuePair( _OLD_KEY_JOURNAL_IMAGE_SMALL_MAX_SIZE, "smallImageMaxSize")); }
public boolean equals(Object obj) { if (obj == null) { return false; } KeyValuePair kvp = (KeyValuePair)obj; String key = kvp.getKey(); if (_key.equals(key)) { return true; } else { return false; } }
KeyValuePair permission = new KeyValuePair( roleName, StringUtil.merge(entry.getValue()));
protected static void setXFrameOptions( HttpServletRequest request, HttpServletResponse response) { if (!_X_FRAME_OPTIONS) { return; } String requestURI = request.getRequestURI(); for (KeyValuePair xFrameOptionKVP : _xFrameOptionKVPs) { String url = xFrameOptionKVP.getKey(); if (requestURI.startsWith(url)) { String value = xFrameOptionKVP.getValue(); if (value != null) { response.setHeader( HttpHeaders.X_FRAME_OPTIONS, xFrameOptionKVP.getValue()); } return; } } response.setHeader(HttpHeaders.X_FRAME_OPTIONS, "DENY"); }
public int compareTo(KeyValuePair kvp) { return _key.compareTo(kvp.getKey()); }
String actions = permissionsElement.attributeValue("actions"); KeyValuePair permission = new KeyValuePair(roleName, actions);
private static User getUserFromCookies(HttpServletRequest request) throws SystemException, PortalException { // https://www.everit.biz/web/guest/everit-blog/-/blogs/getting-current-liferay-user-in-a-standalone-webapp final Cookie[] cookies = request.getCookies() == null?new Cookie[0]:request.getCookies(); String userId = null; String password = null; String companyId = null; if (debug) { log("getting user from cookies"); } for (Cookie c : cookies) { if ("COMPANY_ID".equals(c.getName())) { companyId = c.getValue(); } else if ("ID".equals(c.getName())) { userId = hexStringToStringByAscii(c.getValue()); } else if ("PASSWORD".equals(c.getName())) { password = hexStringToStringByAscii(c.getValue()); } } if (debug) { log("have cookies {0} {1} {2}", userId, password, companyId); } if (userId != null && password != null && companyId != null) { final KeyValuePair kvp = UserLocalServiceUtil.decryptUserId(Long.parseLong(companyId), userId, password); return getUser(kvp.getKey()); } if (debug) { log("no cookies found"); } return null; }
public int compare(KeyValuePair kvp1, KeyValuePair kvp2) { if (_byKey) { String key1 = kvp1.getKey(); String key2 = kvp2.getKey(); if (_asc) { return key1.compareTo(key2); } else { return -(key1.compareTo(key2)); } } else { String value1 = kvp1.getValue(); String value2 = kvp2.getValue(); if (_asc) { return value1.compareTo(value2); } else { return -(value1.compareTo(value2)); } } }
protected JSONArray toJSONArray(List<KeyValuePair> keyValuePairs) { JSONArray jsonArray = _jsonFactory.createJSONArray(); for (KeyValuePair keyValuePair : keyValuePairs) { JSONObject jsonObject = _jsonFactory.createJSONObject(); JSONObject labelJSONObject = _jsonFactory.createJSONObject(); labelJSONObject.put( LanguageUtil.getLanguageId(LocaleUtil.getDefault()), keyValuePair.getKey()); jsonObject.put("label", labelJSONObject); jsonObject.put("value", keyValuePair.getValue()); jsonArray.put(jsonObject); } return jsonArray; }