Example usage for org.apache.commons.lang3 StringUtils isNotBlank

List of usage examples for org.apache.commons.lang3 StringUtils isNotBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNotBlank.

Prototype

public static boolean isNotBlank(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is not empty (""), not null and not whitespace only.

 StringUtils.isNotBlank(null)      = false StringUtils.isNotBlank("")        = false StringUtils.isNotBlank(" ")       = false StringUtils.isNotBlank("bob")     = true StringUtils.isNotBlank("  bob  ") = true 

Usage

From source file:edu.usu.sdl.openstorefront.common.util.StringProcessor.java

public static String getResourceNameFromUrl(String url) {
    String resource = url;/* w  ww.ja va 2s.c  om*/
    if (StringUtils.isNotBlank(url)) {
        resource = url.substring(url.lastIndexOf("/") + 1, url.length());
    }
    return resource;
}

From source file:c3.ops.priam.backup.Restore.java

public static boolean isRestoreEnabled(IConfiguration conf) {
    boolean isRestoreMode = StringUtils.isNotBlank(conf.getRestoreSnapshot());
    boolean isBackedupRac = (CollectionUtils.isEmpty(conf.getBackupRacs())
            || conf.getBackupRacs().contains(conf.getRac()));
    return (isRestoreMode && isBackedupRac);
}

From source file:com.cisco.oss.foundation.message.AbstractHornetQMessageHandler.java

@Override
public final void onMessage(ClientMessage message) {
    try {/*from  w w w  . j  av  a  2 s . c om*/
        message.acknowledge();
    } catch (HornetQException e) {
        throw new QueueException(e);
    }
    String flowContextStr = message.getStringProperty(QueueConstants.FLOW_CONTEXT_HEADER);
    if (StringUtils.isNotBlank(flowContextStr)) {
        FlowContextFactory.deserializeNativeFlowContext(flowContextStr);
    }
    Message msg = new HornetQMessage(message);
    preMessageProcessing(msg);
    onMessage(msg);
    postMessageProcessing(msg);
}

From source file:edu.usu.sdl.openstorefront.web.rest.model.ComponentIntegrationView.java

public static ComponentIntegrationView toView(ComponentIntegration integration) {
    ServiceProxy proxy = new ServiceProxy();
    ComponentIntegrationView view = new ComponentIntegrationView();
    String componentName = proxy.getComponentService().getComponentName(integration.getComponentId());

    view.setComponentName(componentName);
    view.setComponentId(integration.getComponentId());
    view.setRefreshRate(integration.getRefreshRate());
    view.setStatus(integration.getStatus());
    view.setLastEndTime(integration.getLastEndTime());
    view.setLastStartTime(integration.getLastStartTime());
    view.setActiveStatus(integration.getActiveStatus());

    if (StringUtils.isNotBlank(view.getRefreshRate())) {
        try {/*w  w w.jav a  2s .  c  o  m*/
            view.setCronExpressionDescription(
                    CronExpressionDescriptor.getDescription(integration.getRefreshRate()));
        } catch (ParseException ex) {
            view.setCronExpressionDescription("Unable to parse expression");
        }
    }

    return view;
}

From source file:at.porscheinformatik.sonarqube.licensecheck.webservice.mavendependency.MavenDependencyEditAction.java

@Override
public void handle(Request request, Response response) throws Exception {
    JsonReader jsonReader = Json/*from ww w. ja  va  2 s  . c  om*/
            .createReader(new StringReader(request.param(MavenDependencyConfiguration.PARAM)));
    JsonObject jsonObject = jsonReader.readObject();
    jsonReader.close();

    boolean oldKeyIsNotBlank = StringUtils
            .isNotBlank(jsonObject.getString(MavenDependencyConfiguration.PROPERTY_OLD_KEY));
    boolean newKeyIsNotBlank = StringUtils
            .isNotBlank(jsonObject.getString(MavenDependencyConfiguration.PROPERTY_NEW_KEY));
    boolean newLicenseIsNotBlank = StringUtils
            .isNotBlank(jsonObject.getString(MavenDependencyConfiguration.PROPERTY_NEW_LICENSE));

    if (oldKeyIsNotBlank && newKeyIsNotBlank && newLicenseIsNotBlank) {
        MavenDependency newMavenDependency = new MavenDependency(
                jsonObject.getString(MavenDependencyConfiguration.PROPERTY_NEW_KEY),
                jsonObject.getString(MavenDependencyConfiguration.PROPERTY_NEW_LICENSE));

        if (!mavenDependencySettingsService.hasDependency(newMavenDependency)) {
            mavenDependencySettingsService
                    .deleteMavenDependency(jsonObject.getString(MavenDependencyConfiguration.PROPERTY_OLD_KEY));
            mavenDependencySettingsService.addMavenDependency(newMavenDependency);
            response.stream().setStatus(HTTPConfiguration.HTTP_STATUS_OK);
            LOGGER.info(MavenDependencyConfiguration.INFO_EDIT_SUCCESS + jsonObject.toString());
        } else {
            LOGGER.error(MavenDependencyConfiguration.ERROR_EDIT_ALREADY_EXISTS + jsonObject.toString());
            response.stream().setStatus(HTTPConfiguration.HTTP_STATUS_NOT_MODIFIED);
        }

    } else {
        LOGGER.error(MavenDependencyConfiguration.ERROR_ADD_INVALID_INPUT + jsonObject.toString());
        response.stream().setStatus(HTTPConfiguration.HTTP_STATUS_NOT_MODIFIED);
    }
}

From source file:Bean.liquidacionBean.java

public void exportarPDF(String liqventa) throws JRException, NamingException, SQLException, IOException {
    dbManager conn = new dbManager();
    Connection con = null;//from w w  w .  j ava  2 s  .  c o m
    con = conn.getConnection();
    Map<String, Object> parametros = new HashMap<String, Object>();
    if (StringUtils.isNotBlank(liqventa)) {
        parametros.put("liqventa", liqventa);
        System.out.println(liqventa);
        File jasper = new File("D:/reporte/liquidacion.jasper");
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con);
        HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance()
                .getExternalContext().getResponse();
        response.addHeader("Content-disposition", "attachment; filename=Liquidacin" + liqventa + ".pdf");
        ServletOutputStream stream = response.getOutputStream();
        JasperExportManager.exportReportToPdfStream(jasperPrint, stream);
        stream.flush();
        stream.close();
        FacesContext.getCurrentInstance().responseComplete();
    } else {
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Error", "Generar Crdito."));
    }
}

