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

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

Introduction

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

Prototype

public static boolean isBlank(String str) 

Source Link

Document

Checks if a String is whitespace, empty ("") or null.

Usage

From source file:br.mdarte.exemplo.academico.cd.crud.ManageCurso.java

public ActionForward create(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    final br.mdarte.exemplo.academico.cd.crud.CursoForm form = (br.mdarte.exemplo.academico.cd.crud.CursoForm) actionForm;

    br.mdarte.exemplo.academico.ManageableServiceLocator.instance().getCursoManageableService().create(
            (StringUtils.isBlank(request.getParameter("codigo"))) ? null : form.getCodigo(),
            (StringUtils.isBlank(request.getParameter("nome"))) ? null : form.getNome(),
            (StringUtils.isBlank(request.getParameter("id"))) ? null : form.getId());

    return preload(mapping, actionForm, request, response);
}

From source file:com.cy.driver.action.GetFileName.java

@RequestMapping(value = "/getFileName")
@ResponseBody//  w  w  w .  j  a v  a 2  s  .  c o  m
@Log(type = 50)
public JSonResponse execute(String driverId, String fileType) throws Exception {
    String filePath;
    String fileName;
    try {
        authentication(driverId);
        if (!isOk) {
            return jSonResponse;
        }

        if (StringUtils.isBlank(fileType)) {
            return JSonResponse.makeHasContentJSonRespone("-8", "?");
        }
        DriverUserInfoDomain domain = driverUserCargoInfoService.selectUserBasicInfo(driverId);
        if (domain != null) {
            if ("1".equals(fileType)) {
                if (domain.getIdentityLicenseNumFront() != null) {
                    filePath = domain.getIdentityLicenseNumFront();
                    fileName = getFileName(filePath);
                    if (StringUtils.isNotBlank(fileName)) {
                        return JSonResponse.makeHasContentJSonRespone("1",
                                "?????" + fileName, fileName);
                    } else {
                        return JSonResponse.makeHasContentJSonRespone("0", "");
                    }
                } else {
                    return JSonResponse.makeHasContentJSonRespone("0", "");
                }
            } else if ("2".equals(fileType)) {
                if (domain.getIdentityLicenseNumContrary() != null) {
                    filePath = domain.getIdentityLicenseNumContrary();
                    fileName = getFileName(filePath);
                    if (StringUtils.isNotBlank(fileName)) {
                        return JSonResponse.makeHasContentJSonRespone("1",
                                "???????" + fileName, fileName);
                    } else {
                        return JSonResponse.makeHasContentJSonRespone("0", "");
                    }
                } else {
                    return JSonResponse.makeHasContentJSonRespone("0", "");
                }
            } else if ("3".equals(fileType)) {
                if (domain.getDriversLicense() != null) {
                    filePath = domain.getDriversLicense();
                    fileName = getFileName(filePath);
                    if (StringUtils.isNotBlank(fileName)) {
                        return JSonResponse.makeHasContentJSonRespone("1",
                                "???" + fileName, fileName);
                    } else {
                        return JSonResponse.makeHasContentJSonRespone("0", "");
                    }
                } else {
                    return JSonResponse.makeHasContentJSonRespone("0", "");
                }
            } else if ("4".equals(fileType)) {
                if (domain.getDrivingLicense() != null) {
                    filePath = domain.getDrivingLicense();
                    fileName = getFileName(filePath);
                    if (StringUtils.isNotBlank(fileName)) {
                        return JSonResponse.makeHasContentJSonRespone("1",
                                "???" + fileName, fileName);
                    } else {
                        return JSonResponse.makeHasContentJSonRespone("0", "");
                    }
                } else {
                    return JSonResponse.makeHasContentJSonRespone("0", "");
                }
            } else if ("5".equals(fileType)) {
                if (domain.getOperatingLicense() != null) {
                    filePath = domain.getOperatingLicense();
                    fileName = getFileName(filePath);
                    if (StringUtils.isNotBlank(fileName)) {
                        return JSonResponse.makeHasContentJSonRespone("1",
                                "?????" + fileName, fileName);
                    } else {
                        return JSonResponse.makeHasContentJSonRespone("0", "");
                    }
                } else {
                    return JSonResponse.makeHasContentJSonRespone("0", "");
                }
            } else if ("6".equals(fileType)) {
                if (domain.getHeadPortrait() != null) {
                    filePath = domain.getHeadPortrait();
                    fileName = getFileName(filePath);
                    if (StringUtils.isNotBlank(fileName)) {
                        return JSonResponse.makeHasContentJSonRespone("1",
                                "???" + fileName, fileName);
                    } else {
                        return JSonResponse.makeHasContentJSonRespone("0", "");
                    }
                } else {
                    return JSonResponse.makeHasContentJSonRespone("0", "");
                }
            }
        } else {
            return JSonResponse.makeHasContentJSonRespone("0", "?");
        }
    } catch (Exception e) {
        log.error("GetFileName.class - " + e.getMessage());
        return JSonResponse.makeHasContentJSonRespone("-8", "?");
    }
    return JSonResponse.makeHasContentJSonRespone("-8", "");
}

