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:dao.ScriptRuntimeRowMapper.java

@Override
public ScriptRuntime mapRow(ResultSet rs, int rowNum) throws SQLException {
    String started = rs.getString(JOB_STARTED_COLUMN);
    Float elapsedTime = rs.getFloat(ELAPSED_TIME_COLUMN);
    String flowPath = rs.getString(FLOW_PATH_COLUMN);
    String jobName = rs.getString(JOB_NAME_COLUMN);

    ScriptRuntime runtime = new ScriptRuntime();
    runtime.jobStarted = started;//from   w  w  w. j av a2  s .  c  o  m
    runtime.elapsedTime = elapsedTime;
    if (StringUtils.isNotBlank(flowPath)) {
        int index = flowPath.indexOf(':');
        if (index != -1) {
            flowPath = "/" + flowPath.substring(index + 1);
        }
    }
    runtime.jobPath = flowPath + "/" + jobName;

    return runtime;
}

From source file:de.qaware.seu.as.code.plugins.credentials.ClearCredentialsTask.java

/**
 * Is executed from gradle when running the 'clearCredentials' task.
 *//*  ww w  .  ja  v  a 2s.  c o  m*/
@TaskAction
public void onAction() {
    String service = getService();
    if (StringUtils.isNotBlank(service)) {
        getConsole().format("%n");
        String answer = getConsole().readLine("Clear credentials for service %s (y/N)?", service);
        if (StringUtils.equalsIgnoreCase(answer, "y")) {
            getStorage().clearCredentials(service);
        }
    }
}

From source file:com.netflix.genie.core.jpa.specifications.JpaCommandSpecs.java

/**
 * Get a specification using the specified parameters.
 *
 * @param name     The name of the command
 * @param user     The name of the user who created the command
 * @param statuses The status of the command
 * @param tags     The set of tags to search the command for
 * @return A specification object used for querying
 *///  www.  j av  a2  s . co  m
public static Specification<CommandEntity> find(final String name, final String user,
        final Set<CommandStatus> statuses, final Set<String> tags) {
    return (final Root<CommandEntity> root, final CriteriaQuery<?> cq, final CriteriaBuilder cb) -> {
        final List<Predicate> predicates = new ArrayList<>();
        if (StringUtils.isNotBlank(name)) {
            predicates.add(JpaSpecificationUtils.getStringLikeOrEqualPredicate(cb,
                    root.get(CommandEntity_.name), name));
        }
        if (StringUtils.isNotBlank(user)) {
            predicates.add(JpaSpecificationUtils.getStringLikeOrEqualPredicate(cb,
                    root.get(CommandEntity_.user), user));
        }
        if (statuses != null && !statuses.isEmpty()) {
            final List<Predicate> orPredicates = statuses.stream()
                    .map(status -> cb.equal(root.get(CommandEntity_.status), status))
                    .collect(Collectors.toList());
            predicates.add(cb.or(orPredicates.toArray(new Predicate[orPredicates.size()])));
        }
        if (tags != null && !tags.isEmpty()) {
            predicates
                    .add(cb.like(root.get(CommandEntity_.tags), JpaSpecificationUtils.getTagLikeString(tags)));
        }
        return cb.and(predicates.toArray(new Predicate[predicates.size()]));
    };
}

From source file:com.meltmedia.cadmium.core.commands.ExternalIpCommandAction.java

@Override
public boolean execute(CommandContext<ExternalIpMessage> ctx) throws Exception {
    if (StringUtils.isNotBlank(ctx.getMessage().getBody().getIp())) {
        membershipTracker.updateMembersIp(ctx.getSource(), ctx.getMessage().getBody().getIp());
    }/* www.j a  v a  2s  . com*/
    return true;
}

From source file:com.bazaarvoice.seo.sdk.exception.BVSdkException.java

