List of usage examples for org.apache.commons.lang3 StringUtils isBlank
public static boolean isBlank(final CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
From source file:alpine.util.GravatarUtil.java
/** * Generates a hash value from the specified email address. * Returns null if emailAddress is empty or null. * @param emailAddress the email address to generate a hash from * @return a hash value of the specified email address * @since 1.0.0//ww w. j a v a 2 s. c om */ public static String generateHash(String emailAddress) { if (StringUtils.isBlank(emailAddress)) { return null; } return DigestUtils.md5Hex(emailAddress.trim().toLowerCase()).toLowerCase(); }
From source file:ch.aonyx.broker.ib.api.order.OrderAction.java
public static final OrderAction fromAbbreviation(final String abbreviation) { if (StringUtils.isBlank(abbreviation)) { return EMPTY; }//from w w w. j a v a2 s .c o m final String abbreviationUpperCase = abbreviation.toUpperCase(); if (MAP.containsKey(abbreviationUpperCase)) { return MAP.get(abbreviationUpperCase); } return UNKNOWN; }
From source file:badminton.common.Util.StringUtil.java
/** * ?blank??0/*from www. j a v a 2s .c o m*/ * * @param str * @return true:blank,false:?blank */ public static boolean isBlank(final String str) { return StringUtils.isBlank(str); }
From source file:controllers.api.v1.User.java
public static Result updateSettings() { Map<String, String[]> params = request().body().asFormUrlEncoded(); ObjectNode result = Json.newObject(); String username = session("user"); if (StringUtils.isNotBlank(username)) { String message = UserDAO.updateUserSettings(params, username); if (StringUtils.isBlank(message)) { result.put("status", "success"); } else {/*from w w w . j a v a 2 s . co m*/ result.put("status", "failed"); result.put("message", message); } } else { result.put("status", "failed"); result.put("message", "User is not authenticated"); } return ok(result); }
From source file:controllers.user.FriendsApp.java
/** * ?/*from w ww .ja v a 2 s .co m*/ * @return */ @Transactional public static Result addFriend() { DynamicForm requestData = Form.form().bindFromRequest(); String friendId = requestData.get("friendId"); String messageId = requestData.get("messageId"); if (StringUtils.isBlank(friendId)) { return ok("{\"status\":\"0\",\"error\":\"?friendId?\"}"); } if (StringUtils.isBlank(messageId)) { return ok("{\"status\":\"0\",\"error\":\"?messageId?\"}"); } User me = User.getFromSession(session()); User friend = User.findById(Long.parseLong(friendId)); if (friend == null) { return ok("{\"status\":\"0\",\"error\":\"???\"}"); } Boolean flag = FriendsService.addFriend(me, friend); //? Boolean flag2 = FriendsService.addFriend(friend, me); //? ObjectNodeResult result = null; if (flag && flag2) { result = new ObjectNodeResult(ObjectNodeResult.STATUS_SUCCESS); } else { result = new ObjectNodeResult(ObjectNodeResult.STATUS_FAILED); } MessageService.pushMsgAgreeFriends(me, friend); MessageService.handlerMessage(Long.parseLong(messageId)); // ??? return ok(result.getObjectNode()); }
From source file:ch.aonyx.broker.ib.api.data.bar.RealTimeBarDataType.java
public static final RealTimeBarDataType fromLabel(final String label) { if (StringUtils.isBlank(label)) { return EMPTY; }/*from w w w. j a v a 2s .c o m*/ final String labelUpperCase = label.toUpperCase(); if (MAP.containsKey(labelUpperCase)) { return MAP.get(labelUpperCase); } return UNKNOWN; }
From source file:ch.aonyx.broker.ib.api.contract.SecurityIdentifierCode.java
public static final SecurityIdentifierCode fromAcronym(final String acronym) { if (StringUtils.isBlank(acronym)) { return EMPTY; }//ww w. j a va 2s.c o m final String acronymUpperCase = acronym.toUpperCase(); if (MAP.containsKey(acronymUpperCase)) { return MAP.get(acronymUpperCase); } return UNKNOWN; }
From source file:com.netsteadfast.greenstep.sys.SysEventLogSupport.java
public static void log(String userId, String sysId, String executeEventId, boolean permit) { if (StringUtils.isBlank(userId) || StringUtils.isBlank(sysId) || StringUtils.isBlank(executeEventId)) { log.warn("null userId=" + userId + ", sysId=" + sysId + ", executeEventId=" + executeEventId); return;/* w ww . j av a2 s . com*/ } if (executeEventId.indexOf(Constants._COMMON_LOAD_FORM_ACTION) > -1) { log.warn("Common load form no need event log : " + executeEventId + " , permit = " + permit); return; } NamedParameterJdbcTemplate namedParameterJdbcTemplate = (NamedParameterJdbcTemplate) AppContext .getBean("namedParameterJdbcTemplate"); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("oid", SimpleUtils.getUUIDStr()); paramMap.put("user", userId); paramMap.put("sysId", sysId); paramMap.put("executeEvent", (executeEventId.length() > 255 ? executeEventId.substring(0, 255) : executeEventId)); paramMap.put("isPermit", (permit ? "Y" : "N")); paramMap.put("cuserid", "SYS"); paramMap.put("cdate", new Date()); try { namedParameterJdbcTemplate.update( "insert into tb_sys_event_log(OID, USER, SYS_ID, EXECUTE_EVENT, IS_PERMIT, CUSERID, CDATE) " + "values(:oid, :user, :sysId, :executeEvent, :isPermit, :cuserid, :cdate)", paramMap); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage().toString()); } }
From source file:ch.aonyx.broker.ib.api.data.fundamental.ReportType.java
public static final ReportType fromLabel(final String label) { if (StringUtils.isBlank(label)) { return EMPTY; }/*from ww w . ja v a 2 s . co m*/ final String labelUpperCase = label.toUpperCase(); if (MAP.containsKey(labelUpperCase)) { return MAP.get(labelUpperCase); } return UNKNOWN; }
From source file:com.hybris.mobile.lib.commerce.helper.UrlHelper.java
/** * Return the webservice Http Address that take into account the catalog + the method path to call * * @param context Application-specific resources * @param configuration URL settings * @param pathUrlStringResource Webservice path * @param formatArgs Values to replace on the final returned String @return Formatted String Url for WebService *//* w ww .j a va2 s .com*/ public static String getWebserviceCatalogUrl(Context context, Configuration configuration, int pathUrlStringResource, Object... formatArgs) { if (configuration == null || StringUtils.isBlank(configuration.getBackendUrl())) { throw new IllegalArgumentException(); } return buildWebserviceUrl(context, configuration, pathUrlStringResource, formatArgs); }