List of usage examples for org.apache.commons.lang3 StringUtils isNotBlank
public static boolean isNotBlank(final CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
StringUtils.isNotBlank(null) = false StringUtils.isNotBlank("") = false StringUtils.isNotBlank(" ") = false StringUtils.isNotBlank("bob") = true StringUtils.isNotBlank(" bob ") = true
From source file:com.hybris.mobile.app.commerce.activity.OrderDetailActivity.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent();/*from www . java 2 s . c o m*/ /// Search query, we redirect to the order details page if (intent != null && StringUtils.isNotBlank(intent.getStringExtra(SearchManager.QUERY))) { intent.putExtra(IntentConstants.ORDER_CODE, intent.getStringExtra(SearchManager.QUERY)); intent.putExtra(IntentConstants.ORDER_FROM_SEARCH, true); } }
From source file:com.log4ic.compressor.utils.template.JavascriptTemplateEngine.java
protected static String run(URI uri, String source, RunIt runIt) { Map<String, String> params = HttpUtils.getParameterMap(uri); String name;//from www. j a v a 2s. c om Mode m = null; if (params.containsKey("amd")) { name = params.get("amd"); m = Mode.AMD; } else { name = params.get("name"); String mode = params.get("mode"); if (StringUtils.isBlank(name)) { name = uri.getPath(); int lastI = name.lastIndexOf("."); name = name.substring(name.lastIndexOf("/") + 1, lastI); } if (StringUtils.isNotBlank(mode)) { try { m = Mode.valueOf(mode.toUpperCase()); } catch (Exception e) { //fuck ide } } if (m == null) { m = Mode.COMMON; } } return runIt.run(name, source, m); }
From source file:com.mpush.zk.cache.ZKServerNodeCache.java
@Override public void put(String fullPath, ZKServerNode node) { if (StringUtils.isNotBlank(fullPath) && node != null) { cache.put(fullPath, node);/* ww w. j a va2 s .co m*/ } else { logger.error("fullPath is null or application is null"); } printList(); }
From source file:com.omertron.bgg.enums.Command.java
/** * Convert a string into an Enum type/*w w w.j av a 2s.c o m*/ * * @param source String representation of the enum to convert * @return The enum that matches the source * @throws IllegalArgumentException If type is not recognised * */ public static Command fromString(String source) { if (StringUtils.isNotBlank(source)) { try { return Command.valueOf(source.trim().toUpperCase()); } catch (IllegalArgumentException ex) { throw new IllegalArgumentException("Command " + source + " does not exist.", ex); } } throw new IllegalArgumentException("Command must not be null"); }
From source file:com.thinkbiganalytics.metadata.modeshape.support.JcrPath.java
public static Path get(String first, String... more) { ArrayList<String> list = new ArrayList<>(); boolean absolute = first.trim().startsWith("/"); String[] firstElems = first.split("/"); for (int idx = (absolute ? 1 : 0); idx < firstElems.length; idx++) { if (StringUtils.isNotBlank(firstElems[idx])) { list.add(firstElems[idx]);//from w w w. j av a 2 s . c om } } for (String another : more) { String[] anotherElems = another.split("/"); for (String elem : anotherElems) { if (StringUtils.isNotBlank(elem)) { list.add(elem); } } } return new JcrPath(absolute, list); }
From source file:ch.cyberduck.core.onedrive.OneDriveTouchFeature.java
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try {//from w ww . j av a 2 s . c o m session.toFile(file).create(StringUtils.isNotBlank(status.getMime()) ? status.getMime() : MimeTypeService.DEFAULT_CONTENT_TYPE); } catch (OneDriveAPIException e) { throw new OneDriveExceptionMappingService().map("Cannot create file {0}", e, file); } catch (IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } return file; }
From source file:com.haoocai.jscheduler.core.app.AppServiceImpl.java
@Override public List<String> getNamespaceApps(String namespace) { Preconditions.checkArgument(StringUtils.isNotBlank(namespace)); return zkAccessor.getChildren("/" + namespace); }
From source file:gov.nih.nci.caintegrator.web.ajax.AbstractDwrAjaxUpdater.java
/** * {@inheritDoc}//www. j a va2 s . c o m */ public void initializeJsp() { WebContext wctx = WebContextFactory.get(); DisplayableUserWorkspace workspace = (DisplayableUserWorkspace) wctx.getSession() .getAttribute("displayableWorkspace"); if (StringUtils.isNotBlank(SessionHelper.getUsername()) && !SessionHelper.isAnonymousUser()) { workspace.refresh(workspaceService, true); associateJobWithSession(dwrUtilFactory, workspace.getUserWorkspace().getUsername(), new Util(wctx.getScriptSession())); initializeDynamicTable(workspace); } }
From source file:com.msopentech.odatajclient.engine.data.atom.AtomSerializer.java
private static void setLinks(final Element entry, final List<AtomLink> links) throws ParserConfigurationException { for (AtomLink link : links) { final Element linkElem = entry.getOwnerDocument().createElement(ODataConstants.ATOM_ELEM_LINK); linkElem.setAttribute(ODataConstants.ATTR_REL, link.getRel()); linkElem.setAttribute(ODataConstants.ATTR_TITLE, link.getTitle()); linkElem.setAttribute(ODataConstants.ATTR_HREF, link.getHref()); if (StringUtils.isNotBlank(link.getType())) { linkElem.setAttribute(ODataConstants.ATTR_TYPE, link.getType()); }/* ww w . j a v a 2s .com*/ if (link.getInlineEntry() != null || link.getInlineFeed() != null) { final Element inline = entry.getOwnerDocument().createElement(ODataConstants.ATOM_ELEM_INLINE); linkElem.appendChild(inline); if (link.getInlineEntry() != null) { inline.appendChild( entry.getOwnerDocument().importNode(entry((AtomEntry) link.getInlineEntry()), true)); } if (link.getInlineFeed() != null) { inline.appendChild( entry.getOwnerDocument().importNode(feed((AtomFeed) link.getInlineFeed()), true)); } } entry.appendChild(linkElem); } }
From source file:jp.co.golorp.emarf.properties.collection.AppSet.java
/** * @param name/* w ww . j a v a 2 s .c o m*/ * ?? * @return ???suffix?set???? */ public boolean isEnd(final String name) { if (StringUtil.isNotBlank(name)) { for (Iterator<?> suffixes = this.iterator(); suffixes.hasNext();) { String suffix = (String) suffixes.next(); if (StringUtils.isNotBlank(suffix) && name.replaceFirst("\\[[0-9]+\\]", "").endsWith(suffix)) { return true; } } } return false; }