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

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

Introduction

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

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

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

Usage

From source file:at.pagu.soldockr.core.ResultHelper.java

static Map<Field, Page<FacetEntry>> convertFacetQueryResponseToFacetPageMap(FacetQuery query,
        QueryResponse response) {/*from   www .ja  va 2 s.c  o m*/
    Assert.notNull(query, "Cannot convert response for 'null', query");

    if (!query.hasFacetOptions() || response == null) {
        return Collections.emptyMap();
    }
    Map<Field, Page<FacetEntry>> facetResult = new HashMap<Field, Page<FacetEntry>>();

    if (CollectionUtils.isNotEmpty(response.getFacetFields())) {
        int initalPageSize = query.getFacetOptions().getPageable().getPageSize();
        for (FacetField facetField : response.getFacetFields()) {
            if (facetField != null && StringUtils.isNotBlank(facetField.getName())) {
                Field field = new SimpleField(facetField.getName());
                if (CollectionUtils.isNotEmpty(facetField.getValues())) {
                    List<FacetEntry> pageEntries = new ArrayList<FacetEntry>(initalPageSize);
                    for (Count count : facetField.getValues()) {
                        if (count != null) {
                            pageEntries.add(new SimpleFacetEntry(field, count.getName(), count.getCount()));
                        }
                    }
                    facetResult.put(field, new FacetPage<FacetEntry>(pageEntries,
                            query.getFacetOptions().getPageable(), facetField.getValueCount()));
                } else {
                    facetResult.put(field, new FacetPage<FacetEntry>(Collections.<FacetEntry>emptyList(),
                            query.getFacetOptions().getPageable(), 0));
                }
            }
        }
    }
    return facetResult;
}

From source file:com.haulmont.cuba.web.auth.DefaultDomainAliasesResolver.java

@Inject
public DefaultDomainAliasesResolver(Configuration configuration) {
    WebAuthConfig webConfig = configuration.getConfig(WebAuthConfig.class);
    String aliasesConfig = webConfig.getActiveDirectoryAliases();
    if (StringUtils.isNotBlank(aliasesConfig)) {
        String[] aliasesPairs = StringUtils.split(aliasesConfig, ';');
        for (String aliasDefinition : aliasesPairs) {
            // skip blank parts
            if (StringUtils.isNotBlank(aliasDefinition)) {
                String[] aliasParts = StringUtils.split(aliasDefinition, '|');

                if (aliasParts == null || aliasParts.length != 2 || StringUtils.isBlank(aliasParts[0])
                        || StringUtils.isBlank(aliasParts[1])) {
                    log.warn("Incorrect domain alias definition: '{}'", aliasDefinition);
                } else {
                    aliases.put(aliasParts[0].toLowerCase(), aliasParts[1]);
                }//  ww  w . ja v  a2  s .  c om
            }
        }
    }
}

From source file:de.hybris.platform.b2bpunchoutaddon.interceptors.PunchOutBeforeViewHandler.java

@Override
public void beforeView(final HttpServletRequest request, final HttpServletResponse response,
        final ModelAndView modelAndView) throws PunchOutException {
    final String viewName = modelAndView.getViewName();
    try {// w  w  w . ja  v a2 s  . c o  m
        if (StringUtils.isNotBlank(
                (String) request.getSession().getAttribute(B2bpunchoutaddonConstants.PUNCHOUT_USER))) {
            modelAndView.setViewName(getPunchoutView(viewName));
            setPunchoutModeInModel(modelAndView.getModelMap());
        }
    } catch (final Exception e) {
        throw new PunchOutException(PunchOutResponseCode.INTERNAL_SERVER_ERROR, e.getMessage(), e);
    }
}

From source file:com.haulmont.cuba.web.app.ui.serverlogviewer.AdditionLoggerWindow.java

public void addLogger() {
    if (StringUtils.isNotBlank(loggerNameField.<String>getValue())) {
        if (logLevelField.getValue() != null) {
            this.selectedLoggerName = loggerNameField.getValue();
            this.selectedLevel = logLevelField.getValue();

            close(COMMIT_ACTION_ID);//ww  w.ja  v a2 s .  co m
        } else
            showNotification(getMessage("logger.notSelectedLevel"), NotificationType.HUMANIZED);
    } else {
        loggerNameField.setValue(null);
        showNotification(getMessage("logger.notSelected"), NotificationType.HUMANIZED);
    }
}

