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

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

Introduction

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

Prototype

public static boolean isNoneBlank(final CharSequence... css) 

Source Link

Document

Checks if none of the CharSequences are blank ("") or null and whitespace only..

 StringUtils.isNoneBlank(null)             = false StringUtils.isNoneBlank(null, "foo")      = false StringUtils.isNoneBlank(null, null)       = false StringUtils.isNoneBlank("", "bar")        = false StringUtils.isNoneBlank("bob", "")        = false StringUtils.isNoneBlank("  bob  ", null)  = false StringUtils.isNoneBlank(" ", "bar")       = false StringUtils.isNoneBlank("foo", "bar")     = true 

Usage

From source file:com.adobe.acs.commons.dam.impl.CopyAssetPublishUrlFeatureTest.java

@Test
public void getDescription() {
    ctx.registerInjectActivateService(new CopyAssetPublishUrlFeature());

    Feature feature = ctx.getService(Feature.class);
    assertTrue(StringUtils.isNoneBlank(feature.getDescription()));
}

From source file:at.tfr.securefs.module.validation.SchemaValidationModule.java

protected void loadSchema(ModuleConfiguration moduleConfig) {
    try {/*from   ww  w.  j  a v  a  2 s .c  o m*/
        String moduleSchemaName = moduleConfig.getProperties().getProperty("schemaName");
        if (StringUtils.isNoneBlank(moduleSchemaName) && !schemaName.equals(moduleSchemaName)) {
            schemaName = moduleSchemaName;
            schema = null;
        }
        if (schema == null) {
            Path schemaPath = configuration.getSchemaPath().resolve(schemaName);
            schema = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema")
                    .newSchema(schemaPath.toFile());
            log.info("loaded schema: " + schemaPath);
        }
    } catch (Exception e) {
        String message = "cannot load schema " + schemaName + " from path: " + configuration.getSchemaPath();
        log.warn(message, e);
    }
}

From source file:cz.vse.webmail.EmailDAOBean.java

@Override
public List<Email> getFilteredEmails(User user, EmailListFilter filter) {
    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
    CriteriaQuery<Email> criteria = cb.createQuery(Email.class);
    Root<Email> root = criteria.from(Email.class);
    List<Predicate> predicates = new ArrayList<Predicate>();
    predicates.add(cb.equal(root.<User>get("owner"), user));
    if (StringUtils.isNoneBlank(filter.getTo())) {
        predicates.add(cb.like(root.<String>get("to"), "%" + filter.getTo() + "%"));
    }/*from ww  w . ja  va2 s  .  com*/
    criteria.select(root).where(predicates.toArray(new Predicate[] {}));
    return entityManager.createQuery(criteria).getResultList();
}

From source file:com.msopentech.odatajclient.engine.utils.QualifiedName.java

@Override
public String toString() {
    final StringBuilder builder = new StringBuilder();

    if (StringUtils.isNoneBlank(namespace)) {
        builder.append(namespace).append('.');
    }//  ww  w.  ja  v  a  2  s.  c  om

    return builder.append(name).toString();
}

From source file:com.sludev.mssqlapplylog.MSSQLHelper.java

/**
 * Restore a Backup Log using a backup file on the file-system.
 * // w ww . j  av a2s . co m
 * @param logPath
 * @param sqlProcessUser Optionally, give this user file-system permissions.  So SQL Server can RESTORE.
 * @param sqlDb The name of the database to restore.
 * @param conn  Open connection
 * @throws SQLException 
 */
public static void restoreLog(final Path logPath, final String sqlProcessUser, final String sqlDb,
        final Connection conn) throws SQLException {
    LOGGER.info(String.format("\nStarting Log restore of '%s'...", logPath));

    StopWatch sw = new StopWatch();

    sw.start();

    if (StringUtils.isNoneBlank(sqlProcessUser)) {
        try {
            FSHelper.addRestorePermissions(sqlProcessUser, logPath);
        } catch (IOException ex) {
            LOGGER.debug(String.format("Error adding read permission for user '%s' to '%s'", sqlProcessUser,
                    logPath), ex);
        }
    }

    String strDevice = logPath.toAbsolutePath().toString();

    String query = String.format("RESTORE LOG %s FROM DISK='%s' WITH NORECOVERY", sqlDb, strDevice);

    Statement stmt = null;

    stmt = conn.createStatement();

    try {
        boolean sqlRes = stmt.execute(query);
    } catch (SQLException ex) {
        LOGGER.error(String.format("Error executing...\n'%s'", query), ex);

        throw ex;
    }

    sw.stop();

    LOGGER.debug(String.format("Query...\n'%s'\nTook %s", query, sw.toString()));
}