From source file:hudson.plugins.blazemeter.PerformanceBuildAction.java

public String getUrlName() {
    return (!StringUtils.isBlank(masterId)) ? "BlazeMeter_" + masterId : "BlazeMeter";
}

From source file:com.smartitengineering.util.opensearch.impl.RelImpl.java

public RelImpl(String value) {
    if (StringUtils.isBlank(value) || !StringUtils.isAlphanumeric(value)) {
        throw new IllegalArgumentException("Rel value must be alphanumeric non-blank");
    }/*from   w  w w  .j a v  a  2s  .  c  o m*/
    this.value = value.toLowerCase();
}

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

static String getviewResolver(TableModel model, String viewResolver) {
    String result = null;/*from  w  ww.  j  a v  a  2 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: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 {/*from   w  w  w  . jav a  2 s  . c om*/
        throw new IllegalArgumentException("set either name or url!");
    }
    this.url = url;
    this.name = name;
    this.content = content;
}

From source file:com.prowidesoftware.swift.model.field.Field64Test.java

@Test
public void testField64String() {
    Field64 f = null;/*from  ww  w . j  av a  2 s  .  co  m*/

    f = new Field64("");
    assertTrue(StringUtils.isBlank(f.getComponent1()));
    assertTrue(StringUtils.isBlank(f.getComponent2()));
    assertTrue(StringUtils.isBlank(f.getComponent3()));
    assertTrue(StringUtils.isBlank(f.getComponent4()));

    f = new Field64("D090822EUR1234,56");
    assertEquals("D", f.getComponent1());
    assertEquals("090822", f.getComponent2());
    assertEquals("EUR", f.getComponent3());
    assertEquals("1234,56", f.getComponent4());

    f = new Field64("090822EUR1234,56");
    assertNull(f.getComponent1());
    assertEquals("090822", f.getComponent2());
    assertEquals("EUR", f.getComponent3());
    assertEquals("1234,56", f.getComponent4());
}

From source file:edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel.java

public String getDisplayName() {
    String displayName = getPublicName();
    if (StringUtils.isBlank(displayName)) {
        displayName = getLocalName().replaceFirst("vitroClassGroup", "");
    }/*from  w  ww .  j  av  a  2s . c  om*/
    return displayName;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.tag.ExportXlsTag.java

 @Override
public void addExportAttributes(TableModel model, Export export) {
     if (StringUtils.isBlank(export.getView())) {
         export.setView(TableConstants.VIEW_XLS);
     }/*from w  ww.  j av  a  2  s.  c o m*/

     if (StringUtils.isBlank(export.getViewResolver())){
         export.setViewResolver(TableConstants.VIEW_XLS);
     }

     if (StringUtils.isBlank(export.getImageName())) {
         export.setImageName(TableConstants.VIEW_XLS);
     }
        
     if (StringUtils.isBlank(export.getText())) {
         export.setText(BuilderConstants.TOOLBAR_XLS_TEXT);
     }
 }

From source file:de.codesourcery.jasm16.compiler.AbstractMarker.java

protected AbstractMarker(String type, ICompilationUnit unit) {

    if (StringUtils.isBlank(type)) {
        throw new IllegalArgumentException("type must not be NULL/blank.");
    }/*from  w  w w. j  a v a 2s  . co m*/
    if (unit == null) {
        throw new IllegalArgumentException("unit must not be NULL.");
    }
    this.type = type;
    this.unit = unit;
}