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

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

Introduction

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

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

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

Usage

From source file:com.haulmont.cuba.gui.xml.layout.loaders.TimeFieldLoader.java

@Override
public void loadComponent() {
    super.loadComponent();

    String timeFormat = element.attributeValue("timeFormat");
    if (StringUtils.isNotEmpty(timeFormat)) {
        timeFormat = loadResourceString(timeFormat);
        resultComponent.setFormat(timeFormat);
    }/*from w  w  w.  ja  v a 2s  .  co  m*/

    String showSeconds = element.attributeValue("showSeconds");
    if (StringUtils.isNotEmpty(showSeconds)) {
        resultComponent.setShowSeconds(Boolean.parseBoolean(showSeconds));
    }

    loadTabIndex(resultComponent, element);
    loadBuffered(resultComponent, element);
}

From source file:com.bstek.dorado.data.config.xml.DataTypePropertyParser.java

@Override
protected Object doParse(Node node, ParseContext context) throws Exception {
    Object value = super.doParse(node, context);
    if (value instanceof String) {
        String dataTypeName = (String) value;
        if (StringUtils.isNotEmpty(dataTypeName)) {
            value = dataObjectParseHelper.getDataTypeByName(dataTypeName, (DataParseContext) context, true);
        }//from  w  w w  . j  a v a2 s . c  o  m
    }
    return value;
}

From source file:com.bstek.dorado.data.config.xml.MapValuesParser.java

@Override
protected Object doParse(Node node, ParseContext context) throws Exception {
    String text;/*from  www .j a va  2  s .  c o m*/
    if (node instanceof Element) {
        text = DomUtils.getTextContent((Element) node);
    } else {
        text = node.getNodeValue();
    }

    if (StringUtils.isNotEmpty(text)) {
        Expression expression = getExpressionHandler().compile(text);
        if (expression != null) {
            if (expression.getEvaluateMode() == EvaluateMode.onInstantiate
                    && expression instanceof AbstractExpression) {
                ((AbstractExpression) expression).setEvaluateMode(EvaluateMode.onFirstRead);
            }
            return expression;
        }
    }

    return super.doParse(node, context);
}

From source file:com.bibisco.manager.HttpManager.java

public static WebMessage getMessageFromBibiscoWebSite() {

    WebMessage lWebMessage = null;//w w  w.j  av  a 2  s. c o  m

    mLog.debug("Start getMessageFromBibiscoWebSite()");

    String lStrJson = getMessagesFromBibiscoWebSite();
    if (StringUtils.isNotEmpty(lStrJson)) {
        Gson lGson = new Gson();
        WebMessage[] lWebMessages = lGson.fromJson(lStrJson, WebMessage[].class);

        for (int i = 0; i < lWebMessages.length; i++) {
            mLog.debug(lWebMessages[i].getIdMessage() + " " + lWebMessages[i].getTitle());
            if (showMessage(lWebMessages[i])) {
                lWebMessage = lWebMessages[i];
                break;
            }
        }
    }

    mLog.debug("End getMessageFromBibiscoWebSite() return: ",
            lWebMessage != null ? lWebMessage.getMessage() : "null");

    return lWebMessage;
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.ResizableTextAreaLoader.java

@Override
public void loadComponent() {
    super.loadComponent();

    ResizableTextArea textArea = (ResizableTextArea) resultComponent;
    String resizable = element.attributeValue("resizable");
    if (StringUtils.isNotEmpty(resizable)) {
        textArea.setResizable(Boolean.parseBoolean(resizable));
    }/*  ww w  .  j av  a 2 s . co m*/

    String resizableDirection = element.attributeValue("resizableDirection");
    if (StringUtils.isNotEmpty(resizableDirection)) {
        textArea.setResizableDirection(ResizableTextArea.ResizeDirection.valueOf(resizableDirection));
    }

    loadSettingsEnabled(textArea, element);
}

From source file:com.bibisco.bean.LocationDTO.java

public String getFullyQualifiedArea() {

    StringBuilder lStringBuilder = new StringBuilder();

    if (StringUtils.isNotEmpty(nation)) {
        lStringBuilder.append(nation);//from w  w w . j a va2s . c o  m
    }
    if (StringUtils.isNotEmpty(state)) {
        if (lStringBuilder.toString().length() > 0) {
            lStringBuilder.append(", ");
        }
        lStringBuilder.append(state);
    }
    if (StringUtils.isNotEmpty(city)) {
        if (lStringBuilder.toString().length() > 0) {
            lStringBuilder.append(", ");
        }
        lStringBuilder.append(city);
    }

    return lStringBuilder.toString();
}

From source file:com.jfaker.framework.security.model.Role.java

public Page<Role> paginate(int pageNumber, int pageSize, String name) {
    String sql = "from sec_role ";
    if (StringUtils.isNotEmpty(name)) {
        sql += " where name like '%" + name + "%' ";
    }//  ww w . j  a v a 2 s.  c o  m
    sql += " order by id desc ";
    return paginate(pageNumber, pageSize, "select *", sql);
}

From source file:net.bible.service.format.osistohtml.taghandler.FigureHandler.java

@Override
public void start(Attributes attrs) {
    // Refer to Gen 3:14 in ESV for example use of type=x-indent
    String src = attrs.getValue(OSISUtil.ATTRIBUTE_FIGURE_SRC);

    if (StringUtils.isNotEmpty(src)) {
        writer.write("<img class='sword' src='" + parameters.getModuleBasePath() + "/" + src + "'/>");
    }//from ww w. jav  a  2  s  . c om
}

From source file:com.iterzp.momo.service.impl.CaptchaServiceImpl.java

@Override
public boolean isValid(CaptchaType captchaType, String captchaId, String captcha) {
    Setting setting = SettingUtils.get();
    if (captchaType == null || ArrayUtils.contains(setting.getCaptchaTypes(), captchaType)) {
        if (StringUtils.isNotEmpty(captchaId) && StringUtils.isNotEmpty(captcha)) {
            try {
                return imageCaptchaService.validateResponseForID(captchaId, captcha.toUpperCase());
            } catch (Exception e) {
                return false;
            }//from   w  w w  . j a  va 2 s .  c om
        } else {
            return false;
        }
    } else {
        return true;
    }
}

From source file:com.jnj.b2b.storefront.util.MetaSanitizerUtil.java

/**
 * Takes a string of words, removes duplicates and returns a comma separated list of keywords as a String
 * // w  ww .j  ava  2s .c  o m
 * @param keywords
 *           Keywords to be sanitized
 * @return String of comma separated keywords
 */
public static String sanitizeKeywords(final String keywords) {
    final String clean = (StringUtils.isNotEmpty(keywords) ? Jsoup.parse(keywords).text() : ""); // Clean html
    final String[] words = StringUtils.split(clean.replace("\"", "")); // Clean quotes

    // Remove duplicates
    final StringBuffer noDupes = new StringBuffer();
    for (final String word : words) {
        if (noDupes.indexOf(word) == -1) {
            noDupes.append(word).append(',');
        }
    }
    if (noDupes.length() > 0) {
        noDupes.deleteCharAt(noDupes.length() - 1);
    }
    return noDupes.toString();
}