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:eu.apenet.dpt.standalone.gui.commons.TextChanger.java

public static String getNewText(List<TextFieldWithCheckbox> textFieldWithCheckboxs, String countryCode) {
    String returnValue = "";
    for (TextFieldWithCheckbox textFieldWithCheckbox : textFieldWithCheckboxs) {
        if (Eag2012ValidFields.isRepositoryCodeCorrect(textFieldWithCheckbox.getTextFieldValue())
                && textFieldWithCheckbox.getisilOrNotComboValue().equals("yes"))
            return textFieldWithCheckbox.getTextFieldValue();
        else if (StringUtils.isNotEmpty(countryCode))
            returnValue = countryCode + "-" + "99999999999";
    }/*from   w w w.jav  a2s .  c  om*/
    return returnValue;
}

From source file:com.supermap.desktop.icloud.utils.ValidationUtil.java

public static void validate(ApplyTrialLicenseRequest request) {
    if (request.machine != null) {
        System.out.println("machine parameter is required");
    }//w  w w  .  ja  v  a2 s.  c o m
    if (StringUtils.isNotEmpty(request.machine.name)) {
        System.out.println("machine's name parameter is required");
    }
    if (StringUtils.isNotEmpty(request.machine.macAddr)) {
        System.out.println("machine's macAddr parameter is required");
    }
    if (request.software != null) {
        System.out.println("software parameter is required");
    }
    if (request.software.productType != null) {
        System.out.println("software's productType parameter is required");
    }
    if (request.software.version != null) {
        System.out.println("software's version parameter is required");
    }
}

From source file:com.autentia.common.util.DateFormater.java

public static Date parse(String value, FORMAT datetime) {
    Date date = null;/*from w  w  w  . java2 s .c om*/
    if (StringUtils.isNotEmpty(value)) {
        final SimpleDateFormat format = new SimpleDateFormat(datetime.getSimpleDateformat());
        try {
            date = format.parse(value);
        } catch (ParseException e) {
            if (log.isTraceEnabled()) {
                log.trace(" La fecha no se corresponde con el formato esperado: " + value);
            }
        }
    }
    return date;
}

From source file:com.cnd.greencube.web.base.template.method.AbbreviateMethod.java

@SuppressWarnings("rawtypes")
public Object exec(List arguments) throws TemplateModelException {
    if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null
            && StringUtils.isNotEmpty(arguments.get(0).toString())) {
        Integer width = null;/*from w ww . j a  v a 2 s  . co m*/
        String ellipsis = null;
        if (arguments.size() == 2) {
            if (arguments.get(1) != null) {
                width = Integer.valueOf(arguments.get(1).toString());
            }
        } else if (arguments.size() > 2) {
            if (arguments.get(1) != null) {
                width = Integer.valueOf(arguments.get(1).toString());
            }
            if (arguments.get(2) != null) {
                ellipsis = arguments.get(2).toString();
            }
        }
        return new SimpleScalar(abbreviate(arguments.get(0).toString(), width, ellipsis));
    }
    return null;
}

From source file:com.bstek.dorado.console.web.DoradoObjectController.java

/**
 * ????/*from w w  w. j a  va  2 s . c o  m*/
 * 
 * @param text
 *            ?
 * @return ??
 */
public static boolean match(String text) {
    return !((StringUtils.isNotEmpty(text)) ? PathUtils.match(excludePattern, text) : false);
}

From source file:com.jstar.eclipse.objects.VerificationError.java

public VerificationError(final JSONObject json) throws JSONException {
    final JSONObject error_pos = json.getJSONObject("error_pos");
    startLine = error_pos.getInt("sline");
    endLine = error_pos.getInt("eline");
    startPos = error_pos.getInt("spos");
    endPos = error_pos.getInt("epos");
    error_message = json.getString("error_text");

    final String counter_example = json.getString("counter_example");
    if (StringUtils.isNotEmpty(counter_example)) {
        error_message += "\n" + counter_example;
    }//  w  ww  .java 2 s  .  co m
}

From source file:com.cnd.greencube.web.base.util.WebUtils.java

/**
 * cookie/*w w w  .j  a  v  a  2s.c  om*/
 * 
 * @param request
 *            HttpServletRequest
 * @param response
 *            HttpServletResponse
 * @param name
 *            cookie??
 * @param value
 *            cookie
 * @param maxAge
 *            (??: )
 * @param path
 *            
 * @param domain
 *            
 * @param secure
 *            ??
 */
public static void addCookie(HttpServletRequest request, HttpServletResponse response, String name,
        String value, Integer maxAge, String path, String domain, Boolean secure) {
    Assert.notNull(request);
    Assert.notNull(response);
    Assert.hasText(name);
    try {
        name = URLEncoder.encode(name, "UTF-8");
        value = URLEncoder.encode(value, "UTF-8");
        Cookie cookie = new Cookie(name, value);
        if (maxAge != null) {
            cookie.setMaxAge(maxAge);
        }
        if (StringUtils.isNotEmpty(path)) {
            cookie.setPath(path);
        }
        if (StringUtils.isNotEmpty(domain)) {
            cookie.setDomain(domain);
        }
        if (secure != null) {
            cookie.setSecure(secure);
        }
        response.addCookie(cookie);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
}

From source file:com.htmlhifive.tools.codeassist.core.proposal.build.CodeBuilderUtils.java

/**
 * FunctionBean????.<br>//from  ww  w .  j  av a2 s  . com
 * ex.<br>
 * <code>
 * function(arg1,arg2){return new Return();}
 * </code>
 * 
 * @param sb ?.
 * @param method ???.
 */
static void addFunctionCode(StringBuilder sb, FunctionBean method) {

    sb.append("function(");
    VariableBean[] args = method.getArgments();
    boolean existArgs = false;
    for (VariableBean arg : args) {
        existArgs = true;
        sb.append(arg.getName());
        sb.append(",");
    }
    // 
    if (existArgs) {
        sb.deleteCharAt(sb.length() - 1);
    }
    sb.append("){");
    if (StringUtils.isNotEmpty(method.getReturnType()) && !(method.getReturnType().equals("void"))) {
        sb.append("return new ");
        sb.append(method.getReturnType());
        sb.append("();");
    }
    sb.append("}");
}

From source file:com.bstek.dorado.core.ContextTestCase.java

protected void addExtensionContextConfigLocation(String location) {
    if (StringUtils.isNotEmpty(locations)) {
        locations += ';';
    }//  ww  w  .j  a v  a  2  s .  c  o  m
    locations += location;
}

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

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 src='" + parameters.getModuleBasePath() + "/" + src + "'/>");
    }//from   ww w.ja v a 2s.co  m
}