From source file:ar.com.zauber.commons.spring.web.controllers.ExceptionController.java

/** Creates the ExceptionController.*/
public ExceptionController(final Map<Integer, String> map, final String defaultView) {
    Validate.notNull(map);/*from w w  w  .  j  ava 2 s . c o  m*/
    Validate.isTrue(StringUtils.isNotBlank(defaultView));
    this.map = map;
    this.defaultView = defaultView;
}

From source file:com.googlecode.jtiger.modules.ecside.view.html.TableActions.java

public String getOnInvokeAction() {
    String onInvokeAction = model.getTable().getOnInvokeAction();
    if (StringUtils.isNotBlank(onInvokeAction)) {
        return onInvokeAction;
    }/*  w w w.  jav a 2s  . c  o  m*/

    return getSubmitAction();
}

From source file:ips1ap101.lib.core.jsf.component.AreaTexto.java

/**
 * {@inheritDoc}/*from   w w w  .  j  a v  a2 s .com*/
 */
@Override
public String getToolTip() {
    String superstr = super.getToolTip();
    if (StringUtils.isNotBlank(superstr) && getValueExpression("toolTip") == null) {
        if (superstr.startsWith("BundleParametros.")) {
            int i = superstr.indexOf('.');
            String key = superstr.substring(i + 1).trim();
            if (key.length() > 0) {
                return BundleParametros.getToolTip(key);
            }
        }
    }
    return superstr;
}

From source file:io.apiman.plugins.session.util.Messages.java

/**
 * Creates a new {@link Messages} using the package name of the class as the path and the simple name of the
 * class as the message prefix./*  ww  w.j a v  a 2s.co  m*/
 *
 * @param packageName the package name of the bundle
 * @param messagePrefix the message prefix (can be {@code null})
 */
public Messages(String packageName, String messagePrefix) {
    this.messagePrefix = (StringUtils.isNotBlank(messagePrefix) ? messagePrefix + "." : "");
    this.resourceBundle = ResourceBundle.getBundle(packageName + "." + DEFAULT_BUNDLE_NAME);
}

From source file:br.com.surittec.suricdi.example.domain.repository.PessoaRepository.java

/**
 * Exemplo de utilizacao do JPQL //from w w w. j a v  a2s .c o m
 */
public List<Pessoa> findByNome(String nome) {

    JPQL jpql = jpql().from("Pessoa");

    if (StringUtils.isNotBlank(nome)) {
        jpql.where("nome = :nome").withParam("nome", nome);
    }

    return jpql.getResultList(Pessoa.class);
}

From source file:com.qualogy.qafe.business.resource.rdb.query.QueryToStringCreator.java

/**
 * - sql as text goes first on sql as attribute
 * - sql attribute  goes first on table property
 * - if tableProperty is supplied services in and out params will be used
 *
 * @param query//  w ww  . ja  v  a  2  s . c o m
 * @param inputMapping
 * @param outputMapping
 * @return
 */
public static String toString(SQLQuery query, MapSqlParameterSource namedParameters, String[] inputMapping,
        Set outputMapping) {
    String sql = null;
    sql = (StringUtils.isNotBlank(query.getSqlAsAttribute())) ? query.getSqlAsAttribute()
            : query.getSqlAsText();

    if (StringUtils.isBlank(sql)) {
        if (StringUtils.isNotBlank(query.getTable())) {
            sql = enrichSQLAroundTableProp(sql, query);

            if (query instanceof Update) {
                sql = enrichUpdateWithParams(sql, query, namedParameters, inputMapping);
            } else if (query instanceof Insert) {
                sql = enrichSQLWithInParams(sql, query, namedParameters, inputMapping);
            } else if (query instanceof Select) {
                sql = enrichSQLWithInParams(sql, query, namedParameters, inputMapping);
            } else if (query instanceof Delete) {
                sql = enrichSQLWithInParams(sql, query, namedParameters, inputMapping);
            }

            if ((sql != null) && !sql.toLowerCase().startsWith(query.getKeyword())) {
                sql = query.getKeyword() + " " + sql;
            }
        }
    }
    sql = manageDynamicQueryReplacement(namedParameters, sql);
    return sql;
}