From source file:com.goody.backend.entities.Todo.java

public boolean valid() {
    return StringUtils.isNoneBlank(this.title);
}

From source file:com.hbc.api.trade.order.service.OrderLogService.java

public List<OrderLog> getMisOrderLog(String orderNo) {
    OrderLogExample example = new OrderLogExample();
    Criteria criteria = example.createCriteria();
    criteria.andOrderNoEqualTo(orderNo);
    criteria.andLogTypeNotEqualTo(LogType.ADD_COMMENTS_MANUALLY.value);
    List<OrderLog> orderLogList = orderLogMapper.selectByExample(example);
    OrderBean orderBean = orderQueryService.getOrderByNo(orderNo);
    for (OrderLog orderLog : orderLogList) {
        if (StringUtils.isNoneBlank(orderLog.getContent())
                && StringUtils.isNoneBlank(orderBean.getGuideName())) {
            String content = StringUtils.replace(orderLog.getContent(), "", orderBean.getGuideName());
            orderLog.setContent(content);
        }//from w  ww . j  a v a2s  . c  o  m
    }
    return orderLogList;
}

From source file:br.com.webbudget.domain.model.repository.logbook.EntryRepository.java

/**
 *
 * @param vehicle/* www .  j  a  v  a2 s .  c  o m*/
 * @param filter
 * @return
 */
@Override
public List<Entry> listByVehicleAndFilter(Vehicle vehicle, String filter) {

    final Criteria criteria = this.createCriteria();

    criteria.createAlias("vehicle", "v");
    criteria.add(Restrictions.eq("v.id", vehicle.getId()));

    if (StringUtils.isNoneBlank(filter)) {
        criteria.createAlias("movementClass", "mc");
        criteria.add(Restrictions.or(Restrictions.ilike("place", filter + "%"),
                Restrictions.ilike("title", filter + "%"), Restrictions.ilike("mc.name", filter + "%"),
                Restrictions.ilike("description", "%" + filter + "%")));
    }

    return criteria.list();
}

From source file:io.sledge.core.impl.servlets.SledgeUploadServlet.java

@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
        throws ServletException, IOException {
    RequestParameter packageRequestParam = request.getRequestParameter("package");

    if (packageRequestParam != null && !packageRequestParam.isFormField()
            && packageRequestParam.getInputStream() != null
            && StringUtils.isNoneBlank(packageRequestParam.getFileName())) {
        String fileName = packageRequestParam.getFileName();

        ApplicationPackage appPackage = new ApplicationPackage(fileName);

        appPackage.setState(ApplicationPackageState.UPLOADED.toString());
        appPackage.setPackageFile(packageRequestParam.getInputStream());

        PackageRepository packageRepository = new SledgePackageRepository(request.getResourceResolver());
        List<ApplicationPackage> installedPackages = packageRepository.getApplicationPackages();

        boolean update = false;
        for (ApplicationPackage installedPackage : installedPackages) {
            if (installedPackage.getPackageFilename().equals(appPackage.getPackageFilename())) {
                update = true;/*from www.j a  va  2  s. c  om*/
                break;
            }
        }
        if (!update) {
            packageRepository.addApplicationPackage(appPackage);
        } else {
            packageRepository.updateApplicationPackage(appPackage);
        }

        String redirectUrl = request.getParameter(SlingPostConstants.RP_REDIRECT_TO);
        response.sendRedirect(redirectUrl);
    } else {
        response.sendRedirect(request.getRequestURI());
    }
}

From source file:com.oembedler.moon.graphql.SpringGraphQLSchemaBeanFactory.java

private <T> T retrieveBean(final Class<T> objectClass, final String beanName) {
    T object = null;//  w ww .j  a  v a  2  s .  c  o m
    if (StringUtils.isNoneBlank(beanName) && applicationContext != null
            && applicationContext.containsBean(beanName)) {
        object = (T) applicationContext.getBean(beanName);
    } else {
        object = BeanFactoryUtils.beanOfType(applicationContext, objectClass);
    }
    return object;
}