From source file:jease.cms.web.Navigation.java

public void addLinkCheckTab() {
    if (JeaseSession.get(User.class).isContentManager()
            && StringUtils.isNotBlank(Registry.getParameter(Names.JEASE_SITE_DESIGN))) {
        add(I18N.get("Link_Check"), jease.cms.web.system.linkcheck.Table.class, Images.NetworkTransmit);
    }/*from   w ww .  j  ava 2 s .  co m*/
}

From source file:edu.usu.sdl.opencatalog.web.rest.JsonpInterceptor.java

@Override
public void aroundWriteTo(WriterInterceptorContext responseContext) throws IOException {
    if (StringUtils.isNotBlank(callback)) {
        responseContext.getOutputStream().write((callback + "(").getBytes());
        responseContext.proceed();/*from  ww  w. j av a  2s.c o  m*/
        responseContext.getOutputStream().write(")".getBytes());
    } else {
        responseContext.proceed();
    }
}

From source file:io.brooklyn.ambari.cluster.ClusterStateEventListener.java

@Override
public void onEvent(SensorEvent<String> sensorEvent) {
    Boolean installed = entity.getAttribute(AmbariCluster.CLUSTER_SERVICES_INSTALLED);
    if (StringUtils.isNotBlank(sensorEvent.getValue()) && sensorEvent.getValue().equals("COMPLETED")
            && !Boolean.TRUE.equals(installed)) {
        try {/*w  w  w .ja v  a  2s  .  c  om*/
            entity.postDeployCluster();
        } catch (ExtraServiceException ex) {
            ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator((EntityLocal) entity,
                    "ambari.extra.service", ex.getMessage());
            throw ex;
        }
    }
}

From source file:com.project.framework.util.DateUtils.java

/**
 * , yyyy-MM-dd HH:mm:ss ??/*from   www  .ja v  a2  s.  c  o  m*/
 * @param strDate  
 * @param format   ?
 * @return
 */
public static String dateStringFormat(Date date, String format) {
    if (date == null)
        return "";
    SimpleDateFormat sdf = null;
    if (StringUtils.isNotBlank(format))
        sdf = new SimpleDateFormat(format);
    else
        sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    return sdf.format(date);
}