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.netflix.genie.server.repository.jpa.JobSpecs.java
/** * Find jobs based on the parameters.//from ww w . j a va 2 s.c om * * @param id The job id * @param jobName The job name * @param userName The user who created the job * @param statuses The job statuses * @param tags The tags for the jobs to find * @param clusterName The cluster name * @param clusterId The cluster id * @param commandName The command name * @param commandId The command id * @return The specification */ public static Specification<Job> find(final String id, final String jobName, final String userName, final Set<JobStatus> statuses, final Set<String> tags, final String clusterName, final String clusterId, final String commandName, final String commandId) { return new Specification<Job>() { @Override public Predicate toPredicate(final Root<Job> root, final CriteriaQuery<?> cq, final CriteriaBuilder cb) { final List<Predicate> predicates = new ArrayList<>(); if (StringUtils.isNotBlank(id)) { predicates.add(cb.like(root.get(Job_.id), id)); } if (StringUtils.isNotBlank(jobName)) { predicates.add(cb.like(root.get(Job_.name), jobName)); } if (StringUtils.isNotBlank(userName)) { predicates.add(cb.equal(root.get(Job_.user), userName)); } if (statuses != null && !statuses.isEmpty()) { //Could optimize this as we know size could use native array final List<Predicate> orPredicates = new ArrayList<>(); for (final JobStatus status : statuses) { orPredicates.add(cb.equal(root.get(Job_.status), status)); } predicates.add(cb.or(orPredicates.toArray(new Predicate[orPredicates.size()]))); } if (tags != null) { for (final String tag : tags) { if (StringUtils.isNotBlank(tag)) { predicates.add(cb.isMember(tag, root.get(Job_.tags))); } } } if (StringUtils.isNotBlank(clusterName)) { predicates.add(cb.equal(root.get(Job_.executionClusterName), clusterName)); } if (StringUtils.isNotBlank(clusterId)) { predicates.add(cb.equal(root.get(Job_.executionClusterId), clusterId)); } if (StringUtils.isNotBlank(commandName)) { predicates.add(cb.equal(root.get(Job_.commandName), commandName)); } if (StringUtils.isNotBlank(commandId)) { predicates.add(cb.equal(root.get(Job_.commandId), commandId)); } return cb.and(predicates.toArray(new Predicate[predicates.size()])); } }; }
From source file:com.synopsys.integration.blackduck.codelocation.CodeLocationBatchOutput.java
public CodeLocationBatchOutput(List<T> outputs) { successfulCodeLocationNamesToExpectedNotificationCounts = outputs.stream().peek(this.outputs::add) .filter(output -> Result.SUCCESS == output.getResult()) .filter(output -> StringUtils.isNotBlank(output.getCodeLocationName())).collect(Collectors.toMap( CodeLocationOutput::getCodeLocationName, CodeLocationOutput::getExpectedNotificationCount)); }
From source file:ch.cyberduck.ui.browser.PathTooltipService.java
public String getTooltip(final Path file) { final StringBuilder tooltip = new StringBuilder(file.getAbsolute()); if (StringUtils.isNotBlank(file.attributes().getRegion())) { tooltip.append("\n").append(file.attributes().getRegion()); }/*from ww w . ja v a 2 s. co m*/ final Checksum checksum = file.attributes().getChecksum(); if (Checksum.NONE != checksum) { tooltip.append("\n").append( String.format("%s %s", StringUtils.upperCase(checksum.algorithm.name()), checksum.hash)); } if (StringUtils.isNotBlank(file.attributes().getVersionId())) { tooltip.append("\n").append(file.attributes().getVersionId()); } tooltip.append("\n").append(sizeFormatter.format(file.attributes().getSize())); tooltip.append("\n").append(dateFormatter.getLongFormat(file.attributes().getModificationDate())); return tooltip.toString(); }
From source file:jp.co.golorp.emarf.tag.lib.base.model.property.Legend.java
/** * @param modelName/*w w w . j av a 2 s. co m*/ * modelName * @param propertyName * propertyName * @param pageName * pageName * @param notnull * notnull * @return */ public static final String render(final String modelName, final String propertyName, final String pageName, final boolean notnull) { // ??? String label = ModelUtil.getModelMei(modelName); if (StringUtils.isNotBlank(propertyName)) { // ????????? Map<String, String> propertyMeis = ModelUtil.getPropertyMeis(modelName); if (propertyMeis != null) { label = propertyMeis.get(propertyName); } } else if (pageName.equalsIgnoreCase(EmarfServlet.PAGE_INDEX)) { // ??????????? label = INDEX_DEFAULT; } StringBuilder sb = new StringBuilder("<legend>").append(label); if (notnull) { sb.append(" ").append(Label.NOTNULL_MARK); } sb.append("</legend>"); return sb.toString(); }
From source file:com.monarchapis.client.authentication.SimpleAuthRequestProcessor.java
@Override public void processRequest(BaseClient<?> client) { client.addHeader("X-Api-Key", apiKey); if (accessTokenSource != null) { String accessToken = accessTokenSource.getAccessToken(); if (StringUtils.isNotBlank(accessToken)) { client.addHeader("Authorization", "Bearer " + accessToken); }//from w w w.j av a 2 s .c o m } }
From source file:com.ufukuzun.myth.dialect.util.ExpressionUtils.java
public static boolean isRenderExpression(String value) { String[] result = splitRenderFragmentAndUpdates(value); return StringUtils.isNotBlank(result[0]) && StringUtils.isNotBlank(result[1]); }
From source file:cd.go.notification.gitter.PluginRequest.java
public PluginSettings getPluginSettings() throws ServerRequestFailedException { DefaultGoApiRequest request = new DefaultGoApiRequest(Constants.REQUEST_SERVER_GET_PLUGIN_SETTINGS, Constants.API_VERSION, Constants.PLUGIN_IDENTIFIER); GoApiResponse response = accessor.submit(request); if (response.responseCode() != 200) { throw ServerRequestFailedException.getPluginSettings(response); }//from w ww . j av a2 s. co m if (StringUtils.isNotBlank(response.responseBody())) { return PluginSettings.fromJSON(response.responseBody()); } return new PluginSettings(); }
From source file:ch.cyberduck.core.googledrive.DriveUrlProvider.java
@Override public DescriptiveUrlBag toUrl(Path file) { final DescriptiveUrlBag list = new DescriptiveUrlBag(); if (file.isFile()) { try {/*from ww w. jav a 2s.co m*/ if (StringUtils.isBlank(file.attributes().getVersionId())) { return DescriptiveUrlBag.empty(); } final File f = session.getClient().files().get(file.attributes().getVersionId()).execute(); if (StringUtils.isNotBlank(f.getWebContentLink())) { list.add(new DescriptiveUrl(URI.create(f.getWebContentLink()), DescriptiveUrl.Type.http, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), "HTTP"))); } if (StringUtils.isNotBlank(f.getWebViewLink())) { list.add(new DescriptiveUrl(URI.create(f.getWebViewLink()), DescriptiveUrl.Type.http, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), "Download"))); } } catch (IOException e) { new DriveExceptionMappingService().map(e); } } return list; }
From source file:com.book.identification.BookFile.java
public boolean hasISBN() { return StringUtils.isNotBlank(isbn); }
From source file:cop.raml.mocks.annotations.RequestMappingMock.java
public RequestMappingMock addConsumes(String mediaType) { if (StringUtils.isNotBlank(mediaType) && !consumes.contains(mediaType)) consumes.add(mediaType);/*from ww w .j a va 2s . c o m*/ return this; }