Example usage for org.apache.commons.lang StringUtils isNotBlank

List of usage examples for org.apache.commons.lang StringUtils isNotBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotBlank.

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:com.mycollab.common.domain.MailRecipientField.java

@JsonCreator
public MailRecipientField(String email, String name) {
    this.email = email;
    this.name = StringUtils.isNotBlank(name) ? name : email;
}

From source file:com.googlecode.jtiger.modules.ecside.table.cell.NumberCell.java

protected String getCellValue(TableModel model, Column column) {
    String value = column.getPropertyValueAsString();
    if (StringUtils.isNotBlank(value)) {
        Locale locale = model.getLocale();
        value = ExtremeUtils.formatNumber(column.getFormat(), value, locale);
    }//ww w  .ja  v  a  2 s .c  o m

    return value;
}

From source file:edu.usu.sdl.openstorefront.service.manager.MailManager.java

public static void init() {
    //pull properties
    String server = PropertiesManager.getValue(PropertiesManager.KEY_MAIL_SERVER);
    String serverPort = PropertiesManager.getValue(PropertiesManager.KEY_MAIL_SERVER_PORT);
    String serverUser = PropertiesManager.getValue(PropertiesManager.KEY_MAIL_SERVER_USER);
    String serverPW = PropertiesManager.getValue(PropertiesManager.KEY_MAIL_SERVER_PW);
    String useSSL = PropertiesManager.getValue(PropertiesManager.KEY_MAIL_USE_SSL);
    String useTLS = PropertiesManager.getValue(PropertiesManager.KEY_MAIL_USE_TLS);

    if (StringUtils.isNotBlank(server)) {
        TransportStrategy transportStrategy = TransportStrategy.SMTP_PLAIN;
        if (Convert.toBoolean(useSSL)) {
            transportStrategy = TransportStrategy.SMTP_SSL;
        } else if (Convert.toBoolean(useTLS)) {
            transportStrategy = TransportStrategy.SMTP_TLS;
        }/*ww w  .  j  a v  a2 s .c  om*/

        mailer = new Mailer(server, Convert.toInteger(serverPort), serverUser, serverPW, transportStrategy);
    } else {
        log.log(Level.WARNING, "No mail server is set up.  See application properties file to configure.");
    }
}

From source file:com.googlecode.jtiger.modules.ecside.core.bean.ExportDefaults.java

static String getviewResolver(TableModel model, String viewResolver) {
    String result = null;//www  .j  av a2 s .c om

    if (StringUtils.isNotBlank(viewResolver)) {
        result = model.getPreferences().getPreference(PreferencesConstants.EXPORT_VIEW_RESOLVER + viewResolver);
        if (StringUtils.isBlank(result)) {
            result = viewResolver;
        }
    }

    return result;
}

From source file:io.sidecar.org.Organization.java

public Organization(String name, String url, OrganizationType type) {
    this.orgId = UUID.randomUUID();

    Preconditions.checkNotNull(name);/* w w w .j  a  va2  s . c om*/
    Preconditions.checkArgument(StringUtils.isNotBlank(name));
    this.name = name;

    Preconditions.checkNotNull(url);
    Preconditions.checkArgument(StringUtils.isNotBlank(url));
    Preconditions.checkArgument(CharMatcher.WHITESPACE.matchesNoneOf(url));
    this.url = url;

    Preconditions.checkNotNull(type);
    this.type = type;
}

From source file:com.egt.core.db.ddl.Writer.java

private static void execute(String vm, String clase) {
    if (VelocityEngineer.init()) {
        String c = clase == null ? "*" : clase;
        //          Utils.println("*** combinar(" + vm + ", clase=" + c + ") ***");
        MapaClases mapaClases = new MapaClases();
        try {/*from   w w  w .  jav a2 s .co m*/
            if (mapaClases.connected()) {
                if (StringUtils.isNumeric(clase)) {
                    execute(vm, mapaClases.getMap(Long.valueOf(clase)));
                } else if (StringUtils.isNotBlank(clase)) {
                    execute(vm, mapaClases.getMap(clase));
                } else {
                    execute(vm, mapaClases.getMap());
                }
            } else {
                Utils.println("*** error de conexion ***");
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        } finally {
            if (mapaClases != null) {
                mapaClases.close();
                mapaClases = null;
            }
        }
    }
}

From source file:com.enitalk.controllers.paypal.BasicPaypal.java

public String authPaypal() {
    String tt = null;//from   ww w  . j a  va 2 s  . com
    try {
        tt = redis.opsForValue().get("paypal");
        if (StringUtils.isNotBlank(tt)) {
            return tt;
        }

        String url = env.getProperty("paypal.auth");
        String auth = env.getProperty("paypal.client") + ":" + env.getProperty("paypal.secret");
        String encoded = java.util.Base64.getEncoder().encodeToString(auth.getBytes());

        logger.info("Posting paypal auth to {} client {}", url, encoded);
        byte[] json = Request.Post(url).addHeader("Authorization", "Basic " + encoded)
                .bodyForm(Form.form().add("grant_type", "client_credentials").build()).execute().returnContent()
                .asBytes();

        JsonNode tree = jackson.readTree(json);
        tt = tree.path("access_token").asText();
        long duration = tree.path("expires_in").asLong();

        redis.opsForValue().set("paypal", tt, duration - 5, TimeUnit.SECONDS);

    } catch (Exception ex) {
        logger.info("Error auth Paypal {}", ExceptionUtils.getFullStackTrace(ex));
    }
    return tt;
}

From source file:com.kinglcc.spring.jms.core.DestinationType.java

public static DestinationType asDestinationType(String destinationName) {
    if (StringUtils.isNotBlank(destinationName)) {
        if (StringUtils.startsWith(destinationName, TOPIC_PREFIX)) {
            return asTopicType(destinationName);
        }/* w  ww .j  a v  a2s. c o  m*/
    }
    return QUEUE;
}

From source file:it.cilea.osd.common.utils.XMLUtils.java

public static String getElementAttribute(Element dataRoot, String name, String attr) {
    NodeList nodeList = dataRoot.getElementsByTagName(name);
    Element element = null;//from  www .jav  a2s .co  m
    if (nodeList != null && nodeList.getLength() > 0) {
        element = (Element) nodeList.item(0);
    }

    String attrValue = null;
    if (element != null) {
        attrValue = element.getAttribute(attr);
        if (StringUtils.isNotBlank(attrValue)) {
            attrValue = attrValue.trim();
        } else
            attrValue = null;
    }
    return attrValue;
}

From source file:bigbluej.DocumentCommand.java

private DocumentCommand(String url, String name, byte[] content) {
    if (StringUtils.isNotBlank(url)) {
        Validate.isTrue(ArrayUtils.isEmpty(content), "when set url, don't set content too!");
        Validate.isTrue(StringUtils.isBlank(name), "when set url, don't set name too!");
    } else if (StringUtils.isNotBlank(name)) {
        Validate.isTrue(ArrayUtils.isNotEmpty(content), "when set name, set content too!");
        Validate.isTrue(StringUtils.isBlank(url), "when set name, don't set url too!");
    } else {//  ww w . j a  va 2s . c o m
        throw new IllegalArgumentException("set either name or url!");
    }
    this.url = url;
    this.name = name;
    this.content = content;
}