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.fredhopper.core.connector.index.upload.impl.RestTemplateProvider.java
public RestTemplate createTemplate(final String host, final Integer port, final String username, final String password) { Preconditions.checkArgument(StringUtils.isNotBlank(host)); Preconditions.checkArgument(port != null); Preconditions.checkArgument(StringUtils.isNotBlank(username)); Preconditions.checkArgument(StringUtils.isNotBlank(password)); final AuthScope authscope = new AuthScope(host, port.intValue()); final Credentials credentials = new UsernamePasswordCredentials(username, password); final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(authscope, credentials); final HttpClientBuilder clientBuilder = HttpClientBuilder.create(); clientBuilder.setDefaultCredentialsProvider(credentialsProvider); final CloseableHttpClient httpClient = clientBuilder.build(); final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient(httpClient); return new RestTemplate(requestFactory); }
From source file:io.lavagna.common.LavagnaEnvironment.java
public LavagnaEnvironment(ConfigurableEnvironment environment) { this.environment = environment; if (environment.containsProperty(LAVAGNA_CONFIG_LOCATION) && StringUtils.isNotBlank(environment.getProperty(LAVAGNA_CONFIG_LOCATION))) { String configLocation = environment.getProperty(LAVAGNA_CONFIG_LOCATION); LOG.info("Detected config file {}, loading it", configLocation); try {/*www .j av a 2 s. c o m*/ environment.getPropertySources() .addFirst(new ResourcePropertySource(new UrlResource(configLocation))); } catch (IOException ioe) { throw new IllegalStateException( "error while loading external configuration file at " + configLocation, ioe); } } setSystemPropertyIfNull(environment, "datasource.dialect", "HSQLDB"); setSystemPropertyIfNull(environment, "datasource.url", "jdbc:hsqldb:mem:lavagna"); setSystemPropertyIfNull(environment, "datasource.username", "sa"); setSystemPropertyIfNull(environment, "datasource.password", ""); setSystemPropertyIfNull(environment, "spring.profiles.active", "dev"); logUse("datasource.dialect"); logUse("datasource.url"); logUse("datasource.username"); logUse("spring.profiles.active"); }
From source file:io.github.moosbusch.lumpi.gui.form.spi.AbstractSubmitableForm.java
public static String createFormFieldName(String beanClassName, String propertyName) { if (StringUtils.isNotBlank(propertyName)) { return beanClassName + "." + propertyName.toLowerCase(); }/* w w w .j av a 2 s . c om*/ return beanClassName; }
From source file:com.moviejukebox.model.scriptablescraper.ReplaceSS.java
public void setPattern(String pattern) { if (StringUtils.isNotBlank(pattern)) { this.pattern = pattern; } }
From source file:be.hogent.aem.core.models.DialogModel.java
public String getText() { return StringUtils.isNotBlank(text) ? text : "Please provide a Test"; }
From source file:com.alibaba.datax.plugin.reader.odpsreader.util.IdAndKeyUtil.java
private static Configuration getAccessIdAndKeyFromEnv(Configuration originalConfig, Map<String, String> envProp) { String accessId = null;/* ww w . j a v a 2 s . c o m*/ String accessKey = null; String skynetAccessID = envProp.get(Constant.SKYNET_ACCESSID); String skynetAccessKey = envProp.get(Constant.SKYNET_ACCESSKEY); if (StringUtils.isNotBlank(skynetAccessID) || StringUtils.isNotBlank(skynetAccessKey)) { /** * ??SKYNET_ACCESSID/SKYNET_ACCESSKEy????? * odpsaccessId/accessKey() */ LOG.info("Try to get accessId/accessKey from environment."); accessId = skynetAccessID; accessKey = DESCipher.decrypt(skynetAccessKey); if (StringUtils.isNotBlank(accessKey)) { originalConfig.set(Key.ACCESS_ID, accessId); originalConfig.set(Key.ACCESS_KEY, accessKey); LOG.info("Get accessId/accessKey from environment variables successfully."); } else { throw DataXException.asDataXException(OdpsReaderErrorCode.GET_ID_KEY_FAIL, String .format("???accessId/accessKey , accessId=[%s]", accessId)); } } else { // ???? throw DataXException.asDataXException(OdpsReaderErrorCode.GET_ID_KEY_FAIL, "?accessId/accessKey. ?????."); } return originalConfig; }
From source file:com.alibaba.datax.plugin.writer.odpswriter.util.IdAndKeyUtil.java
private static Configuration getAccessIdAndKeyFromEnv(Configuration originalConfig, Map<String, String> envProp) { String accessId = null;//from ww w. j a va 2 s .c o m String accessKey = null; String skynetAccessID = envProp.get(Constant.SKYNET_ACCESSID); String skynetAccessKey = envProp.get(Constant.SKYNET_ACCESSKEY); if (StringUtils.isNotBlank(skynetAccessID) || StringUtils.isNotBlank(skynetAccessKey)) { /** * ??SKYNET_ACCESSID/SKYNET_ACCESSKEy????? * odpsaccessId/accessKey() */ LOG.info("Try to get accessId/accessKey from environment."); accessId = skynetAccessID; accessKey = DESCipher.decrypt(skynetAccessKey); if (StringUtils.isNotBlank(accessKey)) { originalConfig.set(Key.ACCESS_ID, accessId); originalConfig.set(Key.ACCESS_KEY, accessKey); LOG.info("Get accessId/accessKey from environment variables successfully."); } else { throw DataXException.asDataXException(OdpsWriterErrorCode.GET_ID_KEY_FAIL, String .format("???accessId/accessKey , accessId=[%s]", accessId)); } } else { // ???? throw DataXException.asDataXException(OdpsWriterErrorCode.GET_ID_KEY_FAIL, "?accessId/accessKey. ?????."); } return originalConfig; }
From source file:de.micromata.genome.gwiki.page.impl.wiki.fragment.GWikiFragmentHeading.java
public void renderBody(GWikiContext ctx) { if (StringUtils.isNotBlank(text) == true) { ctx.append(WebUtils.escapeHtml(text)); } else {/*from ww w . j a v a2 s. c om*/ renderChilds(ctx); } }
From source file:de.micromata.tpsb.doc.parser.JavaDocUtil.java
public static JavaDocInfo parseJavaDoc(String cleanedContent) { JavaDocInfo javaDocInfo = new JavaDocInfo(); Pair<String, String> titleAndDesc = extractTitleAndDescription(cleanedContent); if (StringUtils.isNotBlank(titleAndDesc.getFirst())) { javaDocInfo.setTitle(titleAndDesc.getFirst()); }// www. jav a 2 s .c om if (StringUtils.isNotBlank(titleAndDesc.getSecond())) { javaDocInfo.setDescription(titleAndDesc.getSecond()); } Map<String, List<Pair<String, String>>> tags = extractTags(cleanedContent); if (tags != null && tags.size() != 0) { javaDocInfo.setTags(tags); } return javaDocInfo; }
From source file:com.plugin.excel.xsd.node.store.impl.XsdNodeTraverserImpl.java
private void traverse(GroupNode group) { if (group != null) { System.out.println("**********Start: " + group.getType().value() + "**********"); if (group.getViews() != null && !group.getViews().isEmpty()) { for (NodeView view : group.getViews()) { System.out.print("name: " + view.getNodeTagName()); if (StringUtils.isNotBlank(view.getComplexNodeTypeName())) { System.out.print(", ComplexType: " + view.getComplexNodeTypeName()); }/* w w w . j a v a 2s . com*/ if (StringUtils.isNotBlank(view.getSimpleNodeTypeName())) { System.out.print(", SimpleType: " + view.getSimpleNodeTypeName()); } if (StringUtils.isNotBlank(view.getMinOccurs())) { System.out.print(", min: " + view.getMinOccurs()); } if (StringUtils.isNotBlank(view.getMaxOccurs())) { System.out.print(", max: " + view.getMaxOccurs()); } if (view.getNode() != null && view.getNode().getRestriction() != null) { System.out.print(", baseType: " + view.getNode().getRestriction().getBaseType()); System.out.print(", charLength: " + view.getNode().getRestriction().getCharacterLength()); System.out.print(", EnumValues: " + view.getNode().getRestriction().getEnumValues()); } if (view.getNode() != null && view.getNode().getGroup() != null) { traverse(view.getNode().getGroup()); } System.out.println("end of name: " + view.getNodeTagName()); } } if (group.getGroups() != null && !group.getGroups().isEmpty()) { for (GroupNode grp : group.getGroups()) { traverse(grp); } } System.out.println("**********End: " + group.getType().value() + "**********"); } }