Example usage for org.springframework.util StringUtils isEmpty

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

Introduction

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

Prototype

public static boolean isEmpty(@Nullable Object str) 

Source Link

Document

Check whether the given object (possibly a String ) is empty.

Usage

From source file:ch.sbb.releasetrain.utils.model.GitModel.java

public String getEncPassword() {
    if (StringUtils.isEmpty(configPassword)) {
        return "";
    }/*from  w  ww.j av  a  2 s . c  om*/
    setSystemProp("password", configPassword);
    return EncryptorImpl.decrypt(configPassword);
}

From source file:de.dlopes.stocks.facilitator.services.impl.WebFlowServiceUtil.java

public boolean isEmpty(String string) {
    return StringUtils.isEmpty(string);
}

From source file:org.activiti.DatabaseConfiguration.java

@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('cloud') && !environment.acceptsProfiles('heroku')}")
public DataSource dataSource() {
    HikariConfig config = new HikariConfig();
    config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
    if (StringUtils.isEmpty("")) {
        config.addDataSourceProperty("databaseName", "caple-test2");
        config.addDataSourceProperty("serverName", "localhost");
    } else {//from w w w  .ja  v  a2 s .  c  o m
        config.addDataSourceProperty("url", "");
    }
    config.addDataSourceProperty("user", "postgres");
    config.addDataSourceProperty("password", "123");

    return new HikariDataSource(config);
}

From source file:com.jiwhiz.mail.sendgrid.SystemMessageSenderImpl.java

@Override
public void sendNewUserRegistered(UserAccount user) {
    String userEmail = user.getEmail();
    if (StringUtils.isEmpty(userEmail)) {
        userEmail = "[not set]";
    }/*from  ww  w . j av a2 s. c o m*/
    String subject = "New user registered";
    String message = "A new user registered: name is " + user.getDisplayName() + ", email is " + userEmail;
    doSend(getSystemEmail(), getAdminEmail(), subject, message);
}

From source file:unic.mentoring.jms.ctrl.MessageCtrl.java

@RequestMapping(value = "/message", method = RequestMethod.POST)
public String message(Model model, @RequestParam("message") String message,
        @RequestParam("topic") String topic) {
    if (!StringUtils.isEmpty(message)) {
        try {/*from  ww w  .  java  2 s  . c o m*/
            sendMessage(message, topic);
            model.addAttribute(ATTR_MESSAGE,
                    "Message (length: " + message.length() + ") has been sent into topic \"" + topic + "\".");
        } catch (JMSException e) {
            model.addAttribute(ATTR_MESSAGE, "Can't send message: " + e.getMessage());
        }
    } else {
        model.addAttribute(ATTR_MESSAGE, "No message has been specified to send.");
    }

    return Constants.Page.INDEX;
}

From source file:no.digipost.api.representations.Mpc.java

@Override
public String toString() {
    String result = "urn:" + prioritet.name().toLowerCase();
    if (!StringUtils.isEmpty(avsenderId)) {
        result += ":" + avsenderId;
    }//from   w  ww .  j  ava2s.  com
    return result;
}

From source file:com.expedia.seiso.domain.service.search.SpaceDelimitedDatabaseWildCardTokenizer.java

public Set<String> tokenize(String termsString) {
    HashSet<String> tokens = new LinkedHashSet<String>();

    if (!StringUtils.isEmpty(termsString)) {
        String[] terms = termsString.split(TERM_DELIMITER);
        for (String term : terms) {
            if (!StringUtils.isEmpty(term)) {
                tokens.add(new StringBuilder(WILD_CARD).append(term.trim()).append(WILD_CARD).toString());
            }/*from   w  w  w . jav a 2  s . c  o m*/
        }
    }

    return tokens;
}

From source file:be.roots.taconic.pricingguide.domain.Currency.java

public static Currency getEnum(String value) {

    if (!StringUtils.isEmpty(value)) {
        for (Currency currency : Currency.values()) {
            if (value.toLowerCase().endsWith(currency.getDescription().toLowerCase())) {
                return currency;
            }// w ww  .  ja v  a  2  s .  c o m
        }
    }
    return null;
}

From source file:com.mycompany.apsdtask.EMailStoringSevice.java

public Stream<EMail> searcEMail(String from, String subject, String after, String before)
        throws ParseException {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    Date afterDate = (StringUtils.isEmpty(after)) ? df.parse("1984-07-13 00:00:00") : df.parse(after);
    Date beforeDate = (StringUtils.isEmpty(before)) ? df.parse("2084-07-13 00:00:00") : df.parse(before);

    Stream<EMail> results;/*w w w  .j av  a 2 s .c o m*/
    if (StringUtils.isEmpty(from)) {
        if (StringUtils.isEmpty(subject)) {
            results = eMailRepository.findByDate(afterDate, beforeDate);
        } else {
            results = eMailRepository.findByDateAndSubject(afterDate, beforeDate, subject);
        }
    } else {
        if (StringUtils.isEmpty(subject)) {
            results = eMailRepository.findByDateAndAuthor(afterDate, beforeDate, from);
        } else {
            results = eMailRepository.findByDateAuthorAndSubject(afterDate, beforeDate, from, subject);
        }
    }
    return results;
}

From source file:com.ocs.dynamo.importer.impl.BaseTextImporter.java

/**
 * Extracts a boolean value/*w  w  w  .jav a 2  s  .  c  o m*/
 * 
 * @param unit
 * @return
 */
protected Boolean getBooleanValue(String unit) {
    String value = unit;
    if (StringUtils.isEmpty(value)) {
        return Boolean.FALSE;
    }
    return Boolean.valueOf(value);
}