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

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

Introduction

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

Prototype

public static boolean isNumeric(String str) 

Source Link

Document

Checks if the String contains only unicode digits.

Usage

From source file:com.google.gdt.eclipse.designer.hosted.tdt.GWTEnvironmentUtils.java

private static String getHostName() {
    String hostName = "";
    try {//from w w  w.  ja v a2 s.com
        hostName = InetAddress.getLocalHost().getHostName();
        String[] names = StringUtils.split(hostName, '.');
        for (String name : names) {
            if (StringUtils.isNumeric(name)) {
                // getHostName() returned in a IP-address form
                return hostName;
            }
        }
        hostName = names[0];
    } catch (UnknownHostException e) {
    }
    return hostName;
}

From source file:hudson.plugins.blazemeter.utils.JenkinsTestListFlow.java

public JenkinsTestListFlow(BlazeMeterUtils utils, String limit) {
    super(utils);
    this.limit = (!StringUtils.isBlank(limit) & StringUtils.isNumeric(limit)) ? limit : "10000";
}

From source file:com.chortitzer.web.admin.controller.EmpleadosConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    if (value != null && value.trim().length() > 0 && StringUtils.isNumeric(value)) {
        return rrhhEmpleadosRepository.findOne(Integer.parseInt(value));
    } else {//from ww  w .j a  v  a2  s .c  o  m
        return null;
    }

}

From source file:com.chortitzer.web.bas.controller.DalLotesConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    try {//ww w. j  a  va  2  s  . c  o m
        if (value != null && value.trim().length() > 0 && StringUtils.isNumeric(value)) {
            return tblDalLotesRepository.findOne(Integer.parseInt(value));
        } else {
            return null;
        }
    } catch (Exception ex) {
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", ex.getMessage()));
        return null;
    }
}

From source file:com.chortitzer.web.admin.controller.EntradaSalidaConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    try {/*from  w  w w .j a va  2  s.c o m*/
        if (value != null && value.trim().length() > 0 && StringUtils.isNumeric(value)) {
            if (value.equals("Entrada")) {
                return 1;
            } else if (value.equals("Salida")) {
                return 2;
            } else {
                return null;
            }
        } else {
            return null;
        }
    } catch (Exception ex) {
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", ex.getMessage()));
        return null;
    }
}

From source file:com.chortitzer.web.bas.controller.EmpresaConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    try {//from  w  ww.  j a  v  a2  s.  co  m
        if (value != null && value.trim().length() > 0 && StringUtils.isNumeric(value)) {
            return tblempresaRepository.findOne(Integer.parseInt(value));
        } else {
            return null;
        }
    } catch (Exception ex) {
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", ex.getMessage()));
        return null;
    }
}

From source file:com.chortitzer.web.bas.controller.ProductoConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    try {//from   www.j  av  a 2s  .  c o m
        if (value != null && value.trim().length() > 0 && StringUtils.isNumeric(value)) {
            return tblproductoRepository.findOne(Integer.parseInt(value));
        } else {
            return null;
        }
    } catch (Exception ex) {
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", ex.getMessage()));
        return null;
    }
}

From source file:com.chortitzer.web.bas.controller.DalBonificacionesConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    try {//  w ww .  jav  a2 s . c  om
        if (value != null && value.trim().length() > 0 && StringUtils.isNumeric(value)) {
            return tblDalBonificacionesRepository.findOne(Integer.parseInt(value));
        } else {
            return null;
        }
    } catch (Exception ex) {
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", ex.getMessage()));
        return null;
    }
}

From source file:com.aimluck.eip.modules.screens.ProjectMemberJSONScreen.java

@Override
protected String getJSONString(RunData rundata, Context context) throws Exception {
    String projectId = rundata.getParameters().getString("projectId");
    if (StringUtils.isEmpty(projectId) || !StringUtils.isNumeric(projectId)) {
        return "";
    }/* ww  w  . ja v a  2  s. c o m*/
    Map<String, String> map = ProjectUtils.getProjectMemberMap(Integer.valueOf(projectId));
    return JSONArray.fromObject(map).toString();
}

From source file:net.sourceforge.fenixedu.domain.cms.ThesisSiteController.java

@Override
public Site selectSiteForPath(String[] parts) {
    String thesisId = parts[0];/*from  w  w w  .j a  v  a2  s .  com*/
    // If the ID is neither an OID or an IdInternal, simply return null
    if (!StringUtils.isNumeric(thesisId)) {
        return null;
    }
    DomainObject selectedObject = FenixFramework.getDomainObject(thesisId);
    if (selectedObject instanceof Thesis) {
        return ((Thesis) selectedObject).getSite();
    } else {
        // Identifier should be an IdInternal, let's try to process it...
        long oid = 2353642078208l + Integer.parseInt(thesisId);
        Thesis thesis = FenixFramework.getConfig().getBackEnd().fromOid(oid);
        return thesis == null ? null : thesis.getSite();
    }
}