List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty
public static boolean isNotEmpty(final CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
StringUtils.isNotEmpty(null) = false StringUtils.isNotEmpty("") = false StringUtils.isNotEmpty(" ") = true StringUtils.isNotEmpty("bob") = true StringUtils.isNotEmpty(" bob ") = true
From source file:com.bellman.bible.android.view.activity.search.SearchIndexProgressStatus.java
/** * check index exists and go to search screen if index exists * if no more jobs in progress and no index then error */// w w w . j a va 2 s . c o m @Override protected void jobFinished(Progress jobJustFinished) { // give the document up to 12 secs to reload - the Progress declares itself finished before the index status has been changed int attempts = 0; while (!IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus()) && attempts++ < 6) { CommonUtils.pause(2); } // if index is fine then goto search if (IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus())) { Log.i(TAG, "Index created"); Intent intent = null; if (StringUtils.isNotEmpty(getIntent().getStringExtra(SearchControl.SEARCH_TEXT))) { // the search string was passed in so execute it directly intent = new Intent(this, SearchResults.class); intent.putExtras(getIntent().getExtras()); } else { // just go to the normal Search screen intent = new Intent(this, Search.class); } startActivity(intent); finish(); } else { // if jobs still running then just wait else error if (isAllJobsFinished()) { Log.e(TAG, "Index finished but document's index is invalid"); Dialogs.getInstance().showErrorMsg(R.string.error_occurred); } } }
From source file:ch.citux.td.ui.fragments.GameStreamsFragment.java
@Override public void loadData() { if (game != null) { if (StringUtils.isNotEmpty(game.getName())) { TDTaskManager.executeTask(this); }//w ww . j a v a 2 s . co m } }
From source file:io.wcm.samples.handler.controller.navigation.SiteRootRelativePageLink.java
/** * @param siteHelper//w ww . j ava2s.c o m * @param linkHandler * @param relativePath Relative path of page to link to * @param titleType Type of title to display: pageTitle or navigationTitle */ @Inject public SiteRootRelativePageLink(@Self SiteHelper siteHelper, @Self LinkHandler linkHandler, @RequestAttribute(name = "relativePath", optional = true) String relativePath, @RequestAttribute(name = "titleType", optional = true) @Default(values = "navigationTitle") String titleType) { Page page; if (StringUtils.isNotEmpty(relativePath)) { page = siteHelper.getRelativePage(relativePath); } else { page = siteHelper.getSiteRootPage(); } if (page != null) { link = linkHandler.get(page).build(); switch (titleType) { case "pageTitle": title = StringUtils.defaultString(page.getPageTitle(), page.getTitle()); break; case "navigationTitle": default: title = StringUtils.defaultString(page.getNavigationTitle(), page.getTitle()); break; } } }
From source file:com.netflix.hystrix.contrib.javanica.command.LazyCommandExecutionAction.java
/** * {@inheritDoc}//from w ww . ja v a2 s . com */ @Override public String getActionName() { return StringUtils.isNotEmpty(originalMetaHolder.getHystrixCommand().commandKey()) ? originalMetaHolder.getHystrixCommand().commandKey() : originalMetaHolder.getDefaultCommandKey(); }
From source file:io.fabric8.vertx.maven.plugin.mojos.RunMojo.java
@Override public void execute() throws MojoExecutionException, MojoFailureException { if (optionalRunExtraArgs == null) { optionalRunExtraArgs = new ArrayList<>(); }/*from w w w. j a v a 2 s . com*/ String runArgsProp = System.getProperty("vertx.runArgs"); if (StringUtils.isNotEmpty(runArgsProp)) { getLog().debug("Got command line arguments from property :" + runArgsProp); try { String[] argValues = CommandLineUtils.translateCommandline(runArgsProp); optionalRunExtraArgs.addAll(Arrays.asList(argValues)); } catch (Exception e) { throw new MojoFailureException("Unable to parse system property vertx.runArgs", e); } } else if (runArgs != null && !runArgs.isEmpty()) { optionalRunExtraArgs.addAll(runArgs); } super.execute(); }
From source file:jp.eisbahn.oauth2.server.granttype.impl.AuthorizationCode.java
@Override public GrantHandlerResult handleRequest(DataHandler dataHandler) throws OAuthError { Request request = dataHandler.getRequest(); ClientCredential clientCredential = getClientCredentialFetcher().fetch(request); String clientId = clientCredential.getClientId(); String code = getParameter(request, "code"); String redirectUri = getParameter(request, "redirect_uri"); AuthInfo authInfo = dataHandler.getAuthInfoByCode(code); if (authInfo == null) { throw new OAuthError.InvalidGrant(""); }/* w w w . j av a 2 s . co m*/ if (!authInfo.getClientId().equals(clientId)) { throw new OAuthError.InvalidClient(""); } if (!(StringUtils.isNotEmpty(authInfo.getRedirectUri()) && authInfo.getRedirectUri().equals(redirectUri))) { throw new OAuthError.RedirectUriMismatch(""); } return issueAccessToken(dataHandler, authInfo); }
From source file:com.elastica.util.internal.entity.TestEntity.java
public String toString() { StringBuffer ret = new StringBuffer(); ret.append("Test Attributes: [ TestCaseId: " + testCaseId); if (StringUtils.isNotEmpty(testMethod)) { ret.append("|| TestMethod: " + testMethod); }/*www . ja va 2 s .co m*/ if (StringUtils.isNotEmpty(testTitle)) { ret.append("||TestTitle: " + testTitle); } if (!isActive) { ret.append("||IsActive: " + isActive); } ret.append(" ]"); return ret.toString(); }
From source file:io.wcm.devops.conga.plugins.aem.util.ContentPackageBinaryFile.java
private File getFile(File targetDir) { File parent = targetDir;//w w w . ja v a 2 s . co m if (StringUtils.isNotEmpty(dir)) { parent = new File(targetDir, dir); } if (StringUtils.isNotEmpty(fileName)) { return new File(parent, fileName); } return null; }
From source file:com.doctor330.cloud.modules.act.rest.editor.model.ModelEditorJsonRestResource.java
@RequiresPermissions("act:model:edit") @RequestMapping(value = "/act/service/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json") public ObjectNode getEditorJson(@PathVariable String modelId) { ObjectNode modelNode = null;// w w w . ja v a2 s .c o m Model model = repositoryService.getModel(modelId); if (model != null) { try { if (StringUtils.isNotEmpty(model.getMetaInfo())) { modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo()); } else { modelNode = objectMapper.createObjectNode(); modelNode.put(MODEL_NAME, model.getName()); } modelNode.put(MODEL_ID, model.getId()); ObjectNode editorJsonNode = (ObjectNode) objectMapper .readTree(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")); modelNode.put("model", editorJsonNode); } catch (Exception e) { LOGGER.error("Error creating model JSON", e); throw new ActivitiException("Error creating model JSON", e); } } return modelNode; }
From source file:models.CodeCommentThread.java
public boolean isOnAllChangesOfPullRequest() { return isOnChangesOfPullRequest() && StringUtils.isNotEmpty(prevCommitId); }