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.backelite.sonarqube.commons.surefire.SurefireStaxHandler.java

private static String getClassname(SMInputCursor testCaseCursor, String defaultClassname)
        throws XMLStreamException {
    String testClassName = testCaseCursor.getAttrValue("classname");
    if (StringUtils.isNotBlank(testClassName) && testClassName.endsWith(")")) {
        testClassName = testClassName.substring(0, testClassName.indexOf("("));
    }//w  ww . j  a  va 2  s.c  o  m
    return StringUtils.defaultIfBlank(testClassName, defaultClassname);
}

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

/**
 * Look in the specified servlet scope for the Object. If the scope is null
 * look through the scopes in order (page, request, session, and
 * application)./*from   w  w  w.j  a  v a  2  s  . c  o m*/
 */
public static Object retrieve(WebContext context, String name, String scope) {
    if (StringUtils.isNotBlank(scope)) {
        if (scope.equalsIgnoreCase(TableConstants.PAGE_SCOPE)) {
            return context.getPageAttribute(name);
        } else if (scope.equalsIgnoreCase(TableConstants.REQUEST_SCOPE)) {
            return context.getRequestAttribute(name);
        } else if (scope.equalsIgnoreCase(TableConstants.SESSION_SCOPE)) {
            return context.getSessionAttribute(name);
        } else if (scope.equalsIgnoreCase(TableConstants.APPLICATION_SCOPE)) {
            return context.getApplicationAttribute(name);
        }
    }

    Object value = context.getPageAttribute(name);
    if (value == null) {
        value = context.getRequestAttribute(name);
    }
    if (value == null) {
        value = context.getSessionAttribute(name);
    }
    if (value == null) {
        value = context.getApplicationAttribute(name);
    }

    return value;
}

From source file:com.sfs.whichdoctor.xml.writer.helper.WorkshopXmlHelper.java

/**
 * Output the workshop collection as an XML string.
 *
 * @param workshops the workshops//from   w  w  w  .ja v  a2 s.c  om
 *
 * @return the xml string
 */
public static String getWorkshopsXml(final Collection<WorkshopBean> workshops) {

    final XmlWriter xmlwriter = new XmlWriter();

    xmlwriter.writeEntity("workshops");

    for (WorkshopBean workshop : workshops) {

        xmlwriter.writeEntity("workshop").writeAttribute("GUID", workshop.getGUID())
                .writeAttribute("workshopId", workshop.getId());

        xmlwriter.writeEntity("type").writeText(workshop.getType()).endEntity();
        xmlwriter.writeEntity("date").writeText(Formatter.convertDate(workshop.getWorkshopDate())).endEntity();

        if (StringUtils.isNotBlank(workshop.getMemo())) {
            StringBuffer message = new StringBuffer();
            message.append("<p>");
            message.append(StringUtils.replace(workshop.getMemo(), "\n", "</p><p>"));
            message.append("</p>");

            xmlwriter.writeEntity("message").writeXml(message.toString()).endEntity().endEntity();
        }
        xmlwriter.endEntity();
    }
    xmlwriter.endEntity();

    return xmlwriter.getXml();
}

From source file:com.greenline.guahao.biz.manager.insurance.validator.InsuranceValidator.java

public static boolean validateProposer(LocalResponseDO<Object> lrd, ProposerDO proposer) {
    boolean suc = false;
    String err = null;/* www.  j  a va  2 s. co  m*/
    if (null == proposer) {
        err = "??";
    } else if (StringUtils.isBlank(proposer.getName())) {
        err = "???";
    } else if (StringUtils.isBlank(proposer.getIdcard())) {
        err = "???";
    } else if (!RegexUtil.isIdCard(proposer.getIdcard().toLowerCase())) {
        err = "????";
    } else if (StringUtils.isBlank(proposer.getMobile())) {
        err = "???";
    } else if (!RegexUtil.isMobile(proposer.getMobile())) {
        err = "????";
    } else if (StringUtils.isNotBlank(proposer.getEmail()) && !RegexUtil.isEmail(proposer.getEmail())) {
        err = "??";
    }
    if (null != err) {
        lrd.setResult(LocalResponseCode.LOCAL_ERROR, err, err);
    } else {
        suc = true;
    }
    return suc;
}

From source file:ar.com.zauber.commons.validate.Validate.java

/**
 * Valida que los objetos recibidos no sean null mediante 
 * {@link Validate}.notNull() y, en caso de ser {@link String}, 
 * valida que no est vaco mediante {@link StringUtils}.isNotBlank()
 *  //from  ww w.j  a v a 2 s.  c  om
 * @param objects los objetos a evaluar
 */
public static void notBlank(final Object... objects) {
    for (int i = 0; i < objects.length; i++) {
        final Object object = objects[i];
        if (object instanceof String) {
            isTrue(StringUtils.isNotBlank((String) object), blankMessage(i));
        } else {
            notNull(object, nullMessage(i));
        }
    }
}

From source file:com.helpinput.core.PathUtil.java

/**
 * //from  ww w.  j av  a  2s . c  o  m
 * ??   Vv  ?: ()   
 * 
 * @param parentPath
 *             D:/AA
 * @param subPath
 *            ? BB
 * @return ??  D:/AA/BB
 */
public static String appendPath(String parentPath, String subPath) {

    if (StringUtils.isNotBlank(parentPath) && !parentPath.endsWith(PATH_SPLIT)) {
        parentPath += PATH_SPLIT;
    }
    if (StringUtils.isNotBlank(subPath)) {
        parentPath = parentPath + subPath;
    }

    return processPath(parentPath);
}

From source file:com.googlecode.markuputils.MarkupUtils.java

public static String startOpenElement(String name) {

    StringBuilder buffer = new StringBuilder();

    if (StringUtils.isNotBlank(name)) {
        buffer.append("<").append(name);
    }/*from w w  w.  j  av a2  s.c  om*/

    return buffer.toString();
}

From source file:com.safetys.framework.jmesa.util.ExportUtils.java

/**
 * Use the view caption for the export. If the caption is not defined then use a default.
 * //from  w w w . jav  a  2 s .c o  m
 * @param view The view to export.
 * @param exportType The type of view to export.
 * @return The file name of export.
 */
public static String exportFileName(View view, String exportType) {
    String caption = view.getTable().getCaption();
    if (StringUtils.isNotBlank(caption)) {
        StringUtils.replace(caption, " ", "_");
        return caption.toLowerCase() + "." + exportType;
    }

    return "table-data." + exportType;
}

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

static String getCell(TableModel model, String cell) {
    String result;/* ww  w .  j a v a 2s.c  om*/

    if (StringUtils.isNotBlank(cell)) {
        result = model.getPreferences().getPreference(PreferencesConstants.COLUMN_CELL + cell);
        if (StringUtils.isBlank(result)) {
            result = cell;
        }
    } else {
        result = model.getPreferences()
                .getPreference(PreferencesConstants.COLUMN_CELL + TableConstants.CELL_DISPLAY);
    }

    return result;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.core.bean.ColumnDefaults.java

static String getCell(TableModel model, String cell) {
    String result;//from   w w w.j  a  v a 2  s.  c o m

    if (StringUtils.isNotBlank(cell)) {
        result = model.getPreferences().getPreference(PreferencesConstants.COLUMN_CELL + cell);
        if (StringUtils.isBlank(result)) {
            result = cell;
        }
    } else {
        result = model.getPreferences().getPreference(PreferencesConstants.COLUMN_CELL + TableConstants.CELL_DISPLAY);
    }

    return result;
}