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:edu.usu.sdl.openstorefront.web.rest.JsonpInterceptor.java
@Override public void aroundWriteTo(WriterInterceptorContext responseContext) throws IOException { String callback = (String) responseContext.getProperty(CALLBACK); if (StringUtils.isNotBlank(callback)) { responseContext.getOutputStream().write((callback + "(").getBytes()); responseContext.proceed();/* w w w. j a v a2 s . com*/ responseContext.getOutputStream().write(")".getBytes()); } else { responseContext.proceed(); } }
From source file:au.csiro.casda.sodalint.ValidateCapabilities.java
/** {@inheritDoc} */ @Override//www .ja va 2s . c o m public void run(Reporter reporter, SodaService sodaService, String testDataProductId) { String xmlContent = getCapabilities(reporter, sodaService.getServiceUrl()); if (StringUtils.isNotBlank(xmlContent)) { validateCapabilities(reporter, xmlContent, sodaService); } TextOutputReporter textOutputReporter = (TextOutputReporter) reporter; textOutputReporter.summariseUnreportedMessages(textOutputReporter.getSectionCode()); }
From source file:com.ctrip.infosec.rule.converter.Airport3Code2CityConverter.java
@Override public void convert(PreActionEnums preAction, Map fieldMapping, RiskFact fact, String resultWrapper, boolean isAsync) throws Exception { PreActionParam[] fields = preAction.getFields(); String airport3codeFieldName = (String) fieldMapping.get(fields[0].getParamName()); String airport3codeFieldValue = valueAsString(fact.eventBody, airport3codeFieldName); // prefix default value if (Strings.isNullOrEmpty(resultWrapper)) { resultWrapper = airport3codeFieldName + "_AirPortCity"; }//ww w . j a v a 2s . c o m // if (fact.eventBody.containsKey(resultWrapper)) { return; } if (StringUtils.isNotBlank(airport3codeFieldValue)) { Map params = ImmutableMap.of("airport", airport3codeFieldValue); Map result = DataProxy.queryForMap(serviceName, operationName, params); if (result != null && !result.isEmpty()) { fact.eventBody.put(resultWrapper, result); } else { TraceLogger.traceLog("?. airport=" + airport3codeFieldValue); } } }
From source file:com.github.woki.payments.adyen.action.ActionUtilEncryptionTest.java
@Test public void testEncryption() throws Exception { String result = CSEUtil.encrypt(CSEUtil.aesCipher(), CSEUtil.rsaCipher(PUBKEY_TEXT), "4444444444444444"); System.out.println(result);// w ww .j a va2 s. co m Assert.assertTrue(StringUtils.isNotBlank(result)); }
From source file:com.netflix.genie.common.dto.ClusterCriteria.java
/** * Create a cluster criteria object with the included tags. * * @param tags The tags to add. Not null or empty and must have at least one non-empty tag. *//*from w w w.java 2 s .c o m*/ @JsonCreator public ClusterCriteria(@JsonProperty("tags") final Set<String> tags) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); tags.forEach(tag -> { if (StringUtils.isNotBlank(tag)) { builder.add(tag); } }); this.tags = builder.build(); }
From source file:io.wcm.devops.conga.plugins.aem.util.ContentPackageBinaryFile.java
/** * @param urlFileManager URL file manager * @param targetDir Target directory for configuration * @return Input stream with binary data of file. * @throws IOException I/O exception//from w ww . java2s . c o m */ public InputStream getInputStream(UrlFileManager urlFileManager, File targetDir) throws IOException { if (StringUtils.isNotBlank(url)) { return urlFileManager.getFile(url); } File file = getFile(targetDir); if (file != null) { return new BufferedInputStream(new FileInputStream(file)); } else { throw new IllegalArgumentException("For a file definition either url or file has to be specified."); } }
From source file:com.netflix.genie.server.repository.jpa.ClusterSpecs.java
/** * Generate a specification given the parameters. * * @param name The name of the cluster to find * @param statuses The statuses of the clusters to find * @param tags The tags of the clusters to find * @param minUpdateTime The minimum updated time of the clusters to find * @param maxUpdateTime The maximum updated time of the clusters to find * @return The specification/*w ww .j a v a 2 s .co m*/ */ public static Specification<Cluster> find(final String name, final Set<ClusterStatus> statuses, final Set<String> tags, final Long minUpdateTime, final Long maxUpdateTime) { return new Specification<Cluster>() { @Override public Predicate toPredicate(final Root<Cluster> root, final CriteriaQuery<?> cq, final CriteriaBuilder cb) { final List<Predicate> predicates = new ArrayList<>(); if (StringUtils.isNotBlank(name)) { predicates.add(cb.like(root.get(Cluster_.name), name)); } if (minUpdateTime != null) { predicates.add(cb.greaterThanOrEqualTo(root.get(Cluster_.updated), new Date(minUpdateTime))); } if (maxUpdateTime != null) { predicates.add(cb.lessThan(root.get(Cluster_.updated), new Date(maxUpdateTime))); } if (tags != null) { for (final String tag : tags) { if (StringUtils.isNotBlank(tag)) { predicates.add(cb.isMember(tag, root.get(Cluster_.tags))); } } } if (statuses != null && !statuses.isEmpty()) { //Could optimize this as we know size could use native array final List<Predicate> orPredicates = new ArrayList<>(); for (final ClusterStatus status : statuses) { orPredicates.add(cb.equal(root.get(Cluster_.status), status)); } predicates.add(cb.or(orPredicates.toArray(new Predicate[orPredicates.size()]))); } return cb.and(predicates.toArray(new Predicate[predicates.size()])); } }; }
From source file:com.labs64.netlicensing.service.ProductModuleService.java
/** * Creates new product module object with given properties. * /* w w w.j a v a 2s.c o m*/ * @param context * determines the vendor on whose behalf the call is performed * @param productNumber * parent product to which the new product module is to be added * @param productModule * non-null properties will be taken for the new object, null properties will either stay null, or will * be set to a default value, depending on property. * @return the newly created product module object * @throws com.labs64.netlicensing.exception.NetLicensingException * any subclass of {@linkplain com.labs64.netlicensing.exception.NetLicensingException}. These exceptions will be transformed to the * corresponding service response messages. */ public static ProductModule create(final Context context, final String productNumber, final ProductModule productModule) throws NetLicensingException { CheckUtils.paramNotNull(productModule, "productNumber"); final Form form = productModule.asRequestForm(); if (StringUtils.isNotBlank(productNumber)) { form.param(Constants.Product.PRODUCT_NUMBER, productNumber); } return NetLicensingService.getInstance().post(context, Constants.ProductModule.ENDPOINT_PATH, form, ProductModule.class); }
From source file:com.labs64.netlicensing.service.TokenService.java
/** * Returns tokens of a vendor./*w w w . jav a2 s . co m*/ * * @param context * determines the vendor on whose behalf the call is performed * @param filter * additional criteria to filter type of tokens to return, if NULL return tokens of all types * @return collection of token entities or null/empty list if nothing found. * @throws com.labs64.netlicensing.exception.NetLicensingException * any subclass of {@linkplain com.labs64.netlicensing.exception.NetLicensingException}. These * exceptions will be transformed to the corresponding service response messages. */ public static Page<Token> list(final Context context, final String filter) throws NetLicensingException { final Map<String, Object> params = new HashMap<String, Object>(); if (StringUtils.isNotBlank(filter)) { params.put(Constants.FILTER, filter); } return NetLicensingService.getInstance().list(context, Constants.Token.ENDPOINT_PATH, params, Token.class); }