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:controllers.skilltag.SkillTagApp.java
@Transactional(readOnly = true) public static Result list() { DynamicForm requestData = Form.form().bindFromRequest(); String p = requestData.get("p") == null ? "1" : requestData.get("p"); Long i = StringUtils.isBlank(requestData.get("i")) ? 2L : Long.parseLong(requestData.get("i")); String s = StringUtils.isBlank(requestData.get("s")) ? null : requestData.get("s"); String cf = requestData.get("cf"); String ssf = requestData.get("ssf"); String ef = requestData.get("ef"); String gf = requestData.get("gf"); String o = requestData.get("o"); String ot = requestData.get("ot"); List<SkillTag> skillTags = SkillTag.getAll(i, 1, "all"); List<TagListVo> ivs = new ArrayList<TagListVo>(); List<TagListVo> svs = new ArrayList<TagListVo>(); ScriptEngine engine = SemUtils.getEngine(); try {//ww w . java 2s.c o m for (SkillTag st : skillTags) { TagListVo tv = new TagListVo(); tv.setTagName(st.tagName); tv.setTagId(st.id); if (st.tagType != null && st.tagType.ordinal() == SkillTag.TagType.CATEGORY.ordinal()) { if (st.id.equals(i)) tv.setIsCurr(true); tv.setHref(controllers.skilltag.routes.SkillTagApp.list().url() + "?p=1&i=" + tv.getTagId()); ivs.add(tv); } else { tv.setHref(controllers.skilltag.routes.SkillTagApp.list().url() + "?p=1&i=" + i + "&s=" + engine.eval("encodeURIComponent('" + tv.getTagName() + "')").toString()); svs.add(tv); } } if (StringUtils.isNotBlank(s)) { TagListVo tv = new TagListVo(); tv.setTagName(s); tv.setIsCurr(true); tv.setHref(controllers.skilltag.routes.SkillTagApp.list().url() + "?p=1&i=" + i + "&s=" + engine.eval("encodeURIComponent('" + tv.getTagName() + "')").toString()); svs.add(0, tv); } } catch (ScriptException e) { e.printStackTrace(); } List<ExpertListVO> elv = getTagExperts(p, i, s, cf, ssf, ef, gf, o, ot); SPage spage = new SPage(Integer.parseInt(p), i, s, cf, ssf, ef, gf, o, ot, ivs, svs, elv); List<String> countryList = SkillTag.getCountryNameWithCache(); spage.setCountryList(countryList); return ok(views.html.skilltag.skilltagall.render(spage)); }
From source file:ext.sns.auth.AuthResponse.java
/** * AuthResonpse/*w w w. ja v a2 s . c om*/ * * @param params ? * @return AuthResonpse null - ??? */ public static AuthResponse create(Map<String, String> params) { if (MapUtils.isEmpty(params)) { return null; } String code = params.get("code"); String error = params.get("error"); if (StringUtils.isBlank(code) && StringUtils.isBlank(error)) { LOGGER.error("code and error is blank."); return null; } String state = params.get("state"); AuthResponse authResponse = new AuthResponse(); authResponse.code = code; authResponse.state = state; authResponse.raw = params; authResponse.error = error; ProviderConfig providerConfig = ConfigManager.getProviderConfigByAuthResponse(authResponse); if (null == providerConfig) { LOGGER.error("No match ProviderConfig by " + authResponse.toString() + "."); return null; } Map<String, String> callbackParam = providerConfig.getCallbackParam(authResponse); if (MapUtils.isEmpty(callbackParam)) { LOGGER.error("callbackParam is null."); return null; } String type = callbackParam.get(ConfigManager.TYPE_KEY); if (StringUtils.isBlank(type)) { LOGGER.error("type is blank."); return null; } authResponse.type = type; authResponse.providerName = providerConfig.getName(); callbackParam.remove(ConfigManager.TYPE_KEY); authResponse.backExtParam = callbackParam; return authResponse; }
From source file:com.thoughtworks.go.util.TriState.java
public static TriState from(String booleanLike) { if (StringUtils.isBlank(booleanLike)) { return UNSET; }/*from w w w.j av a2s.c o m*/ if (booleanLike.toLowerCase().equals("false")) { return FALSE; } if (booleanLike.toLowerCase().equals("true")) { return TRUE; } throw new IllegalArgumentException( String.format("The string '%s' does not look like a boolean.", booleanLike)); }
From source file:com.gtafe.tools.utils.MimeUtils.java
/** * Return the mime type for a file name. The extension is parsed out and the * method to get mime type by extension is called. Extension mappings are * found in the mimeTypes.properties file in the org.extremecomponents.util * package.// w w w .j av a2 s . c o m */ public static String getFileMimeType(String fileName) { if (StringUtils.isBlank(fileName) || (fileName.indexOf(".") == -1)) { return null; } fileName = fileName.substring(fileName.lastIndexOf(".")); return getExtensionMimeType(fileName); }
From source file:com.thoughtworks.go.apiv4.agents.representers.UpdateRequestRepresenter.java
static TriState toTriState(String agentConfigState) { if (StringUtils.isBlank(agentConfigState)) { return TriState.UNSET; } else if (StringUtils.equalsIgnoreCase(agentConfigState, "enabled")) { return TriState.TRUE; } else if (StringUtils.equalsIgnoreCase(agentConfigState, "disabled")) { return TriState.FALSE; } else {//from w w w.j av a 2 s . c o m throw HaltApiResponses.haltBecauseOfReason( "The value of `agent_config_state` can be one of `Enabled`, `Disabled` or null."); } }
From source file:de.decoit.simu.cbor.xml.dictionary.DictionaryProvider.java
/** * Retrieve a Dictionary instance that may be referenced by its name. * If no instance is registered under this name, a new one is created. * * @param name Reference name for the requested instance * @return The Dictionary instance referenced by the provided name *//*from ww w.j ava 2s . c o m*/ public static Dictionary getNamedInstance(String name) { if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("Instance name must not be blank"); } if (namedInstances.get(name) == null) { namedInstances.put(name, new Dictionary()); } return namedInstances.get(name); }
From source file:com.trenako.values.Priority.java
/** * Parses the string argument as a {@code Priority}. * * @param prio the string to be parsed * @param defaultPrio the default {@code Priority} value * @return a {@code Priority} value//from w w w. j ava 2s. c om */ public static Priority parse(String prio, Priority defaultPrio) { if (StringUtils.isBlank(prio)) { return defaultPrio; } return LocalizedEnum.parseString(prio, Priority.class); }
From source file:com.hbc.api.trade.order.controller.validator.OrderValidator.java
public static void validateDeliverGuide(String allocateGid, String orderNo, String guideId) { validateGuideId(guideId);/*from ww w .j a va 2 s .c o m*/ validateOrderNo(orderNo); if (StringUtils.isBlank(allocateGid)) { logger.error( "allocateGid(?allocat_gno) null??allocateGid=" + allocateGid); throw new TradeException(TradeReturnCodeEnum.ORDER_PARAM_FAILED, "allocateGid"); } }
From source file:com.netflix.genie.agent.AgentMetadataImpl.java
private static String getAgentVersionOrFallback() { final String agentVersion = AgentMetadataImpl.class.getPackage().getImplementationVersion(); if (!StringUtils.isBlank(agentVersion)) { return agentVersion; }/* w ww . j av a 2 s . c o m*/ log.warn("Failed to retrieve agent version"); return FALLBACK_STRING; }
From source file:com.thoughtworks.go.domain.ConfigurationDisplayUtil.java
public static List<ConfigurationProperty> getConfigurationPropertiesToBeUsedForDisplay( PluginPreferenceStore metadataStore, String pluginId, final Configuration configuration) { List<ConfigurationProperty> keysForDisplay = new ArrayList<>(); boolean pluginDoesNotExist = !metadataStore.hasPreferenceFor(pluginId); for (ConfigurationProperty property : configuration) { boolean isNotASecureProperty = !property.isSecure(); boolean isPartOfIdentity = metadataStore.hasOption(pluginId, property.getConfigurationKey().getName(), PackageConfiguration.PART_OF_IDENTITY); if (isNotASecureProperty && !StringUtils.isBlank(property.getValue()) && (pluginDoesNotExist || isPartOfIdentity)) { keysForDisplay.add(property); }/*from w w w. j av a 2s. c o m*/ } return keysForDisplay; }