List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:com.googlecode.starflow.engine.xml.NodeUtil.java
/** * ?elementpathint/*from w w w.j av a 2 s .c o m*/ * * @param element * @param path * @return */ public static int getNodeIntValue(Element element, String path) { Node node = element.selectSingleNode(path); if (node != null) { if (StringUtils.hasText(node.getText())) return Integer.parseInt(node.getText()); else return 0; } else return 0; }
From source file:io.spring.TaskProcessor.java
@Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT) public Object setupRequest(String message) { Map<String, String> properties = new HashMap<String, String>(); if (StringUtils.hasText(processorProperties.getDataSourceUrl())) { properties.put("spring_datasource_url", processorProperties.getDataSourceUrl()); }// w w w. j a va2s . c o m if (StringUtils.hasText(processorProperties.getDataSourceDriverClassName())) { properties.put("spring_datasource_driverClassName", processorProperties.getDataSourceDriverClassName()); } if (StringUtils.hasText(processorProperties.getDataSourceUserName())) { properties.put("spring_datasource_username", processorProperties.getDataSourceUserName()); } if (StringUtils.hasText(processorProperties.getDataSourcePassword())) { properties.put("spring_datasource_password", processorProperties.getDataSourcePassword()); } properties.put("payload", message); TaskLaunchRequest request = new TaskLaunchRequest(processorProperties.getUri(), null, properties, null, processorProperties.getApplicationName()); return new GenericMessage<TaskLaunchRequest>(request); }
From source file:org.wallride.web.controller.admin.comment.CommentSearchForm.java
public MultiValueMap<String, String> toQueryParams() { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); if (StringUtils.hasText(keyword)) { params.add("keyword", keyword); }//from ww w. j a v a 2s . c o m return params; }
From source file:org.springmodules.validation.bean.conf.loader.xml.handler.ExpressionClassValidationElementHandler.java
protected AbstractValidationRule createValidationRule(Element element) { String expression = element.getAttribute(CONDITION_ATTR); if (!StringUtils.hasText(expression)) { throw new ValidationConfigurationException( "Element '" + ELEMENT_NAME + "' must have a '" + CONDITION_ATTR + "' attribute"); }/*from w w w .ja v a 2 s. c om*/ return new ExpressionValidationRule(getConditionExpressionParser(), expression); }
From source file:demo.config.diff.ConfigDiffSample.java
private static StringBuilder appendProperty(StringBuilder sb, ConfigurationMetadataProperty property, boolean add) { String symbol = add ? "[+]" : "[-]"; sb.append(symbol).append(" ").append(property.getId()); String shortDescription = property.getShortDescription(); if (StringUtils.hasText(shortDescription)) { sb.append(" - ").append(shortDescription); }//from ww w.j a v a 2 s.c om return sb; }
From source file:com.github.ebnew.ki4so.core.authentication.handlers.SimpleTestUsernamePasswordAuthenticationHandler.java
@Override public boolean authenticateUsernamePasswordInternal(final KnightNamePasswordCredential credential) { final String username = credential.getUsername(); final String password = credential.getPassword(); if (StringUtils.hasText(username) && StringUtils.hasText(password) && username.equals(getPasswordEncoder().encode(password))) { return true; }//from w w w. j a v a 2 s . c o m throw UsernameOrPasswordInvalidException.INSTANCE; }
From source file:com.frank.search.solr.core.query.SimpleTermsQuery.java
@Override public String getRequestHandler() { return StringUtils.hasText(super.getRequestHandler()) ? super.getRequestHandler() : DEFAULT_REQUEST_HANDLER; }
From source file:com.dinstone.jrpc.spring.spi.ServerBeanDefinitionParser.java
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String id = element.getAttribute("id"); if (!StringUtils.hasText(id)) { builder.addPropertyValue("serverId", Server.class.getName()); element.setAttribute("id", Server.class.getName()); }/*from w w w.j a va 2 s .c o m*/ // ================================================ // Transport config // ================================================ builder.addPropertyValue("transportBean", getTransportBeanDefinition(element, parserContext)); // ================================================ // Registry config // ================================================ builder.addPropertyValue("registryBean", getRegistryBeanDefinition(element, parserContext)); // ================================================ // Services config // ================================================ builder.addPropertyValue("services", getServiceBeanDefinition(element, parserContext)); }
From source file:org.spring.data.gemfire.config.RegionPutAllBeanPostProcessor.java
protected String getTargetBeanName() { Assert.state(StringUtils.hasText(targetBeanName), "The target Spring context bean name was not properly specified!"); return targetBeanName; }
From source file:se.alingsas.alfresco.share.evaluator.documentlibrary.action.DocumentSecrecyIsSet.java
@Override public boolean evaluate(JSONObject jsonObject) { try {// ww w . j a v a 2 s . c om String property = (String) getProperty(jsonObject, DOC_SECRECY_PROPERTY); if (StringUtils.hasText(property)) { return true; } return false; } catch (Exception err) { throw new AlfrescoRuntimeException( "JSONException whilst running action evaluator: " + err.getMessage()); } }