@Override
public String getMessage() {
    if (StringUtils.isNotBlank(errorCode)) {
        return BVMessageUtil.getMessage(errorCode);
    }/*from  w ww  .  jav  a2s  .co  m*/

    return super.getMessage();
}

From source file:com.ottogroup.bi.streaming.operator.json.converter.StringToJsonObject.java

/**
 * @see org.apache.flink.api.common.functions.FlatMapFunction#flatMap(java.lang.Object, org.apache.flink.util.Collector)
 *///from   ww  w  . ja  va  2  s.c o m
public void flatMap(String content, Collector<JSONObject> collector) throws Exception {
    if (StringUtils.isNotBlank(content)) {
        try {
            if (collector != null && StringUtils.isNotBlank(content))
                collector.collect(new JSONObject(content));
        } catch (Exception e) {
            LOG.error("Failed to convert incoming string into JSON object representation. Reason: "
                    + e.getMessage(), e);
        }
    }
}

From source file:edu.usu.sdl.openstorefront.core.sort.ArchitectureComparator.java

@Override
public int compare(T o1, T o2) {
    //Codes should be numbers
    BigDecimal codeKey1;/*from w ww .ja va 2 s.c  o m*/
    BigDecimal codeKey2;

    if (o1.getSortOrder() != null && o2.getSortOrder() != null) {
        return o1.getSortOrder().compareTo(o2.getSortOrder());
    } else {

        if (StringUtils.isNotBlank(o1.getArchitectureCode())) {
            codeKey1 = StringProcessor.archtecureCodeToDecimal(o1.getArchitectureCode());
        } else {
            codeKey1 = StringProcessor.archtecureCodeToDecimal(o1.getAttributeCode());
        }

        if (StringUtils.isNotBlank(o2.getArchitectureCode())) {
            codeKey2 = StringProcessor.archtecureCodeToDecimal(o2.getArchitectureCode());
        } else {
            codeKey2 = StringProcessor.archtecureCodeToDecimal(o2.getAttributeCode());
        }

        return codeKey1.compareTo(codeKey2);
    }
}

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

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

    if (StringUtils.isNotBlank(jsonObject.getString(MavenDependencyConfiguration.PROPERTY_KEY))) {
        mavenDependencySettingsService
                .deleteMavenDependency(jsonObject.getString(MavenDependencyConfiguration.PROPERTY_KEY));
        LOGGER.info(MavenDependencyConfiguration.INFO_DELETE_SUCCESS + jsonObject.toString());
        response.stream().setStatus(HTTPConfiguration.HTTP_STATUS_OK);
    } else {
        LOGGER.error(MavenDependencyConfiguration.ERROR_DELETE_INVALID_INPUT + jsonObject.toString());
        response.stream().setStatus(HTTPConfiguration.HTTP_STATUS_NOT_MODIFIED);
    }
}

From source file:at.tfr.securefs.key.UiShare.java

public boolean equalsReal(String share) {
    return StringUtils.isNotBlank(share) && share.equals(realShare);
}

From source file:ch.cyberduck.core.googledrive.DriveFileidProvider.java

@Override
public String getFileid(final Path file, final ListProgressListener listener) throws BackgroundException {
    if (StringUtils.isNotBlank(file.attributes().getVersionId())) {
        return file.attributes().getVersionId();
    }//from w ww.  j  a v a2s. c  o m
    if (file.isRoot()) {
        return DriveHomeFinderService.ROOT_FOLDER_ID;
    }
    if (file.equals(DriveHomeFinderService.MYDRIVE_FOLDER)) {
        return DriveHomeFinderService.ROOT_FOLDER_ID;
    }
    final AttributedList<Path> list = new FileidDriveListService(session, this, file).list(file.getParent(),
            new DisabledListProgressListener());
    final Path found = list.filter(new NullFilter<>()).find(new SimplePathPredicate(file));
    if (null == found) {
        throw new NotfoundException(file.getAbsolute());
    }
    return found.attributes().getVersionId();
}