List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:com.gopivotal.spring.xd.module.jdbc.JdbcJobModuleOptionMetadata.java
@AssertTrue(message = "Use 'sql' AND/OR 'script' to define the sql to be executed") boolean isEitherSqlOrScript() { return StringUtils.hasText(sql) || StringUtils.hasText(script); }
From source file:net.paslavsky.springrest.UriBuilder.java
private UriComponentsBuilder createOrAdd(UriComponentsBuilder builder, String path) { if (StringUtils.hasText(path)) { if (builder != null) { if (!path.startsWith("/")) { builder.path("/"); }//from w w w . j a v a 2s . c o m builder.path(path); } else { builder = UriComponentsBuilder.fromHttpUrl(path); } } return builder; }
From source file:org.wallride.web.controller.admin.article.ArticleSearchForm.java
public boolean isEmpty() { if (StringUtils.hasText(getKeyword())) { return false; }//from w w w. ja va 2 s . c om if (getStatus() != null) { return false; } return true; }
From source file:endpoints.LinksMvcEndpoint.java
@RequestMapping(value = { "/", "" }) @ResponseBody/*from ww w.j a va2 s . c o m*/ public ResourceSupport links() { ResourceSupport map = new ResourceSupport(); String rel = this.path.startsWith("/") ? this.path.substring(1) : StringUtils.hasText(this.path) ? this.path : "links"; map.add(linkTo(EndpointHypermediaAutoConfiguration.class).slash(this.rootPath + getPath()).withRel(rel)); for (MvcEndpoint endpoint : getEndpoints()) { if (endpoint.getPath().equals(this.getPath())) { continue; } Class<?> type = endpoint.getEndpointType(); if (type == null) { type = Object.class; } map.add(linkTo(type).slash(this.rootPath + endpoint.getPath()) .withRel(endpoint.getPath().substring(1))); } return map; }
From source file:org.opencredo.cloud.storage.si.adapter.config.OutboundChannelAdapterParser.java
/** * @param element// www. j a v a 2 s .c o m * @param parserContext */ @Override protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder .genericBeanDefinition(WritingMessageHandler.class.getName()); String templateRef = element.getAttribute(AdapterParserUtils.TEMPLATE_REF_ATTRIBUTE); String containerName = element.getAttribute(AdapterParserUtils.CONTAINER_NAME_ATTRIBUTE); String nameBuilderRef = element.getAttribute(AdapterParserUtils.NAME_BUILDER_ATTRIBUTE); builder.addConstructorArgReference(templateRef); builder.addConstructorArgValue(containerName); if (StringUtils.hasText(nameBuilderRef)) { builder.addConstructorArgReference(nameBuilderRef); } return builder.getBeanDefinition(); }
From source file:com.changhong.sso.core.authentication.handlers.DefaultPasswordEncoder.java
public String encode(final String password) { if (password == null) { return null; }/*from ww w . ja va 2 s . c o m*/ try { MessageDigest messageDigest = MessageDigest.getInstance(this.encodingAlgorithm); if (StringUtils.hasText(this.characterEncoding)) { messageDigest.update(password.getBytes(this.characterEncoding)); } else { messageDigest.update(password.getBytes()); } final byte[] digest = messageDigest.digest(); return getFormattedText(digest); } catch (final NoSuchAlgorithmException e) { throw new SecurityException(e); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } }
From source file:gda.device.detector.mythen.data.MythenSrsFileLoader.java
protected String[] read(BufferedReader br) throws IOException { // skip through header String line = br.readLine();//from www . j a v a 2s . c o m while (line != null && !line.contains("&END")) { line = br.readLine(); } if (line == null) { throw new IOException("Reached end of file without seeing &END line"); } // read data header; find column containing Mythen filenames String headerLine = br.readLine(); if (!StringUtils.hasText(headerLine)) { throw new IOException("Didn't find column list"); } List<String> headers = Arrays.asList(headerLine.split("\t")); int mythenColumn = headers.indexOf("mythen"); if (mythenColumn == -1) { throw new IOException("Couldn't find 'mythen' column"); } // read rest of data file; extract Mythen filename from each line List<String> filenames = new Vector<String>(); while ((line = br.readLine()) != null) { String[] values = line.split("\t"); String filenameValue = values[mythenColumn]; filenames.add(filenameValue); } br.close(); return filenames.toArray(new String[filenames.size()]); }
From source file:sipackage.config.xml.SIAdapterUpperPrefixOutboundGatewayParser.java
@Override protected BeanDefinitionBuilder parseHandler(Element gatewayElement, ParserContext parserContext) { final BeanDefinitionBuilder siAdapterLowerPrefixOutboundGatewayBuilder = BeanDefinitionBuilder .genericBeanDefinition(SIAdapterUpperPrefixOutboundGateway.class); IntegrationNamespaceUtils.setValueIfAttributeDefined(siAdapterLowerPrefixOutboundGatewayBuilder, gatewayElement, "reply-timeout", "sendTimeout"); final String replyChannel = gatewayElement.getAttribute("reply-channel"); if (StringUtils.hasText(replyChannel)) { siAdapterLowerPrefixOutboundGatewayBuilder.addPropertyReference("outputChannel", replyChannel); }//from www . j a v a 2s .c o m final BeanDefinitionBuilder siAdapterLowerPrefixExecutorBuilder = SIAdapterUpperPrefixParserUtils .getSIAdapterUpperPrefixExecutorBuilder(gatewayElement, parserContext); IntegrationNamespaceUtils.setValueIfAttributeDefined(siAdapterLowerPrefixExecutorBuilder, gatewayElement, "example-property"); final BeanDefinition siAdapterLowerPrefixExecutorBuilderBeanDefinition = siAdapterLowerPrefixExecutorBuilder .getBeanDefinition(); final String gatewayId = this.resolveId(gatewayElement, siAdapterLowerPrefixOutboundGatewayBuilder.getRawBeanDefinition(), parserContext); final String siAdapterLowerPrefixExecutorBeanName = gatewayId + ".siAdapterLowerPrefixExecutor"; parserContext.registerBeanComponent(new BeanComponentDefinition( siAdapterLowerPrefixExecutorBuilderBeanDefinition, siAdapterLowerPrefixExecutorBeanName)); siAdapterLowerPrefixOutboundGatewayBuilder.addConstructorArgReference(siAdapterLowerPrefixExecutorBeanName); return siAdapterLowerPrefixOutboundGatewayBuilder; }
From source file:com.streamreduce.datasource.MongoFactoryBean.java
@Override protected Mongo createInstance() throws Exception { if (StringUtils.hasText(this.hostname)) { return new Mongo(new ServerAddress(hostname, port), getMongoOptions()); } else {// w w w. j a va 2 s .com return new Mongo(); } }
From source file:com.gradecak.alfresco.mvc.Query.java
public Query exactOr(Map<QName, Serializable> properties) { for (Entry<QName, Serializable> entry : properties.entrySet()) { Object value = entry.getValue(); String convert = value == null ? null : convert(value); if (StringUtils.hasText(convert)) { this.or(); this.property(entry.getKey()).exact(value); }//from w w w . j a v a 2 s .c om } return this; }