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:org.springdata.ehcache.repository.config.EhcacheRepositoryConfigurationExtension.java

@Override
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {

    Element element = config.getElement();
    String templateRef = element.getAttribute(XML_CACHE_TEMPLATE_REF);

    if (!StringUtils.hasText(templateRef)) {
        templateRef = ConfigConstants.TEMPLATE_DEFAULT_ID;
    }/* w  ww.  jav  a 2  s. c  o  m*/
    builder.addPropertyReference("ehcacheTemplate", templateRef);

}

From source file:org.wallride.model.UserSearchRequest.java

public boolean isEmpty() {
    if (StringUtils.hasText(getKeyword())) {
        return false;
    }//from w w w .j a v a2s  .c om
    if (!CollectionUtils.isEmpty(getRoles())) {
        return false;
    }
    return true;
}

From source file:org.openregistry.core.web.IdentifierAction.java

public boolean generateActivationKey(final Identifier identifier, final MessageContext context) {

    if (!StringUtils.hasText(identifier.getValue())) {
        context.addMessage(new MessageBuilder().error().code("identifierValueRequired").build());
        return false;
    }/*from  w  w w.  j  av  a 2s . c om*/

    if (identifier.getType() == null || identifier.getType().getName() == null
            || identifier.getType().getName().trim().equals("")) {
        context.addMessage(new MessageBuilder().error().code("identifierTypeRequired").build());
        if (identifier.getType() == null)
            logger.info("generateActivationKey: no type");
        if (identifier.getType().getName() == null)
            logger.info("generateActivationKey: no type value given");
        return false;
    }

    try {
        ActivationKey key = activationService.generateActivationKey(identifier.getType().getName(),
                identifier.getValue());
        context.addMessage(new MessageBuilder().info().code("newActivationKey").arg(key.asString()).build());
    } catch (final PersonNotFoundException e) {
        context.addMessage(new MessageBuilder().error().code("personNotFound").build());
        return false;
    } catch (final IllegalArgumentException e) {
        context.addMessage(new MessageBuilder().error().code("generateActivationKeyError").build());
        return false;
    }

    return true;
}

From source file:de.itsvs.cwtrpc.controller.RemoteServiceConfig.java

public void setRelativePath(String relativePath) {
    if ((relativePath != null) && !StringUtils.hasText(relativePath)) {
        throw new IllegalArgumentException("'relativePath' must either be null or not be empty");
    }/* ww w . j  a v a 2  s.c o m*/
    this.relativePath = relativePath;
}

From source file:fr.xebia.management.config.EhCacheManagementServiceDefinitionParser.java

@Override
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) {
    String id = element.getAttribute(ID_ATTRIBUTE);
    if (!StringUtils.hasText(id)) {
        id = EH_CACHE_MANAGEMENT_SERVICE_BEAN_NAME;
    }/*from   w  w  w  . j  a  va  2 s . c om*/
    return id;
}

From source file:JavaMvc.web.EditUserCommand.java

public void updateUser(User user) {
    Assert.isTrue(userId.equals(user.getId()), "User ID of command must match the user being updated.");
    user.setUsername(getUsername());/*  w  w w . j  a  va 2  s.  co m*/
    user.setEmail(getEmail());
    if (StringUtils.hasText(getPassword())) {
        user.setPassword(new Sha256Hash(getPassword()).toHex());
    }
}

From source file:com.natpryce.piazza.PiazzaUserAdapter.java

void reloadUsers() {
    this.userGroup = new UserGroup();
    Set<SUser> users = userModel.getAllUsers().getUsers();
    for (SUser user : users) {
        String portraitUrl = PiazzaNotificator.getPortraitUrl(user);
        if (StringUtils.hasText(portraitUrl)) {
            addUserToPiazzaMonitor(user, portraitUrl);
        } else {//  ww  w. j  a  v a2s  .c  o  m
            addUserToPiazzaMonitor(user, determineGravatarUrl(user));
        }
    }
}

From source file:com.googlecode.spring.appengine.api.factory.MemcacheServiceFactoryBean.java

@Override
public void afterPropertiesSet() throws Exception {
    if (StringUtils.hasText(namespace)) {
        memcacheService = MemcacheServiceFactory.getMemcacheService(namespace);
    } else {/*www . j  a  v  a 2  s  .c om*/
        memcacheService = MemcacheServiceFactory.getMemcacheService();
    }
}

From source file:com.springsource.hq.plugin.tcserver.serverconfig.resources.jdbc.General.java

public void validate(Object target, Errors errors) {
    General general = (General) target;//from  w w w.  j a va 2  s .co  m
    if (!errors.hasFieldErrors("jndiName")) {
        if (!StringUtils.hasText(general.getJndiName())) {
            errors.rejectValue("jndiName", "resource.dataSource.general.jndiName.required");
        } else {
            if (general.parent() != null) {
                // detect duplicate jndi names
                for (DataSource dataSource : general.parent().parent().getDataSources()) {
                    General g = dataSource.getGeneral();
                    if (g != general && ObjectUtils.nullSafeEquals(general.getJndiName(), g.getJndiName())) {
                        errors.reject("resource.dataSource.general.jndiName.unique",
                                new Object[] { general.getJndiName() }, null);
                    }
                }
            }
        }
    }
}

From source file:org.wallride.web.controller.admin.page.PageSearchForm.java

public boolean isEmpty() {
    if (StringUtils.hasText(getKeyword())) {
        return false;
    }//  w  w w  . ja v  a2s  .  c  o  m
    if (getTagId() != null) {
        return false;
    }
    if (getStatus() != null) {
        return false;
    }
    return true;
}