Example usage for org.springframework.util StringUtils hasText

List of usage examples for org.springframework.util StringUtils hasText

Introduction

In this page you can find the example usage for org.springframework.util StringUtils hasText.

Prototype

public static boolean hasText(@Nullable String str) 

Source Link

Document

Check whether the given String contains actual text.

Usage

From source file:csns.importer.StudentsImporter.java

public void setText(String text) {
    if (StringUtils.hasText(text)) {
        this.text = text;
        importedStudents = usersParser.parse(text);
    }
}

From source file:com.ge.predix.uaa.token.lib.JsonUtils.java

public static JsonNode readTree(final String s) {
    try {// w w w .  j  a v a 2s. c o  m
        if (StringUtils.hasText(s)) {
            return objectMapper.readTree(s);
        } else {
            return null;
        }
    } catch (JsonProcessingException e) {
        throw new JsonUtilException(e);
    } catch (IOException e) {
        throw new JsonUtilException(e);
    }
}

From source file:org.jolokia.jvmagent.spring.config.ConfigBeanDefinitionParser.java

@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    Map<String, Object> config = new HashMap<String, Object>();
    builder.addPropertyValue("config", createConfigMap(element.getAttributes()));
    String order = element.getAttribute("order");
    if (StringUtils.hasText(order)) {
        builder.addPropertyValue("order", Integer.parseInt(order));
    }//  w  ww. jav  a2s .co  m
}

From source file:org.web4thejob.model.CalendarEventEntity.java

private Object getValue(CalendarSettingEnum id) {
    if (mappings.containsKey(id)) {
        Setting setting = mappings.get(id);
        if (setting.getValue() != null && StringUtils.hasText(setting.getValue().toString())) {
            return beanWrapper.getPropertyValue((String) setting.getValue());
        }/*  w w  w .  j a v a 2  s. c  o m*/
    }
    return null;
}

From source file:org.bremersee.common.spring.autoconfigure.AbstractJmsDestinationProperties.java

public AbstractJmsDestinationProperties(String destinationName, boolean pubSubDomain, String concurrency) {
    this.destinationName = destinationName;
    this.pubSubDomain = pubSubDomain;
    if (StringUtils.hasText(concurrency)) {
        this.concurrency = concurrency;
    }/*from  ww  w  .  ja  v  a  2s.co  m*/
}

From source file:com.googlecode.starflow.engine.handle.impl.ToolAppHandlerAdapter.java

public void action(final ActivityStartEvent event, final ActivityInst activityInst) {
    ActivityElement activityXml = event.getProcessElement().getActivitys().get(activityInst.getActivityDefId());
    String beanName = activityXml.getExecuteAction();
    if (StringUtils.hasText(beanName)) {
        IAction action = new Action(beanName);
        action(event, activityInst, activityXml, action);
    } else {/*  www .  java 2 s.  c om*/
        logger.warn("?{}", activityXml.getName());
    }
}

From source file:fr.mby.portal.coreimpl.app.BasicAppSigner.java

@Override
public String retrieveSignature(final HttpServletRequest request) {
    String signature = null;/*from  w  w w.j av a  2 s .  c om*/

    final Object attrObject = request.getAttribute(IPortal.SIGNATURE_PARAM_NAME);
    if (attrObject != null && attrObject instanceof String) {
        signature = (String) attrObject;
    }

    if (!StringUtils.hasText(signature)) {
        signature = request.getParameter(IPortal.SIGNATURE_PARAM_NAME);
    }

    if (!StringUtils.hasText(signature)) {
        final Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (final Cookie cookie : cookies) {
                if (cookie != null && IPortal.SIGNATURE_PARAM_NAME.equals(cookie.getName())) {
                    signature = cookie.getValue();
                }
            }
        }
    }

    if (!StringUtils.hasText(signature)) {
        request.setAttribute(IPortal.SIGNATURE_PARAM_NAME, signature);
    }

    return signature;
}

From source file:fr.mby.saml2.sp.impl.om.SamlOutgoingMessage.java

@Override
public String getHttpRedirectBindingUrl() {
    if (!StringUtils.hasText(this.httpRedirectBindingUrl)) {
        this.httpRedirectBindingUrl = this.buildHttpRedirectBindingUrl();
    }/*w ww  .j a v  a  2s . c  o m*/

    return this.httpRedirectBindingUrl;
}

From source file:net.navasoft.madcoin.backend.services.security.AuthenticationFilter.java

/**
 * Requires authentication./*from w  ww. j a va2s .c o m*/
 * 
 * @param request
 *            the request
 * @param response
 *            the response
 * @return true, if successful, otherwise false
 * @since 27/07/2014, 06:48:55 PM
 */
@Override
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) {
    return (StringUtils.hasText(obtainUsername(request)) && StringUtils.hasText(obtainPassword(request)));
}

From source file:org.springmodules.validation.bean.conf.loader.xml.handler.LengthRuleElementHandler.java

protected AbstractValidationRule createValidationRule(Element element) {

    String minText = element.getAttribute(MIN_ATTR);
    String maxText = element.getAttribute(MAX_ATTR);

    Integer min = (StringUtils.hasText(minText)) ? new Integer(minText) : null;
    Integer max = (StringUtils.hasText(maxText)) ? new Integer(maxText) : null;

    if (min != null && max != null) {
        return new LengthValidationRule(min.intValue(), max.intValue());
    }/*from   ww  w . j ava2 s  .co m*/

    if (min != null) {
        return new MinLengthValidationRule(min.intValue());
    }

    if (max != null) {
        return new MaxLengthValidationRule(max.intValue());
    }

    throw new ValidationConfigurationException(
            "Element '" + ELEMENT_NAME + "' must have either 'min' attribute, 'max' attribute, or both");
}